… | |
… | |
231 | } |
231 | } |
232 | |
232 | |
233 | /* |
233 | /* |
234 | * All but object "save_item" are elimentated from |
234 | * All but object "save_item" are elimentated from |
235 | * the container list. Note we have to becareful to remove the inventories |
235 | * the container list. Note we have to becareful to remove the inventories |
236 | * of objects in the cauldron inventory (ex icecube has stuff in it). |
236 | * of objects in the cauldron inventory (ex icecube has stuff in it). |
237 | */ |
237 | */ |
238 | static void |
238 | static void |
239 | remove_contents (object *first_ob, object *save_item) |
239 | remove_contents (object *first_ob, object *save_item) |
240 | { |
240 | { |
241 | // this cries for a cleaner rewrite, removing save_item first possibly |
241 | // this cries for a cleaner rewrite, removing save_item first possibly |
… | |
… | |
286 | item->nrof = nrof; |
286 | item->nrof = nrof; |
287 | } |
287 | } |
288 | } |
288 | } |
289 | |
289 | |
290 | /** |
290 | /** |
291 | * Essentially a wrapper for make_item_from_recipe() and |
291 | * Essentially a wrapper for make_item_from_recipe() and |
292 | * insert_ob_in_ob. If the caster has some alchemy skill, then they might |
292 | * insert_ob_in_ob. If the caster has some alchemy skill, then they might |
293 | * gain some exp from (successfull) fabrication of the product. |
293 | * gain some exp from (successfull) fabrication of the product. |
294 | * If nbatches==-1, don't give exp for this creation (random generation/ |
294 | * If nbatches==-1, don't give exp for this creation (random generation/ |
295 | * failed recipe) |
295 | * failed recipe) |
296 | */ |
296 | */ |
297 | static object * |
297 | static object * |
298 | attempt_recipe (object *caster, object *cauldron, int ability, recipe *rp, int nbatches) |
298 | attempt_recipe (object *caster, object *cauldron, int ability, recipe *rp, int nbatches) |
… | |
… | |
536 | } |
536 | } |
537 | else if (level == 151) |
537 | else if (level == 151) |
538 | { /* CREATE RANDOM ARTIFACT */ |
538 | { /* CREATE RANDOM ARTIFACT */ |
539 | object *tmp; |
539 | object *tmp; |
540 | |
540 | |
541 | /* this is meant to be better than prior possiblity, |
541 | /* this is meant to be better than prior possiblity, |
542 | * in this one, we allow *any* valid alchemy artifact |
542 | * in this one, we allow *any* valid alchemy artifact |
543 | * to be made (rather than only those on the given |
543 | * to be made (rather than only those on the given |
544 | * formulalist) */ |
544 | * formulalist) */ |
545 | if (!rp) |
545 | if (!rp) |
546 | rp = get_random_recipe ((recipelist *) NULL); |
546 | rp = get_random_recipe ((recipelist *) NULL); |
… | |
… | |
570 | * could be if the user fails to concoct a recipe properly. Factors include |
570 | * could be if the user fails to concoct a recipe properly. Factors include |
571 | * the number of ingredients, the length of the name of each ingredient, |
571 | * the number of ingredients, the length of the name of each ingredient, |
572 | * the user's effective level, the user's Int and the enchantment on the |
572 | * the user's effective level, the user's Int and the enchantment on the |
573 | * mixing device (aka "cauldron"). Higher values of 'danger' indicate more |
573 | * mixing device (aka "cauldron"). Higher values of 'danger' indicate more |
574 | * danger. Note that we assume that we have had the caster ready the alchemy |
574 | * danger. Note that we assume that we have had the caster ready the alchemy |
575 | * skill *before* this routine is called. (no longer auto-readies that skill) |
575 | * skill *before* this routine is called. (no longer auto-readies that skill) |
576 | * -b.t. |
576 | * -b.t. |
577 | */ |
577 | */ |
578 | static int |
578 | static int |
579 | calc_alch_danger (object *caster, object *cauldron, object *skill, recipe *rp) |
579 | calc_alch_danger (object *caster, object *cauldron, object *skill, recipe *rp) |
580 | { |
580 | { |
581 | int danger = 0; |
581 | int danger = 0; |
… | |
… | |
795 | return result; |
795 | return result; |
796 | } |
796 | } |
797 | |
797 | |
798 | /** |
798 | /** |
799 | * Main part of the ALCHEMY code. From this we call fctns |
799 | * Main part of the ALCHEMY code. From this we call fctns |
800 | * that take a look at the contents of the 'cauldron' and, using these ingredients, |
800 | * that take a look at the contents of the 'cauldron' and, using these ingredients, |
801 | * we construct an integer formula value which is referenced (randomly) against a |
801 | * we construct an integer formula value which is referenced (randomly) against a |
802 | * formula list (the formula list chosen is based on the # contents of the cauldron). |
802 | * formula list (the formula list chosen is based on the # contents of the cauldron). |
803 | * |
803 | * |
804 | * If we get a match between the recipe indicated in cauldron contents and a |
804 | * If we get a match between the recipe indicated in cauldron contents and a |
805 | * randomly chosen one, an item is created and experience awarded. Otherwise |
805 | * randomly chosen one, an item is created and experience awarded. Otherwise |
806 | * various failure effects are possible (getting worse and worse w/ # cauldron |
806 | * various failure effects are possible (getting worse and worse w/ # cauldron |
807 | * ingredients). Note that the 'item' to be made can be *anything* listed on |
807 | * ingredients). Note that the 'item' to be made can be *anything* listed on |
808 | * the artifacts list in lib/artifacts which has a recipe listed in lib/formulae. |
808 | * the artifacts list in lib/artifacts which has a recipe listed in lib/formulae. |
809 | * |
809 | * |
810 | * To those wondering why I am using the funky formula index method: |
810 | * To those wondering why I am using the funky formula index method: |
811 | * 1) I want to match recipe to ingredients regardless of ordering. |
811 | * 1) I want to match recipe to ingredients regardless of ordering. |
812 | * 2) I want a fast search for the 'right' recipe. |
812 | * 2) I want a fast search for the 'right' recipe. |