version 1.27 | | version 1.28 |
---|
| | |
/* | | /* |
* static char *rcsid_spell_util_c = | | * static char *rcsid_spell_util_c = |
* "$Id: spell_util.c,v 1.27 2000/11/15 02:57:10 peterm Exp $"; | | * "$Id: spell_util.c,v 1.28 2000/11/17 11:16:45 peterm Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
case SP_LARGE_ICESTORM: | | case SP_LARGE_ICESTORM: |
case SP_BANISHMENT: | | case SP_BANISHMENT: |
case SP_MANA_BLAST: | | case SP_MANA_BLAST: |
| | case SP_WINDSTORM: |
success = cast_cone(op,caster,dir,duration,type,spellarch[type],!ability); | | success = cast_cone(op,caster,dir,duration,type,spellarch[type],!ability); |
break; | | break; |
case SP_TURN_UNDEAD: | | case SP_TURN_UNDEAD: |
| | |
return success; | | return success; |
} | | } |
| | |
| | /* this function checks to see if the cone pushes objects as well |
| | as flies over and damages them */ |
| | void check_cone_push(object *op) { |
| | object *tmp, *tmp2; /* object on the map */ |
| | for(tmp=get_map_ob(op->map,op->x,op->y);tmp!=NULL;tmp=tmp->above) |
| | { |
| | int nx,ny; |
| | int weight_move; |
| | int num_sections = 1; |
| | /* don't move parts of objects */ |
| | if(tmp->head) continue; |
| | |
| | /* don't move floors or immobile objects */ |
| | if(QUERY_FLAG(tmp,FLAG_IS_FLOOR)||(!QUERY_FLAG(tmp,FLAG_ALIVE)&&QUERY_FLAG(tmp,FLAG_NO_PICK))) continue; |
| | |
| | nx = op->x + freearr_x[absdir(op->stats.sp)]; |
| | ny = op->y + freearr_y[absdir(op->stats.sp)]; |
| | |
| | /* don't try to move something someplace where it can't go */ |
| | if(arch_blocked(tmp->arch,op->map,nx,ny)) continue; |
| | |
| | /* OK, now we decide if we're going to move it */ |
| | /* assume a weightless thing is a spell or whatever */ |
| | if(tmp->weight==0) continue; |
| | |
| | weight_move = 1000 + 1000 * op->level; |
| | /* count the object's sections */ |
| | for(tmp2 = tmp; tmp2!=NULL;tmp2=tmp2->more) num_sections++; |
| | |
| | if(RANDOM() % weight_move > tmp->weight/num_sections) { /* move it. */ |
| | remove_ob(tmp); |
| | tmp->x = nx; |
| | tmp->y = ny; |
| | insert_ob_in_map(tmp,op->map,op); |
| | } |
| | |
| | } |
| | } |
| | |
void move_cone(object *op) { | | void move_cone(object *op) { |
int i; | | int i; |
tag_t tag; | | tag_t tag; |
| | |
*/ | | */ |
tag = op->count; | | tag = op->count; |
op->stats.food |= hit_map(op,0,op->attacktype); | | op->stats.food |= hit_map(op,0,op->attacktype); |
| | /* Check to see if we should push anything. |
| | * Cones with AT_PHYSICAL push whatever is in them to some |
| | * degree. */ |
| | if(op->attacktype & AT_PHYSICAL) check_cone_push(op); |
if (was_destroyed (op, tag)) | | if (was_destroyed (op, tag)) |
return; | | return; |
| | |