version 1.38 | | version 1.39 |
---|
| | |
/* | | /* |
* static char *rcsid_rune_c = | | * static char *rcsid_rune_c = |
* "$Id: rune.c,v 1.38 2004/06/18 07:45:29 mwedel Exp $"; | | * "$Id: rune.c,v 1.39 2004/09/14 19:59:08 akirschbaum Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
rune->direction : direction it will cast a spell in | | rune->direction : direction it will cast a spell in |
rune->dam : damage the rune will do if it doesn't cast spells | | rune->dam : damage the rune will do if it doesn't cast spells |
rune->attacktype: type of damage it does, if not casting spells | | rune->attacktype: type of damage it does, if not casting spells |
rune->slaying : string description of the spell in the rune | | rune->other_arch: spell in the rune |
| | rune->Cha : how hidden the rune is |
| | rune->maxhp : number of spells the rune casts |
*/ | | */ |
| | |
void move_rune(object *op) { | | void move_rune(object *op) { |
| | |
object *env; | | object *env; |
tag_t trap_tag = trap->count; | | tag_t trap_tag = trap->count; |
rv_vector rv; | | rv_vector rv; |
| | int i; |
| | |
/* Prevent recursion */ | | /* Prevent recursion */ |
if (trap->stats.hp <= 0) | | if (trap->stats.hp <= 0) |
| | |
if (was_destroyed (trap, trap_tag)) | | if (was_destroyed (trap, trap_tag)) |
return; | | return; |
| | |
| | for(i = 0; i < MAX(1, trap->stats.maxhp); i++) { |
if (trap->inv) | | if (trap->inv) |
cast_spell(trap,trap,trap->direction,trap->inv,NULL); | | cast_spell(trap,trap,trap->direction,trap->inv,NULL); |
else { | | else { |
| | |
cast_spell(trap,trap,trap->direction,spell,NULL); | | cast_spell(trap,trap,trap->direction,spell,NULL); |
free_object(spell); | | free_object(spell); |
} | | } |
| | } |
} else { | | } else { |
rune_attack(trap,victim); | | rune_attack(trap,victim); |
if (was_destroyed (trap, trap_tag)) | | if (was_destroyed (trap, trap_tag)) |
| | |
* a peak probability at difficulty | | * a peak probability at difficulty |
*/ | | */ |
| | |
trap->level = MAX(1, rndm(0, difficulty-1) + rndm(0, difficulty-1)); | | trap->level = rndm(0, difficulty-1) + rndm(0, difficulty-1); |
| | if(trap->level < 1) |
| | trap->level = 1; |
| | |
/* set the hiddenness of the trap, similar formula to above */ | | /* set the hiddenness of the trap, similar formula to above */ |
trap->stats.Cha = rndm(0, 19) + rndm(0, difficulty-1) + rndm(0, difficulty-1); | | trap->stats.Cha = rndm(0, 19) + rndm(0, difficulty-1) + rndm(0, difficulty-1); |
| | |
trap->stats.dam+=rndm(0, 4); | | trap->stats.dam+=rndm(0, 4); |
| | |
/* the poison trap special case */ | | /* the poison trap special case */ |
if(trap->attacktype & AT_POISON) | | if(trap->attacktype & AT_POISON) { |
trap->stats.dam = MAX(1, rndm(0, difficulty-1)); | | trap->stats.dam = rndm(0, difficulty-1); |
| | if(trap->stats.dam < 1) |
| | trap->stats.dam = 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; |