version 1.57 | | version 1.58 |
---|
| | |
/* | | /* |
* static char *rcsid_spell_util_c = | | * static char *rcsid_spell_util_c = |
* "$Id: spell_util.c,v 1.57 2001/08/21 05:39:31 mwedel Exp $"; | | * "$Id: spell_util.c,v 1.58 2001/09/26 21:34:08 garbled Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
*Instead of subtracting 10 from the roll, add in grace (which is | | *Instead of subtracting 10 from the roll, add in grace (which is |
* negative). This puts a real limit on things. | | * negative). This puts a real limit on things. |
*/ | | */ |
if( (RANDOM()%op->stats.Wis) +op->stats.grace - | | if(random_roll(0, op->stats.Wis-1, op, PREFER_HIGH) + op->stats.grace - |
10*SP_level_spellpoint_cost(op,caster,type)/op->stats.maxgrace >0) { | | 10*SP_level_spellpoint_cost(op,caster,type)/op->stats.maxgrace >0) { |
new_draw_info_format(NDI_UNIQUE, 0,op, | | new_draw_info_format(NDI_UNIQUE, 0,op, |
"%s grants your prayer, though you are unworthy.",godname); | | "%s grants your prayer, though you are unworthy.",godname); |
| | |
return 0; | | return 0; |
} | | } |
if(item == spellNormal && op->type==PLAYER&&s->cleric&& | | if(item == spellNormal && op->type==PLAYER&&s->cleric&& |
/* RANDOM()%100< s->level*2 - op->level + cleric_chance[op->stats.Wis]- | | random_roll(0, 99, op, PREFER_HIGH) < s->level/(float)MAX(1,op->level) * |
op->stats.luck*3) {*/ | | cleric_chance[op->stats.Wis]) { |
RANDOM()%100 < s->level/(float)MAX(1,op->level) * cleric_chance[op->stats.Wis]- | | |
op->stats.luck*3) { | | |
play_sound_player_only(op->contr, SOUND_FUMBLE_SPELL,0,0); | | play_sound_player_only(op->contr, SOUND_FUMBLE_SPELL,0,0); |
new_draw_info(NDI_UNIQUE, 0,op,"You fumble the spell."); | | new_draw_info(NDI_UNIQUE, 0,op,"You fumble the spell."); |
#ifdef CASTING_TIME | | #ifdef CASTING_TIME |
| | |
#endif | | #endif |
if(s->sp==0) /* Shouldn't happen... */ | | if(s->sp==0) /* Shouldn't happen... */ |
return 0; | | return 0; |
return RANDOM()%(SP_level_spellpoint_cost(op,caster,type)+1)+1; | | return(random_roll(1, SP_level_spellpoint_cost(op,caster,type), op, |
| | PREFER_LOW)); |
} | | } |
#ifdef SPELL_ENCUMBRANCE | | #ifdef SPELL_ENCUMBRANCE |
if(item == spellNormal && op->type==PLAYER && (!s->cleric) ) { | | if(item == spellNormal && op->type==PLAYER && (!s->cleric) ) { |
int failure = (RANDOM()%200) - op->contr->encumbrance +op->level -s->level +35; | | int failure = random_roll(0, 199, op, PREFER_LOW) - |
| | op->contr->encumbrance +op->level -s->level +35; |
| | |
if( failure < 0) { | | if( failure < 0) { |
new_draw_info(NDI_UNIQUE, 0,op,"You bungle the spell because you have too much heavy equipment in use."); | | new_draw_info(NDI_UNIQUE, 0,op,"You bungle the spell because you have too much heavy equipment in use."); |
#ifdef SPELL_FAILURE_EFFECTS | | #ifdef SPELL_FAILURE_EFFECTS |
spell_failure(op,failure,SP_level_spellpoint_cost(op,caster,type)); | | spell_failure(op,failure,SP_level_spellpoint_cost(op,caster,type)); |
#endif | | #endif |
return RANDOM()%(SP_level_spellpoint_cost(op,caster,type)+ 1); | | return(random_roll(0, SP_level_spellpoint_cost(op,caster,type), op, PREFER_LOW)); |
} | | } |
} | | } |
#endif /*SPELL_ENCUMBRANCE*/ | | #endif /*SPELL_ENCUMBRANCE*/ |
| | |
success = fire_arch(op,caster,dir,spellarch[type],type,!ability); | | success = fire_arch(op,caster,dir,spellarch[type],type,!ability); |
break; | | break; |
case SP_METEOR_SWARM: { | | case SP_METEOR_SWARM: { |
int n; | | |
n=RANDOM()%3 + RANDOM()%3 + RANDOM()%3 +3 + | | |
SP_level_strength_adjust(op,caster, type); | | |
success = 1; | | success = 1; |
fire_swarm(op,caster,dir,spellarch[type],SP_METEOR,n,0); | | fire_swarm(op, caster, dir, spellarch[type], SP_METEOR, |
| | die_roll(3, 3, op, PREFER_HIGH) + |
| | SP_level_strength_adjust(op,caster, type), 0); |
break; | | break; |
} | | } |
case SP_BULLET_SWARM: { | | case SP_BULLET_SWARM: { |
int n; | | |
n=RANDOM()%3 + RANDOM()%3 + RANDOM()%3 +3 + | | |
SP_level_strength_adjust(op,caster, type); | | |
success = 1; | | success = 1; |
fire_swarm(op,caster,dir,spellarch[type],SP_BULLET,n,1); | | fire_swarm(op, caster, dir, spellarch[type], SP_BULLET, |
| | die_roll(3, 3, op, PREFER_HIGH) + |
| | SP_level_strength_adjust(op,caster, type), 0); |
break; | | break; |
} | | } |
case SP_BULLET_STORM: { | | case SP_BULLET_STORM: { |
int n; | | |
n=RANDOM()%3 + RANDOM()%3 + RANDOM()%3 +3 + | | |
SP_level_strength_adjust(op,caster, type); | | |
success = 1; | | success = 1; |
fire_swarm(op,caster,dir,spellarch[type],SP_LARGE_BULLET,n,1); | | fire_swarm(op, caster, dir, spellarch[type], SP_LARGE_BULLET, |
| | die_roll(3, 3, op, PREFER_HIGH) + |
| | SP_level_strength_adjust(op,caster, type), 0); |
break; | | break; |
} | | } |
case SP_CAUSE_MANY: { | | case SP_CAUSE_MANY: { |
int n; | | |
n=RANDOM()%3 + RANDOM()%3 + RANDOM()%3 +3 + | | |
SP_level_strength_adjust(op,caster, type); | | |
success = 1; | | success = 1; |
fire_swarm(op,caster,dir,spellarch[type],SP_CAUSE_HEAVY,n,1); | | fire_swarm(op, caster, dir, spellarch[type], SP_CAUSE_HEAVY, |
| | die_roll(3, 3, op, PREFER_HIGH) + |
| | SP_level_strength_adjust(op,caster, type), 0); |
break; | | break; |
} | | } |
case SP_METEOR: | | case SP_METEOR: |