version 1.36 | | version 1.37 |
---|
| | |
/* | | /* |
* static char *rcsid_spell_util_c = | | * static char *rcsid_spell_util_c = |
* "$Id: spell_util.c,v 1.36 2000/12/09 22:39:04 peterm Exp $"; | | * "$Id: spell_util.c,v 1.37 2000/12/15 15:42:36 avogl Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
| | |
if (caster->path_denied & s->path) | | if (caster->path_denied & s->path) |
{ | | { |
| | /* This case is not a bug, just the fact that this function is |
| | * usually called BEFORE checking for path_deny. -AV |
LOG (llevError, "BUG: path_level_mod (arch %s, name %s): casting denied " | | LOG (llevError, "BUG: path_level_mod (arch %s, name %s): casting denied " |
"spell\n", caster->arch->name, caster->name); | | "spell\n", caster->arch->name, caster->name); */ |
return 1; | | return 1; |
} | | } |
new_level = base_level | | new_level = base_level |
| | |
} | | } |
} | | } |
| | |
| | /* reflwall - decides weither the (spell-)object sp_op will |
int reflwall(mapstruct *m,int x,int y) { | | * be reflected from the given mapsquare. Returns 1 if true. |
| | * (Note that for living creatures there is a small chance that |
| | * reflect_spell fails.) |
| | */ |
| | int reflwall(mapstruct *m,int x,int y, object *sp_op) { |
object *op; | | object *op; |
if(out_of_map(m,x,y)) return 0; | | if(out_of_map(m,x,y)) return 0; |
for(op=get_map_ob(m,x,y);op!=NULL;op=op->above) | | for(op=get_map_ob(m,x,y);op!=NULL;op=op->above) |
if(QUERY_FLAG(op, FLAG_REFL_SPELL)) | | if(QUERY_FLAG(op, FLAG_REFL_SPELL) && (!QUERY_FLAG(op, FLAG_ALIVE) || |
| | sp_op->type==LIGHTNING || (RANDOM()%100) < 90-sp_op->level/10)) |
return 1; | | return 1; |
return 0; | | return 0; |
} | | } |
| | |
if(blocks_view(op->map,op->x+DIRX(op),op->y+DIRY(op))) | | if(blocks_view(op->map,op->x+DIRX(op),op->y+DIRY(op))) |
return; | | return; |
w=wall(op->map,op->x+DIRX(op),op->y+DIRY(op)); | | w=wall(op->map,op->x+DIRX(op),op->y+DIRY(op)); |
r=reflwall(op->map,op->x+DIRX(op),op->y+DIRY(op)); | | r=reflwall(op->map,op->x+DIRX(op),op->y+DIRY(op), op); |
if(w&&!QUERY_FLAG(op, FLAG_REFLECTING)) | | if(w&&!QUERY_FLAG(op, FLAG_REFLECTING)) |
return; | | return; |
if(w||r) { /* We're about to bounce */ | | if(w||r) { /* We're about to bounce */ |
| | |
op->y = new_y; | | op->y = new_y; |
if ((op = insert_ob_in_map (op, op->map, op)) == NULL) | | if ((op = insert_ob_in_map (op, op->map, op)) == NULL) |
return; | | return; |
if (reflwall (op->map, op->x, op->y)) { | | |
| | if (reflwall (op->map, op->x, op->y, op)) { |
op->direction = absdir (op->direction + 4); | | op->direction = absdir (op->direction + 4); |
update_turn_face (op); | | update_turn_face (op); |
} else { | | } else { |