version 1.28 | | version 1.29 |
---|
| | |
/* | | /* |
* static char *rcsid_alchemy_c = | | * static char *rcsid_alchemy_c = |
* "$Id: alchemy.c,v 1.28 2006/05/05 09:26:34 ryo_saeba Exp $"; | | * "$Id: alchemy.c,v 1.29 2006/09/03 13:01:02 ryo_saeba Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
static void remove_contents (object *first_ob, object *save_item); | | static void remove_contents (object *first_ob, object *save_item); |
static void adjust_product(object *item, int lvl, int yield); | | static void adjust_product(object *item, int lvl, int yield); |
static object * find_transmution_ob ( object *first_ingred, recipe *rp, size_t *rp_arch_index, int create_item); | | static object * find_transmution_ob ( object *first_ingred, recipe *rp, size_t *rp_arch_index, int create_item); |
| | static void attempt_do_alchemy(object *caster, object *cauldron); |
| | |
/** Returns a random selection from cauldron_effect[] */ | | /** Returns a random selection from cauldron_effect[] */ |
static const char *cauldron_sound(void) { | | static const char *cauldron_sound(void) { |
| | |
* -b.t. | | * -b.t. |
*/ | | */ |
| | |
void attempt_do_alchemy(object *caster, object *cauldron) { | | static void attempt_do_alchemy(object *caster, object *cauldron) { |
recipelist *fl; | | recipelist *fl; |
recipe *rp=NULL; | | recipe *rp=NULL; |
float success_chance; | | float success_chance; |
| | |
#endif | | #endif |
return result; | | return result; |
} | | } |
| | |
| | /** |
| | * Handle use_skill for alchemy-like items. |
| | * Will return 1 if any recipe was attempted, 0 else. |
| | * Will inform player if attempting to use unpaid cauldron or ingredient. |
| | **/ |
| | int use_alchemy(object* op) |
| | { |
| | object* tmp, *item, *next; |
| | object* unpaid_cauldron = NULL; |
| | object* unpaid_item = NULL; |
| | int did_alchemy = 0; |
| | |
| | for (tmp=get_map_ob(op->map, op->x, op->y); tmp != NULL;tmp=next) { |
| | next=tmp->above; |
| | if(QUERY_FLAG(tmp, FLAG_IS_CAULDRON)) { |
| | if (QUERY_FLAG(tmp, FLAG_UNPAID)) { |
| | unpaid_cauldron = tmp; |
| | continue; |
| | } |
| | unpaid_item = NULL; |
| | for (item = tmp->inv; item; item = item->below) { |
| | if (QUERY_FLAG(item, FLAG_UNPAID)) { |
| | unpaid_item = item; |
| | break; |
| | } |
| | } |
| | if ( unpaid_item != NULL ) |
| | continue; |
| | |
| | attempt_do_alchemy(op, tmp); |
| | if (QUERY_FLAG(tmp, FLAG_APPLIED)) |
| | esrv_send_inventory(op, tmp); |
| | did_alchemy = 1; |
| | } |
| | } |
| | if ( unpaid_cauldron ) |
| | new_draw_info_format(NDI_UNIQUE,0,op,"You must pay for your %s first!", query_base_name(unpaid_cauldron,0)); |
| | else if ( unpaid_item ) |
| | new_draw_info_format(NDI_UNIQUE,0,op,"You must pay for your %s first!", query_base_name(unpaid_item,0)); |
| | |
| | return did_alchemy; |
| | } |