version 1.21 | | version 1.22 |
---|
| | |
/* | | /* |
* static char *rcsid_alchemy_c = | | * static char *rcsid_alchemy_c = |
* "$Id: alchemy.c,v 1.21 2004/08/24 19:43:59 akirschbaum Exp $"; | | * "$Id: alchemy.c,v 1.22 2005/03/09 21:20:35 ryo_saeba Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
#include <skills.h> | | #include <skills.h> |
#include <spells.h> | | #include <spells.h> |
| | |
/* define this for some helpful debuging information */ | | /** define this for some helpful debuging information */ |
#define ALCHEMY_DEBUG | | #define ALCHEMY_DEBUG |
| | |
/* define this for loads of (marginal) debuging information */ | | /** define this for loads of (marginal) debuging information */ |
#define EXTREME_ALCHEMY_DEBUG | | #define EXTREME_ALCHEMY_DEBUG |
| | |
| | /** Random cauldrons effects */ |
static char *cauldron_effect [] = { | | static char *cauldron_effect [] = { |
"vibrates briefly", | | "vibrates briefly", |
"produces a cloud of steam", | | "produces a cloud of steam", |
| | |
static int is_defined_recipe(const recipe *rp, const object *cauldron, object *caster); | | static int is_defined_recipe(const recipe *rp, const object *cauldron, object *caster); |
| | |
| | |
/* cauldron_sound() - returns a random selection from cauldron_effect[] */ | | /** Returns a random selection from cauldron_effect[] */ |
| | |
char * cauldron_sound ( void ) { | | char * cauldron_sound ( void ) { |
int size=sizeof(cauldron_effect)/sizeof(char *); | | int size=sizeof(cauldron_effect)/sizeof(char *); |
| | |
return cauldron_effect[rndm(0, size-1)]; | | return cauldron_effect[rndm(0, size-1)]; |
} | | } |
| | |
/* attempt_do_alchemy() - Main part of the ALCHEMY code. From this we call fctns | | /**
|
| | * Main part of the ALCHEMY code. From this we call fctns |
* that take a look at the contents of the 'cauldron' and, using these ingredients, | | * that take a look at the contents of the 'cauldron' and, using these ingredients, |
* we construct an integer formula value which is referenced (randomly) against a | | * we construct an integer formula value which is referenced (randomly) against a |
* formula list (the formula list chosen is based on the # contents of the cauldron). | | * formula list (the formula list chosen is based on the # contents of the cauldron). |
| | |
calc_alch_danger(caster, cauldron, rp)); | | calc_alch_danger(caster, cauldron, rp)); |
} | | } |
| | |
/* content_recipe_value()- recipe value of the entire contents of a container. | | /**
|
| | * Recipe value of the entire contents of a container. |
* This appears to just generate a hash value, which I guess for now works | | * This appears to just generate a hash value, which I guess for now works |
* ok, but the possibility of duplicate hashes is certainly possible - msw | | * ok, but the possibility of duplicate hashes is certainly possible - msw |
*/ | | */ |
| | |
return formula; | | return formula; |
} | | } |
| | |
/* numb_ob_inside() */ | | /**
|
| | * Returns total number of items in op
|
| | */ |
| | |
int numb_ob_inside (object *op) { | | int numb_ob_inside (object *op) { |
object *tmp=op->inv; | | object *tmp=op->inv; |
| | |
return o_number; | | return o_number; |
} | | } |
| | |
/* attempt_recipe() - essentially a wrapper for make_item_from_recipe() and | | /**
|
| | * Essentially a wrapper for make_item_from_recipe() and |
* insert_ob_in_ob. If the caster has some alchemy skill, then they might | | * insert_ob_in_ob. If the caster has some alchemy skill, then they might |
* gain some exp from (successfull) fabrication of the product. | | * gain some exp from (successfull) fabrication of the product. |
* If nbatches==-1, don't give exp for this creation (random generation/ | | * If nbatches==-1, don't give exp for this creation (random generation/ |
| | |
| | |
| | |
| | |
/* adjust_product() - we adjust the nrof, exp and level of the final product, based | | /**
|
* on the item's default parameters, and the relevant caster skill level. */ | | * We adjust the nrof, exp and level of the final product, based |
| | * on the item's default parameters, and the relevant caster skill level.
|
| | */ |
| | |
void adjust_product(object *item, int lvl, int yield) { | | void adjust_product(object *item, int lvl, int yield) { |
int nrof=1; | | int nrof=1; |
| | |
} | | } |
| | |
| | |
/* make_item_from_recipe()- using a list of items and a recipe to make an artifact. */ | | /**
|
| | * Using a list of items and a recipe to make an artifact.
|
| | */ |
| | |
object * make_item_from_recipe(object *cauldron, recipe *rp) { | | object * make_item_from_recipe(object *cauldron, recipe *rp) { |
artifact *art=NULL; | | artifact *art=NULL; |
| | |
} | | } |
| | |
| | |
/* find_transmution_ob() - looks through the ingredient list, if we find a | | /**
|
| | * Looks through the ingredient list. If we find a |
* suitable object in it - we will use that to make the requested artifact. | | * suitable object in it - we will use that to make the requested artifact. |
* Otherwise the code returns a 'generic' item. -b.t. | | * Otherwise the code returns a 'generic' item. -b.t. |
*/ | | */ |
| | |
} | | } |
| | |
| | |
/* alchemy_failure_effect - Ouch. We didnt get the formula we wanted. | | /**
|
| | * Ouch. We didnt get the formula we wanted. |
* This fctn simulates the backfire effects--worse effects as the level | | * This fctn simulates the backfire effects--worse effects as the level |
* increases. If SPELL_FAILURE_EFFECTS is defined some really evil things | | * increases. If SPELL_FAILURE_EFFECTS is defined some really evil things |
* can happen to the would be alchemist. This table probably needs some | | * can happen to the would be alchemist. This table probably needs some |
| | |
} | | } |
| | |
| | |
/* remove_contents() - all but object "save_item" are elimentated from | | /**
|
| | * All but object "save_item" are elimentated from |
* the container list. Note we have to becareful to remove the inventories | | * the container list. Note we have to becareful to remove the inventories |
* of objects in the cauldron inventory (ex icecube has stuff in it). | | * of objects in the cauldron inventory (ex icecube has stuff in it). |
*/ | | */ |
| | |
} | | } |
} | | } |
| | |
/* calc_alch_danger() - "Danger" level will determine how bad the backfire | | /**
|
| | *"Danger" level, will determine how bad the backfire |
* could be if the user fails to concoct a recipe properly. Factors include | | * could be if the user fails to concoct a recipe properly. Factors include |
* the number of ingredients, the length of the name of each ingredient, | | * the number of ingredients, the length of the name of each ingredient, |
* the user's effective level, the user's Int and the enchantment on the | | * the user's effective level, the user's Int and the enchantment on the |
| | |
return danger; | | return danger; |
} | | } |
| | |
/* is_defined_recipe() - determines if ingredients in a container match the | | /**
|
| | * Determines if ingredients in a container match the |
* proper ingredients for a recipe. | | * proper ingredients for a recipe. |
* | | * |
* rp is the recipe to check | | * rp is the recipe to check |