version 1.61 | | version 1.62 |
---|
| | |
/* | | /* |
* static char *rcsid_living_c = | | * static char *rcsid_living_c = |
* "$Id: living.c,v 1.61 2004/03/26 21:59:26 ryo_saeba Exp $"; | | * "$Id: living.c,v 1.62 2004/04/06 07:05:06 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
| | |
if(op->type==PLAYER) { | | if(op->type==PLAYER) { |
if (tmp->type==POTION) { | | if (tmp->type==POTION) { |
| | potion_max=1; |
for(j=0;j<NUM_STATS;j++) { | | for(j=0;j<NUM_STATS;j++) { |
i = get_attr_value(&(op->contr->orig_stats),j); | | int nstat, ostat; |
| | |
| | ostat = get_attr_value(&(op->contr->orig_stats),j); |
| | i = get_attr_value(&(tmp->stats),j); |
| | |
| | /* nstat is what the stat will be after use of the potion */ |
| | nstat = flag*i + ostat; |
| | |
/* Check to see if stats are within limits such that this can be | | /* Do some bounds checking. While I don't think any |
* applied. | | * potions do so right now, there is the potential for potions |
| | * that adjust that stat by more than one point, so we need |
| | * to allow for that. |
*/ | | */ |
if (((i+flag*get_attr_value(&(tmp->stats),j))<= | | if (nstat < 1 && i*flag < 0 ) nstat = 1; |
(20+tmp->stats.sp + get_attr_value(&(op->arch->clone.stats),j))) | | else if (nstat > 20 + get_attr_value(&(op->arch->clone.stats),j)) { |
&& i>0) | | nstat = 20 + get_attr_value(&(op->arch->clone.stats),j); |
{ | | |
change_attr_value(&(op->contr->orig_stats),j, | | |
flag*get_attr_value(&(tmp->stats),j)); | | |
tmp->stats.sp=0;/* Fix it up for super potions */ | | |
} | | } |
else { | | if (nstat != ostat) { |
| | set_attr_value(&(op->contr->orig_stats), j, nstat); |
| | potion_max=0; |
| | } |
| | else if (i) { |
/* potion is useless - player has already hit the natural maximum */ | | /* potion is useless - player has already hit the natural maximum */ |
potion_max = 1; | | potion_max = 1; |
} | | } |