version 1.20 | | version 1.21 |
---|
| | |
/* | | /* |
* static char *rcsid_rune_c = | | * static char *rcsid_rune_c = |
* "$Id: rune.c,v 1.20 2001/09/26 21:34:08 garbled Exp $"; | | * "$Id: rune.c,v 1.21 2001/10/15 21:12:08 garbled Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
int det=0; | | int det=0; |
if(!op->level) {return;} /* runes of level zero cannot detonate. */ | | if(!op->level) {return;} /* runes of level zero cannot detonate. */ |
det=op->invisible; | | det=op->invisible; |
if(!(RANDOM()%(MAX(1,(op->stats.Cha))))) | | if(!(rndm(0, MAX(1,(op->stats.Cha))-1))) |
{ | | { |
op->invisible=0; | | op->invisible=0; |
op->speed_left-=1; | | op->speed_left-=1; |
| | |
/* the formula below will give a level from 1 to (2*difficulty) with */ | | /* the formula below will give a level from 1 to (2*difficulty) with */ |
/* a peak probability at difficulty */ | | /* a peak probability at difficulty */ |
| | |
trap->level = MAX(1,RANDOM()%difficulty + RANDOM()%difficulty); | | trap->level = MAX(1, rndm(0, difficulty-1) + rndm(0, difficulty-1)); |
| | |
/* set the hiddenness of the trap, similar formula to above */ | | /* set the hiddenness of the trap, similar formula to above */ |
trap->stats.Cha = RANDOM()%20 + RANDOM()%difficulty + RANDOM()%difficulty; | | trap->stats.Cha = rndm(0, 19) + rndm(0, difficulty-1) + rndm(0, difficulty-1); |
| | |
/* set the damage of the trap if it's not a spellcasting trap | | /* set the damage of the trap if it's not a spellcasting trap |
we get 0-4 pts of damage per level of difficulty of the map in | | we get 0-4 pts of damage per level of difficulty of the map in |
| | |
| | |
if(trap->stats.sp == 0) { | | if(trap->stats.sp == 0) { |
trap->stats.dam = 0; | | trap->stats.dam = 0; |
for(i=0;i<difficulty;i++) trap->stats.dam+=RANDOM()%5; | | for(i=0;i<difficulty;i++) trap->stats.dam+=rndm(0, 4); |
} | | } |
| | |
| | |
/* the poison trap special case */ | | /* the poison trap special case */ |
if(trap->attacktype & AT_POISON) trap->stats.dam = MAX(1,RANDOM()%difficulty); | | if(trap->attacktype & AT_POISON) |
| | trap->stats.dam = MAX(1, rndm(0, difficulty-1)); |
| | |
/* so we get an appropriate amnt of exp for AT_DEATH traps */ | | /* so we get an appropriate amnt of exp for AT_DEATH traps */ |
if(trap->attacktype & AT_DEATH) trap->stats.dam = 127; | | if(trap->attacktype & AT_DEATH) trap->stats.dam = 127; |