version 1.80 | | version 1.81 |
---|
| | |
/* | | /* |
* static char *rcsid_apply_c = | | * static char *rcsid_apply_c = |
* "$Id: apply.c,v 1.80 2003/03/08 05:35:32 mwedel Exp $"; | | * "$Id: apply.c,v 1.81 2003/03/20 07:57:56 mwedel Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
return count; | | return count; |
} | | } |
| | |
void eat_item(object *op,char *item) | | /* This object removes 'nrof' of what item->slaying says to |
| | * remove. op is typically the player, which is only |
| | * really used to determine what space to look at. |
| | * Modified to only eat 'nrof' of objects. |
| | */ |
| | static void eat_item(object *op,char *item, int nrof) |
{ | | { |
object *prev; | | object *prev; |
| | |
| | |
| | |
while(op!=NULL) { | | while(op!=NULL) { |
if (strcmp(op->arch->name,item)==0) { | | if (strcmp(op->arch->name,item)==0) { |
| | if (op->nrof >= nrof) { |
| | decrease_ob_nr(op,nrof); |
| | return; |
| | } else { |
decrease_ob_nr(op,op->nrof); | | decrease_ob_nr(op,op->nrof); |
| | nrof -= op->nrof; |
| | } |
op=prev; | | op=prev; |
} | | } |
prev = op; | | prev = op; |
| | |
sacrifice_count=check_sacrifice(op,improver); | | sacrifice_count=check_sacrifice(op,improver); |
if (sacrifice_count<=0) | | if (sacrifice_count<=0) |
return 0; | | return 0; |
sacrifice_count = isqrt(sacrifice_count); | | weapon->level=isqrt(sacrifice_count); |
weapon->level=sacrifice_count; | | |
new_draw_info(NDI_UNIQUE,0,op,"Your sacrifice was accepted."); | | new_draw_info(NDI_UNIQUE,0,op,"Your sacrifice was accepted."); |
eat_item(op, improver->slaying); | | eat_item(op, improver->slaying, sacrifice_count); |
| | |
new_draw_info_format(NDI_UNIQUE, 0, op,"Your *%s may be improved %d times.", | | new_draw_info_format(NDI_UNIQUE, 0, op,"Your *%s may be improved %d times.", |
weapon->name,sacrifice_count); | | weapon->name,weapon->level); |
| | |
sprintf(buf,"%s's %s",op->name,weapon->name); | | sprintf(buf,"%s's %s",op->name,weapon->name); |
free_string(weapon->name); | | free_string(weapon->name); |
| | |
"You need at least %d %s", sacrifice_needed, improver->slaying); | | "You need at least %d %s", sacrifice_needed, improver->slaying); |
return 0; | | return 0; |
} | | } |
eat_item(op,improver->slaying); | | eat_item(op,improver->slaying, sacrifice_needed); |
weapon->item_power++; | | weapon->item_power++; |
| | |
switch (improver->stats.sp) { | | switch (improver->stats.sp) { |