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++;
}
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?