version 1.66 | | version 1.67 |
---|
| | |
/* | | /* |
* static char *rcsid_player_c = | | * static char *rcsid_player_c = |
* "$Id: player.c,v 1.66 2001/08/29 07:14:16 mwedel Exp $"; | | * "$Id: player.c,v 1.67 2001/09/26 21:34:08 garbled Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
CLEAR_FLAG(op, FLAG_SCARED); | | CLEAR_FLAG(op, FLAG_SCARED); |
return; | | return; |
} | | } |
if(!(RANDOM()%5)&&RANDOM()%20+1>=savethrow[op->level]) { | | if(!(random_roll(0, 4, op, PREFER_LOW)) && |
| | random_roll(1, 20, op, PREFER_HIGH) >= savethrow[op->level]) { |
op->enemy=NULL; | | op->enemy=NULL; |
CLEAR_FLAG(op, FLAG_SCARED); | | CLEAR_FLAG(op, FLAG_SCARED); |
return; | | return; |
| | |
op->stats.food--; | | op->stats.food--; |
if(op->contr->digestion<0) | | if(op->contr->digestion<0) |
op->stats.food+=op->contr->digestion; | | op->stats.food+=op->contr->digestion; |
else if(op->contr->digestion>0&&RANDOM()%(1+op->contr->digestion)) | | else if(op->contr->digestion>0 && |
| | random_roll(0, op->contr->digestion, op, PREFER_HIGH)) |
op->stats.food=last_food; | | op->stats.food=last_food; |
} | | } |
if (max_sp>1) { | | if (max_sp>1) { |
| | |
if (over_sp > 0) { | | if (over_sp > 0) { |
if(op->stats.sp<op->stats.maxsp) { | | if(op->stats.sp<op->stats.maxsp) { |
op->stats.sp += over_sp>max_sp ? max_sp : over_sp; | | op->stats.sp += over_sp>max_sp ? max_sp : over_sp; |
if(RANDOM()%rate_sp > ((gen_sp+10)%rate_sp)) | | if(random_roll(0, rate_sp-1, op, PREFER_LOW) > ((gen_sp+10)%rate_sp)) |
op->stats.sp--; | | op->stats.sp--; |
if(op->stats.sp>op->stats.maxsp) | | if(op->stats.sp>op->stats.maxsp) |
op->stats.sp=op->stats.maxsp; | | op->stats.sp=op->stats.maxsp; |
| | |
over_grace = (gen_grace<20 ? 30 : gen_grace+10)/rate_grace; | | over_grace = (gen_grace<20 ? 30 : gen_grace+10)/rate_grace; |
if (over_grace > 0) { | | if (over_grace > 0) { |
op->stats.sp += over_grace | | op->stats.sp += over_grace |
+ (RANDOM()%rate_grace > ((gen_grace<20 ? 30 : gen_grace+10)%rate_grace))? -1 : 0; | | + (random_roll(0, rate_grace-1, op, PREFER_HIGH) > ((gen_grace<20 ? 30 : gen_grace+10)%rate_grace))? -1 : 0; |
op->last_grace=0; | | op->last_grace=0; |
} else { | | } else { |
op->last_grace=rate_grace/(gen_grace<20 ? 30 : gen_grace+10); | | op->last_grace=rate_grace/(gen_grace<20 ? 30 : gen_grace+10); |
| | |
op->stats.food--; | | op->stats.food--; |
if(op->contr->digestion<0) | | if(op->contr->digestion<0) |
op->stats.food+=op->contr->digestion; | | op->stats.food+=op->contr->digestion; |
else if(op->contr->digestion>0&&RANDOM()%(1+op->contr->digestion)) | | else if(op->contr->digestion>0 && |
| | random_roll(0, op->contr->digestion, op, PREFER_HIGH)) |
op->stats.food=last_food; | | op->stats.food=last_food; |
} | | } |
if(max_hp>1) { | | if(max_hp>1) { |
| | |
lose_this_stat = 0; | | lose_this_stat = 0; |
/* Take loss chance vs keep chance to see if we retain the stat. */ | | /* Take loss chance vs keep chance to see if we retain the stat. */ |
} else { | | } else { |
if ((RANDOM() % (loss_chance + keep_chance)) < keep_chance) | | if (random_roll(0, loss_chance + keep_chance-1, op, PREFER_LOW) < keep_chance) |
lose_this_stat = 0; | | lose_this_stat = 0; |
/* LOG(llevDebug, "Determining stat loss. Stat: %d Keep: %d Lose: %d Result: %s.\n", | | /* LOG(llevDebug, "Determining stat loss. Stat: %d Keep: %d Lose: %d Result: %s.\n", |
this_stat, keep_chance, loss_chance, | | this_stat, keep_chance, loss_chance, |
| | |
*/ | | */ |
| | |
void do_hidden_move (object *op) { | | void do_hidden_move (object *op) { |
int hide=0, num=RANDOM()%20; | | int hide=0, num=random_roll(0, 19, op, PREFER_LOW); |
| | |
if(!op || !op->map) return; | | if(!op || !op->map) return; |
| | |