version 1.63 | | version 1.64 |
---|
| | |
/* | | /* |
* static char *rcsid_spell_util_c = | | * static char *rcsid_spell_util_c = |
* "$Id: spell_util.c,v 1.63 2001/12/23 08:09:05 darth_bob Exp $"; | | * "$Id: spell_util.c,v 1.64 2002/07/15 04:57:13 mwedel Exp $"; |
*/ | | */ |
| | |
| | |
| | |
#endif | | #endif |
#include <sounds.h> | | #include <sounds.h> |
| | |
char *range_name[range_size] = { | | |
"none", "bow", "magic", "wand", "rod", "scroll", "horn" | | |
,"steal" | | |
}; | | |
| | |
archetype *spellarch[NROFREALSPELLS]; | | archetype *spellarch[NROFREALSPELLS]; |
| | |
void init_spells() { | | void init_spells() { |
| | |
if(!spells[type].cleric&& op->stats.sp<SP_level_spellpoint_cost(op,caster,type)) | | if(!spells[type].cleric&& op->stats.sp<SP_level_spellpoint_cost(op,caster,type)) |
{ | | { |
new_draw_info(NDI_UNIQUE, 0,op,"You don't have enough mana."); | | new_draw_info(NDI_UNIQUE, 0,op,"You don't have enough mana."); |
op->contr->count_left=0; | | |
return 0; | | return 0; |
} | | } |
if(spells[type].cleric&&op->stats.grace<SP_level_spellpoint_cost(op,caster,type)) | | if(spells[type].cleric&&op->stats.grace<SP_level_spellpoint_cost(op,caster,type)) |
| | |
{ | | { |
prayer_failure(op,op->stats.grace,SP_level_spellpoint_cost(op,caster,type)); | | prayer_failure(op,op->stats.grace,SP_level_spellpoint_cost(op,caster,type)); |
new_draw_info_format(NDI_UNIQUE, 0,op,"%s ignores your prayer.",godname); | | new_draw_info_format(NDI_UNIQUE, 0,op,"%s ignores your prayer.",godname); |
op->contr->count_left=0; | | |
return 0; | | return 0; |
} | | } |
} | | } |
| | |
| | |
if (caster->path_denied & s->path) { | | if (caster->path_denied & s->path) { |
new_draw_info(NDI_UNIQUE, 0,op, "You are unable to cast that spell."); | | new_draw_info(NDI_UNIQUE, 0,op, "You are unable to cast that spell."); |
if(op->type==PLAYER) op->contr->count_left=0; | | |
return 0; | | return 0; |
} | | } |
/* If it is an ability, assume that the designer of the archetype knows | | /* If it is an ability, assume that the designer of the archetype knows |
| | |
*/ | | */ |
if (item==spellNormal && !ability && SK_level(caster) < s->level && !QUERY_FLAG(op,FLAG_WIZ)) { | | if (item==spellNormal && !ability && SK_level(caster) < s->level && !QUERY_FLAG(op,FLAG_WIZ)) { |
new_draw_info(NDI_UNIQUE, 0,op, "You lack enough skill to cast that spell."); | | new_draw_info(NDI_UNIQUE, 0,op, "You lack enough skill to cast that spell."); |
if(op->type==PLAYER) op->contr->count_left=0; | | |
return 0; | | return 0; |
} | | } |
| | |
| | |
case range_magic: | | case range_magic: |
new_draw_info(NDI_UNIQUE, 0,op,"Something blocks your spellcasting."); | | new_draw_info(NDI_UNIQUE, 0,op,"Something blocks your spellcasting."); |
break; | | break; |
case range_wand: | | case range_misc: |
new_draw_info(NDI_UNIQUE, 0,op,"Something blocks the magic of your wand."); | | new_draw_info(NDI_UNIQUE, 0,op,"Something blocks the magic of your item."); |
break; | | |
case range_rod: | | |
new_draw_info(NDI_UNIQUE, 0,op,"Something blocks the magic of your rod."); | | |
break; | | break; |
case range_horn: | | case range_golem: |
new_draw_info(NDI_UNIQUE, 0,op,"Something blocks the magic of your horn."); | | |
break; | | |
case range_scroll: | | |
new_draw_info(NDI_UNIQUE, 0,op,"Something blocks the magic of your scroll."); | | new_draw_info(NDI_UNIQUE, 0,op,"Something blocks the magic of your scroll."); |
break; | | break; |
default: | | default: |
| | |
dir=find_free_spot(NULL,op->map,op->x,op->y,1,9); | | dir=find_free_spot(NULL,op->map,op->x,op->y,1,9); |
if((dir==-1) || blocked(op->map,op->x+freearr_x[dir],op->y+freearr_y[dir])) { | | if((dir==-1) || blocked(op->map,op->x+freearr_x[dir],op->y+freearr_y[dir])) { |
new_draw_info(NDI_UNIQUE, 0,op,"There is something in the way."); | | new_draw_info(NDI_UNIQUE, 0,op,"There is something in the way."); |
if(op->type==PLAYER) | | |
op->contr->count_left=0; | | |
return 0; | | return 0; |
} | | } |
tmp=arch_to_object(at); | | tmp=arch_to_object(at); |
| | |
set_owner(tmp,op); | | set_owner(tmp,op); |
op->contr->golem=tmp; | | op->contr->golem=tmp; |
/* give the player control of the golem */ | | /* give the player control of the golem */ |
op->contr->shoottype=range_scroll; | | op->contr->shoottype=range_golem; |
} else { | | } else { |
if(QUERY_FLAG(op, FLAG_FRIENDLY)) { | | if(QUERY_FLAG(op, FLAG_FRIENDLY)) { |
object *owner = get_owner(op); | | object *owner = get_owner(op); |