Page 1 of 1

I finally looked at alchemy.c, and... <SNARL!>

Posted: Sun Aug 31, 2008 11:37 pm
by Mental Mouse
OK, I've been complaining for a while about the excessively nasty backfires from alchemy. Well, I finally broke down and looked at the source... and lo and behold, around line 700, I find this:

Code: Select all

  /* Ingredients. Longer names usually mean rarer stuff.
     * Thus the backfire is worse. Also, more ingredients
     * means we are attempting a more powerfull potion,
     * and thus the backfire will be worse.  */
   for(item=cauldron->inv;item;item=item->below) {
        strcpy(name,item->name);
        if(item->title) sprintf(name,"%s %s",item->name,item->title);
        danger += (strtoint(name)/1000) + 3;
	nrofi++;
   }
The "strtoint()" function comes from common/recipe.c, and adds the ASCII values of the lowercase versions of all characters in the buffer, multiplied by the item count. In the above formula, that comes out to adding "about 1" for every 10 letters in the name, times the count. (Spaces and apostrophes count for less.) Because, you know, a "bottle of philosophical oil" (24 letters) is so much rarer than a "titan's head" (only 9 letters)! </sarcasm>

May I suggest that things could be made much saner by simply eliminating that part of the danger formula? If you want to check for rare ingredients, I note that recipe.c already has functions that look up an object's source archetypes -- so how about using the monster's *level* for corpses and body parts, and the difficulty rating for alchemical products?

Posted: Wed Sep 03, 2008 5:14 am
by mwedel
I think the problem is that the alchemy code itself is in need of a large re-write.

As such, there isn't as much interest to go in and make smaller adjustments/tweaks, when all that may go away.

The problem is that major rewrite needs to be done.

Alchemy re-write

Posted: Wed Sep 03, 2008 1:27 pm
by Mental Mouse
If I actually went in and did that, how would I politely submit that for general review? (I wouldn't want to shove my initial re-write straight into the code-base!)

I would probably want to introduce a few new ingredients while I was at it, such as water of amethyst (but then amethysts would have to get into the treasure-lists), acid (and perhaps lye), and more advanced oils. For that matter, P-oil (and the new oils) should be more available in the shops, and water should be generally available in more quantity! As it stands, Scorn's alchemy shop looks like the *only* place where water is available in unlimited quantity, and beginning alchemists *need* it in large quantities.

And I'd want organs and corpses in general to remember the level of the monsters they came from!

Posted: Thu Sep 11, 2008 6:20 am
by mwedel
First step would probably be to send mail to the mailing list broadly describing the changes you are looking to make.

After that, you make the changes. Do some testing - make sure things work. Then give a little advanced warning, and commit into the trunk.

If you're concerned about your changes, you could put them up as a patch or the like for others to review. I'm just not sure how many folks would go and actually review them.

Posted: Thu Sep 11, 2008 4:40 pm
by Leaf
mwedel wrote: If you're concerned about your changes, you could put them up as a patch or the like for others to review. I'm just not sure how many folks would go and actually review them.
Recommendations and guidelines for submitting patches is summarized at,
http://wiki.metalforge.net/doku.php/cod ... in_patches

Posted: Tue Jun 26, 2012 8:07 pm
by SilverNexus
Another possible use for organs and corpses maintaining their level would be for dragon resistance gain. For example, if a level 10 dragon player kills a level 4 orc with 25% resistance to cold (a weird example, I know), the level 10 player should have a better chance to gain resistance if the orc were level 50 (although how they would manage to defeat it is beyond me).

The only problem I see is that, on multiplayer servers, higher level characters could run around and fetch flesh for a low-level dragon ally, so that that ally gains large quantities of resistance early and becomes useful without having to do anything. Then, now that the dragon is resistant to everything, the game becomes far too easy for that character.

Posted: Sun Jul 01, 2012 9:20 am
by Ryo
That is exactly as the resistances for dragons work, unless I'm mistaking :)

FLESH items get some resistances, and dragon players eating them have a probability (based on their resistance points in the concerned resistance) to gain some resist (whao, talk about 'resist' redundance :))

Posted: Sun Jul 01, 2012 2:41 pm
by SilverNexus
I realized that's how dragon resistances do work, I was just thinking about what would happen if monster level was also taken into account for resistance gain. It would, like so many other changes, require a bit of rebalancing to take place.

Posted: Sun Jul 01, 2012 5:22 pm
by Ryo
SilverNexus wrote:if monster level was also taken into account for resistance gain.
Monster level is taken into account already :)

Check server/types/food/food.c line 293 (trunk revision 18313)

Posted: Sun Jul 01, 2012 5:30 pm
by SilverNexus
ryo wrote:Check server/types/food/food.c line 293 (trunk revision 18313)
Yep, I see it is. Thank you for the clarification.