version 1.13 | | version 1.14 |
---|
| | |
/* | | /* |
* static char *rcsid_living_c = | | * static char *rcsid_living_c = |
* "$Id: living.c,v 1.13 2000/10/21 20:12:52 peterm Exp $"; | | * "$Id: living.c,v 1.14 2000/12/04 00:40:03 cvs Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
| | |
#define ORIG_S(xyz,abc) (op->contr->orig_stats.abc) | | #define ORIG_S(xyz,abc) (op->contr->orig_stats.abc) |
| | |
/* | | |
* Adds abilities to the first object based on what the second object | | |
* gives to appliers. If the second object does not have the APPLIED | | |
* flag set, it is assumed that it is being unapplied, and any abilities | | |
* it gives are subtracted from the first object. | | |
* (This is of course a problem now, since several objects may give | | |
* the same abilities, thus change_abil() is used mostly to display | | |
* messages, while fix_player() is called afterwards.) | | |
* Also writes a more or less informative message to the first object | | |
* about what abilities were gained/lost. | | |
*/ | | |
| | |
/* if immunity has changed then display that. If not immune then show change | | |
* in resistance if resistance has changed or if immunity has changed and if | | |
* resistant then say resistant after saying no longer immune. | | |
*/ | | |
#define CHANGE_ABIL_IMMUNE_MACRO(AT,im1,im2,re1,re2) \ | | |
if ( (op->immune & (AT) ) != (refop.immune & (AT))) { \ | | |
success = 1; \ | | |
if(flag>0) \ | | |
(*draw_info_func)(NDI_UNIQUE, 0, op, im1 ); \ | | |
else { \ | | |
(*draw_info_func)(NDI_UNIQUE, 0, op, im2 ); \ | | |
if (refop.protected& (AT)) (*draw_info_func)(NDI_UNIQUE, 0, op, re1 ); \ | | |
}\ | | |
} else if ( ( ! (op->immune & (AT) )) \ | | |
&& ((op->protected& (AT) ) != (refop.protected& (AT) ))) {\ | | |
success=1; \ | | |
if(flag>0) \ | | |
(*draw_info_func)(NDI_UNIQUE, 0, op, re1 ); \ | | |
else \ | | |
(*draw_info_func)(NDI_UNIQUE, 0, op, re2 ); \ | | |
} \ | | |
| | |
/* return 1 if we sucessfully changed a stat, 0 if nothing was changed. */ | | /* return 1 if we sucessfully changed a stat, 0 if nothing was changed. */ |
/* flag is set to 1 if we are applying the object, -1 if we are removing | | /* flag is set to 1 if we are applying the object, -1 if we are removing |
* the object. | | * the object. |
| | |
else | | else |
(*draw_info_func)(NDI_UNIQUE, 0, op,"You feel your digestion speeding up."); | | (*draw_info_func)(NDI_UNIQUE, 0, op,"You feel your digestion speeding up."); |
} | | } |
CHANGE_ABIL_IMMUNE_MACRO(AT_PHYSICAL, "You feel much less solid.", | | for (i=0; i <NROFATTACKS; i++) { |
"You suddenly feel very solid.", "You feel less solid.", | | if (i==ATNR_PHYSICAL) continue; /* Don't display those messages */ |
"You feel more solid."); | | if (op->resist[i] != refop.resist[i]) { |
| | |
CHANGE_ABIL_IMMUNE_MACRO(AT_MAGIC, "You feel immune to magic.", | | |
"You feel less immune to magic.", "You feel more resistant to magic.", | | |
"You feel less resistant to magic."); | | |
| | |
CHANGE_ABIL_IMMUNE_MACRO(AT_FIRE, "You feel immune to fire.", | | |
"You feel less immune to fire.", "You feel resistant to fire.", | | |
"You feel less resistant to fire."); | | |
| | |
if (( op->vulnerable&AT_FIRE) != (refop.vulnerable&AT_FIRE)) { | | |
success=1; | | |
if(flag>0) | | |
(*draw_info_func)(NDI_UNIQUE, 0, op,"You feel exposed to fire."); | | |
else | | |
(*draw_info_func)(NDI_UNIQUE, 0, op,"You feel less exposed to fire."); | | |
} | | |
CHANGE_ABIL_IMMUNE_MACRO(AT_COLD, "You feel immune to cold.", | | |
"You feel less immune to cold.", "You feel resistant to cold.", | | |
"You feel less resistant to cold."); | | |
| | |
if (( op->vulnerable&AT_COLD) != (refop.vulnerable&AT_COLD)) { | | |
success=1; | | success=1; |
if(flag>0) | | if (op->resist[i]==100) { /* Now immune */ |
(*draw_info_func)(NDI_UNIQUE, 0, op,"You feel exposed to cold."); | | (*draw_info_func)(NDI_UNIQUE|NDI_BLUE, 0, op, |
else | | resist_change[i][0]); |
(*draw_info_func)(NDI_UNIQUE, 0, op,"You feel less exposed to cold."); | | } else if (refop.resist[i]==100) { /* was immune */ |
} | | (*draw_info_func)(NDI_UNIQUE|NDI_BLUE, 0, op, |
CHANGE_ABIL_IMMUNE_MACRO(AT_ELECTRICITY, "You feel immune to electricity.", | | resist_change[i][1]); |
"You feel less immune to electricity.", "You feel more resistant to electricity.", | | } else if (op->resist[i] > refop.resist[i]) { /* more resistant */ |
"You feel less resistant to electricity."); | | (*draw_info_func)(NDI_UNIQUE|NDI_BLUE, 0, op, |
| | resist_change[i][2]); |
CHANGE_ABIL_IMMUNE_MACRO(AT_ACID, "You feel immune to acid.", | | |
"You feel less immune to acid.", "You feel more resistant to acid.", | | |
"You feel less resistant to acid."); | | |
| | |
CHANGE_ABIL_IMMUNE_MACRO(AT_DRAIN, "You feel very full of life.", | | } else { /* now less resistant - only thing left */ |
"You shiver, everything seems so bleak.", "You feel more resistant to draining.", | | (*draw_info_func)(NDI_UNIQUE|NDI_BLUE, 0, op, |
"You feel less resistant to draining."); | | resist_change[i][3]); |
| | |
CHANGE_ABIL_IMMUNE_MACRO(AT_POISON, "You feel extremely healthy.", | | } |
"You feel extremely less healthy!", "You feel more resistant to poison.", | | } |
"You feel less resistant to poison."); | | } |
| | |
CHANGE_ABIL_IMMUNE_MACRO(AT_SLOW, "You feel in sync with time.", | | |
"You feel out of sync with time.", "You feel more in sync with time.", | | |
"You feel less in sync with time."); | | |
| | |
CHANGE_ABIL_IMMUNE_MACRO(AT_PARALYZE, "You feel very unrestrained.", | | |
"You feel more restrained.", "You feel more resistant to paralyzation.", | | |
"You feel less resistant to paralyzation."); | | |
| | |
CHANGE_ABIL_IMMUNE_MACRO(AT_FEAR, "You feel extremely brave.", | | |
"You feel less brave.", "You feel more resistant to fear.", | | |
"You feel less resistant to fear."); | | |
| | |
CHANGE_ABIL_IMMUNE_MACRO(AT_CONFUSION, "You feel more sure of yourself.", | | |
"You feel less sure of yourself.", "You feel more resistant to confusion.", | | |
"You feel less resistant to confusion."); | | |
| | |
if(tmp->type!=EXPERIENCE) | | if(tmp->type!=EXPERIENCE) { |
for (j=0; j<7; j++) { | | for (j=0; j<7; j++) { |
if ((i=get_attr_value(&(tmp->stats),j))!=0) { | | if ((i=get_attr_value(&(tmp->stats),j))!=0) { |
success=1; | | success=1; |
| | |
(*draw_info_func)(NDI_UNIQUE, 0, op, lose_msg[j]); | | (*draw_info_func)(NDI_UNIQUE, 0, op, lose_msg[j]); |
} | | } |
} | | } |
| | } |
return success; | | return success; |
} | | } |
| | |
| | |
op->path_repelled=op->arch->clone.path_repelled; | | op->path_repelled=op->arch->clone.path_repelled; |
op->path_denied=op->arch->clone.path_denied; | | op->path_denied=op->arch->clone.path_denied; |
| | |
op->protected=op->arch->clone.protected; | | memcpy(&op->resist, &op->arch->clone.resist, sizeof(op->resist)); |
op->vulnerable=op->arch->clone.vulnerable; | | |
op->immune=op->arch->clone.immune; | | |
op->armour=op->arch->clone.armour; | | |
wc=op->arch->clone.stats.wc; | | wc=op->arch->clone.stats.wc; |
op->stats.dam=op->arch->clone.stats.dam; | | op->stats.dam=op->arch->clone.stats.dam; |
| | |
| | |
if(speed_reduce_from_disease ==0) speed_reduce_from_disease = 1; | | if(speed_reduce_from_disease ==0) speed_reduce_from_disease = 1; |
} | | } |
| | |
op->protected|=tmp->protected; | | for (i=0; i<NROFATTACKS; i++) |
op->vulnerable|=tmp->vulnerable; | | if (tmp->resist[i]) |
| | op->resist[i] += ((100-op->resist[i])*tmp->resist[i])/100; |
| | |
if (tmp->type!=BOW) { | | if (tmp->type!=BOW) { |
if(tmp->type != SYMPTOM) | | if(tmp->type != SYMPTOM) |
op->attacktype|=tmp->attacktype; | | op->attacktype|=tmp->attacktype; |
/* if (tmp->attacktype) LOG(llevDebug,"Object %s applied, attacktype=0x%x\n", tmp->name, tmp->attacktype);*/ | | /* if (tmp->attacktype) LOG(llevDebug,"Object %s applied, attacktype=0x%x\n", tmp->name, tmp->attacktype);*/ |
} | | } |
op->immune|=tmp->immune; | | |
op->path_attuned|=tmp->path_attuned; | | op->path_attuned|=tmp->path_attuned; |
op->path_repelled|=tmp->path_repelled; | | op->path_repelled|=tmp->path_repelled; |
op->path_denied|=tmp->path_denied; | | op->path_denied|=tmp->path_denied; |
| | |
if(tmp->stats.wc) | | if(tmp->stats.wc) |
wc-=(tmp->stats.wc+tmp->magic); | | wc-=(tmp->stats.wc+tmp->magic); |
| | |
if(tmp->armour) | | |
op->armour+=((100-op->armour)*tmp->armour)/100; | | |
| | |
if(tmp->slaying!=NULL) { | | if(tmp->slaying!=NULL) { |
if (op->slaying != NULL) | | if (op->slaying != NULL) |
| | |
case BOOTS: | | case BOOTS: |
case GLOVES: | | case GLOVES: |
case CLOAK: | | case CLOAK: |
if(tmp->armour) | | |
op->armour+=((100-op->armour)*tmp->armour)/100; | | |
if(tmp->stats.wc) | | if(tmp->stats.wc) |
wc-=(tmp->stats.wc+tmp->magic); | | wc-=(tmp->stats.wc+tmp->magic); |
if(tmp->stats.dam) | | if(tmp->stats.dam) |
| | |
if(tmp->stats.ac) | | if(tmp->stats.ac) |
op->stats.ac-=(tmp->stats.ac+tmp->magic); | | op->stats.ac-=(tmp->stats.ac+tmp->magic); |
break; | | break; |
| | |
case WEAPON: | | case WEAPON: |
wc-=(tmp->stats.wc+tmp->magic); | | wc-=(tmp->stats.wc+tmp->magic); |
if(tmp->stats.ac&&tmp->stats.ac+tmp->magic>0) | | if(tmp->stats.ac&&tmp->stats.ac+tmp->magic>0) |
op->stats.ac-=tmp->stats.ac+tmp->magic; | | op->stats.ac-=tmp->stats.ac+tmp->magic; |
if(tmp->armour) | | |
op->armour+=((100-op->armour)*tmp->armour)/100; | | |
op->stats.dam+=(tmp->stats.dam+tmp->magic); | | op->stats.dam+=(tmp->stats.dam+tmp->magic); |
weapon_weight=tmp->weight; | | weapon_weight=tmp->weight; |
weapon_speed=((int)WEAPON_SPEED(tmp)*2-tmp->magic)/2; | | weapon_speed=((int)WEAPON_SPEED(tmp)*2-tmp->magic)/2; |
| | |
#endif | | #endif |
case BRACERS: | | case BRACERS: |
case FORCE: | | case FORCE: |
if(tmp->armour) | | |
op->armour+=((100-op->armour)*tmp->armour)/100; | | |
if(tmp->stats.wc) { | | if(tmp->stats.wc) { |
if(best_wc<tmp->stats.wc+tmp->magic) { | | if(best_wc<tmp->stats.wc+tmp->magic) { |
wc+=best_wc; | | wc+=best_wc; |