version 1.100 | | version 1.101 |
---|
| | |
/* | | /* |
* static char *rcsid_spell_util_c = | | * static char *rcsid_spell_util_c = |
* "$Id: spell_util.c,v 1.100 2005/10/28 19:08:53 akirschbaum Exp $"; | | * "$Id: spell_util.c,v 1.101 2005/11/16 08:16:09 mwedel Exp $"; |
*/ | | */ |
| | |
| | |
| | |
*/ | | */ |
int cast_create_obj(object *op,object *caster,object *new_op, int dir) | | int cast_create_obj(object *op,object *caster,object *new_op, int dir) |
{ | | { |
| | mapstruct *m; |
| | sint16 sx, sy; |
| | |
if(dir && | | if(dir && |
(get_map_flags(op->map,NULL, op->x+freearr_x[dir],op->y+freearr_y[dir], NULL, NULL) & (P_BLOCKED | P_OUT_OF_MAP))) { | | ((get_map_flags(op->map, &m, op->x+freearr_x[dir],op->y+freearr_y[dir], &sx, &sy) & P_OUT_OF_MAP) || |
| | OB_TYPE_MOVE_BLOCK(op, GET_MAP_MOVE_BLOCK(m, sx, sy)))) { |
new_draw_info(NDI_UNIQUE, 0,op,"Something is in the way."); | | new_draw_info(NDI_UNIQUE, 0,op,"Something is in the way."); |
new_draw_info(NDI_UNIQUE, 0,op,"You cast it at your feet."); | | new_draw_info(NDI_UNIQUE, 0,op,"You cast it at your feet."); |
dir = 0; | | dir = 0; |
| | |
| | |
if (mflags & P_OUT_OF_MAP) return 0; | | if (mflags & P_OUT_OF_MAP) return 0; |
| | |
if(mflags & P_WALL) return 0; | | if (OB_TYPE_MOVE_BLOCK(op, GET_MAP_MOVE_BLOCK(mp, x, y))) return 0; |
| | |
for(tmp=get_map_ob(mp,x,y);tmp!=NULL;tmp=tmp->above) { | | for(tmp=get_map_ob(mp,x,y);tmp!=NULL;tmp=tmp->above) { |
/* If there is a counterspell on the space, and this | | /* If there is a counterspell on the space, and this |
| | |
if (mflags & P_OUT_OF_MAP) { | | if (mflags & P_OUT_OF_MAP) { |
return 0; | | return 0; |
} | | } |
if (mflags & P_NO_PASS) { | | |
new_draw_info(NDI_UNIQUE, 0, op, "You can't cast the spell on top of a wall!\n"); | | |
return 0; | | |
} | | |
| | |
tmp=arch_to_object(spell->other_arch); | | tmp=arch_to_object(spell->other_arch); |
| | |
if(tmp==NULL) | | if(tmp==NULL) |
return 0; | | return 0; |
| | |
| | if (OB_TYPE_MOVE_BLOCK(tmp, GET_MAP_MOVE_BLOCK(m, x, y))) { |
| | new_draw_info(NDI_UNIQUE, 0, op, "You can't cast the spell on top of a wall!\n"); |
| | free_object(tmp); |
| | return 0; |
| | } |
| | |
| | |
| | |
tmp->stats.dam=spell->stats.dam+SP_level_dam_adjust(caster,spell); | | tmp->stats.dam=spell->stats.dam+SP_level_dam_adjust(caster,spell); |
tmp->duration=spell->duration+SP_level_duration_adjust(caster,spell); | | tmp->duration=spell->duration+SP_level_duration_adjust(caster,spell); |
| | |
* first we check the closest square for free squares | | * first we check the closest square for free squares |
*/ | | */ |
| | |
dir=find_first_free_spot(at,op->map,op->x,op->y); | | dir=find_first_free_spot(&at->clone,op->map,op->x,op->y); |
if(dir!=-1) { | | if(dir!=-1) { |
/* This is basically grabbed for generate monster. Fixed 971225 to | | /* This is basically grabbed for generate monster. Fixed 971225 to |
* insert multipart monsters properly | | * insert multipart monsters properly |
| | |
break; | | break; |
} | | } |
} | | } |
| | |