version 1.59 | | version 1.60 |
---|
| | |
/* | | /* |
* static char *rcsid_spell_effect_c = | | * static char *rcsid_spell_effect_c = |
* "$Id: spell_effect.c,v 1.59 2001/06/30 19:36:42 gros Exp $"; | | * "$Id: spell_effect.c,v 1.60 2001/07/14 04:11:18 mwedel Exp $"; |
*/ | | */ |
| | |
| | |
| | |
else tmp->stats.dam=power; /* nasty recoils! */ | | else tmp->stats.dam=power; /* nasty recoils! */ |
| | |
tmp->stats.maxhp=tmp->count; /*??*/ | | tmp->stats.maxhp=tmp->count; /*??*/ |
insert_ob_in_map(tmp,op->map,NULL); | | insert_ob_in_map(tmp,op->map,NULL,0); |
} | | } |
} | | } |
} | | } |
| | |
tmp->stats.hp+=lvl/5; /* increase the area of destruction */ | | tmp->stats.hp+=lvl/5; /* increase the area of destruction */ |
tmp->stats.dam=lvl; /* nasty recoils! */ | | tmp->stats.dam=lvl; /* nasty recoils! */ |
tmp->stats.maxhp=tmp->count; /*??*/ | | tmp->stats.maxhp=tmp->count; /*??*/ |
insert_ob_in_map(tmp,op->map,op); | | insert_ob_in_map(tmp,op->map,op,0); |
| | |
} | | } |
| | |
| | |
| | |
spell_effect(SP_AGGRAVATION, op->x, op->y, op->map, op); | | spell_effect(SP_AGGRAVATION, op->x, op->y, op->map, op); |
| | |
for (i = 0; i < op->map->map_object->x; i++) | | for (i = 0; i < MAP_WIDTH(op->map); i++) |
for (j = 0; j < op->map->map_object->y; j++) { | | for (j = 0; j < MAP_HEIGHT(op->map); j++) { |
if (out_of_map(op->map, op->x + i , op->y + j)) | | if (out_of_map(op->map, op->x + i , op->y + j)) |
continue; | | continue; |
for (tmp = get_map_ob(op->map, op->x + i, op->y + j); | | for (tmp = get_map_ob(op->map, op->x + i, op->y + j); |
| | |
| | |
/* Put the new creature on the map */ | | /* Put the new creature on the map */ |
op->x = x; op->y = y; | | op->x = x; op->y = y; |
if ((op = insert_ob_in_map (op, map, owner)) == NULL) | | if ((op = insert_ob_in_map (op, map, owner,0)) == NULL) |
return; | | return; |
| | |
if(op->randomitems != NULL) | | if(op->randomitems != NULL) |
| | |
new_ob->y = op->y; | | new_ob->y = op->y; |
remove_ob(op); | | remove_ob(op); |
free_object(op); | | free_object(op); |
/* insert_ob_in_map_simple is caused so that objects don't get | | /* |
* merged/rearranged. | | * Don't want objects merged or re-arranged, as it then messes up the |
| | * order |
*/ | | */ |
insert_ob_in_map_simple(new_ob,who->map); | | insert_ob_in_map(new_ob,who->map,new_ob,INS_NO_MERGE | INS_NO_WALK_ON); |
} | | } |
| | |
/* polymorh - caster who has hit object op. */ | | /* polymorh - caster who has hit object op. */ |
| | |
*/ | | */ |
image->stats.food += range; | | image->stats.food += range; |
image->speed_left = 0.1; | | image->speed_left = 0.1; |
insert_ob_in_map(image,op->map,op); | | insert_ob_in_map(image,op->map,op,0); |
} | | } |
return 1; | | return 1; |
} | | } |
| | |
spb->speed_left= -0.1; | | spb->speed_left= -0.1; |
if(type==SP_LARGE_SPEEDBALL) | | if(type==SP_LARGE_SPEEDBALL) |
spb->stats.dam=30; | | spb->stats.dam=30; |
insert_ob_in_map(spb,op->map,op); | | insert_ob_in_map(spb,op->map,op,0); |
return 1; | | return 1; |
} | | } |
| | |
| | |
break; | | break; |
} | | } |
new_draw_info(NDI_UNIQUE, 0,op,"You can't see your hands!"); | | new_draw_info(NDI_UNIQUE, 0,op,"You can't see your hands!"); |
update_object(op); | | update_object(op,UP_OBJ_FACE); |
for (tmp = objects; tmp != NULL; tmp = tmp->next) | | for (tmp = objects; tmp != NULL; tmp = tmp->next) |
if (tmp->enemy == op) | | if (tmp->enemy == op) |
tmp->enemy = NULL; | | tmp->enemy = NULL; |
| | |
dummy->y=exity; | | dummy->y=exity; |
dummy->stats.exp=1; /*Set as a 2 ways exit (see manual_apply & is_legal_2ways_exit funcs)*/ | | dummy->stats.exp=1; /*Set as a 2 ways exit (see manual_apply & is_legal_2ways_exit funcs)*/ |
dummy->race=add_string (op->name); /*Save the owner of the portal*/ | | dummy->race=add_string (op->name); /*Save the owner of the portal*/ |
insert_ob_in_map(dummy,exitmap,op); | | insert_ob_in_map(dummy,exitmap,op,0); |
force=get_archetype("force"); /*The force*/ | | force=get_archetype("force"); /*The force*/ |
if(force == NULL){ | | if(force == NULL){ |
new_draw_info(NDI_UNIQUE, 0,op,"Oops, program error!"); | | new_draw_info(NDI_UNIQUE, 0,op,"Oops, program error!"); |
| | |
return 0; | | return 0; |
} | | } |
tmp->x=op->x+freearr_x[dir],tmp->y=op->y+freearr_y[dir]; | | tmp->x=op->x+freearr_x[dir],tmp->y=op->y+freearr_y[dir]; |
if ((tmp = insert_ob_in_map (tmp, op->map, op)) == NULL) { | | if ((tmp = insert_ob_in_map (tmp, op->map, op,0)) == NULL) { |
new_draw_info(NDI_UNIQUE, 0,op,"Something destroys your wall"); | | new_draw_info(NDI_UNIQUE, 0,op,"Something destroys your wall"); |
return 0; | | return 0; |
} | | } |
| | |
tmp2 = get_object(); | | tmp2 = get_object(); |
copy_object(tmp,tmp2); | | copy_object(tmp,tmp2); |
tmp2->x = x; tmp2->y = y; | | tmp2->x = x; tmp2->y = y; |
insert_ob_in_map(tmp2,op->map,op); | | insert_ob_in_map(tmp2,op->map,op,0); |
} else posblocked=1; | | } else posblocked=1; |
x = tmp->x-i*freearr_x[dir2]; y = tmp->y-i*freearr_y[dir2]; | | x = tmp->x-i*freearr_x[dir2]; y = tmp->y-i*freearr_y[dir2]; |
if(!blocked(op->map,x,y)&&!negblocked) { | | if(!blocked(op->map,x,y)&&!negblocked) { |
tmp2 = get_object(); | | tmp2 = get_object(); |
copy_object(tmp,tmp2); | | copy_object(tmp,tmp2); |
tmp2->x = x; tmp2->y = y; | | tmp2->x = x; tmp2->y = y; |
insert_ob_in_map(tmp2,op->map,op); | | insert_ob_in_map(tmp2,op->map,op,0); |
} else negblocked=1; | | } else negblocked=1; |
} | | } |
| | |
| | |
if(QUERY_FLAG(tmp, FLAG_BLOCKSVIEW)) | | if(QUERY_FLAG(tmp, FLAG_BLOCKSVIEW)) |
update_all_los(op->map); | | update_all_los(op->map, op->x, op->y); |
if(op->type==PLAYER) | | if(op->type==PLAYER) |
draw(op); | | draw(op); |
else | | else |
| | |
if (tmp->speed < MIN_ACTIVE_SPEED) tmp->speed = MIN_ACTIVE_SPEED; | | if (tmp->speed < MIN_ACTIVE_SPEED) tmp->speed = MIN_ACTIVE_SPEED; |
tmp->glow_radius=dam; | | tmp->glow_radius=dam; |
tmp->x=x,tmp->y=y; | | tmp->x=x,tmp->y=y; |
insert_ob_in_map(tmp,op->map,op); | | insert_ob_in_map(tmp,op->map,op,0); |
| | |
if(op->type==PLAYER) draw(op); | | if(op->type==PLAYER) draw(op); |
return 1; | | return 1; |
| | |
* a no magic spot. | | * a no magic spot. |
*/ | | */ |
if(blocked(op->map,op->x+freearr_x[dir]*dist, op->y+freearr_y[dir]*dist)){ | | if(blocked(op->map,op->x+freearr_x[dir]*dist, op->y+freearr_y[dir]*dist)){ |
int x=RANDOM()%op->map->map_object->x,y=RANDOM()%op->map->map_object->y; | | int x=RANDOM()%MAP_WIDTH(op->map),y=RANDOM()%MAP_HEIGHT(op->map); |
| | |
if(blocked(op->map,x,y) || blocks_magic(op->map,x,y)) { | | if(blocked(op->map,x,y) || blocks_magic(op->map,x,y)) { |
new_draw_info(NDI_UNIQUE, 0,op,"You cast your spell, but nothing happens.\n"); | | new_draw_info(NDI_UNIQUE, 0,op,"You cast your spell, but nothing happens.\n"); |
| | |
| | |
remove_ob(op); | | remove_ob(op); |
op->x=x,op->y=y; | | op->x=x,op->y=y; |
if ((op = insert_ob_in_map(op,op->map,op)) != NULL) | | if ((op = insert_ob_in_map(op,op->map,op,0)) != NULL) |
draw(op); | | draw(op); |
return 1; | | return 1; |
} | | } |
| | |
/* Actually move the player now */ | | /* Actually move the player now */ |
remove_ob(op); | | remove_ob(op); |
op->x+=freearr_x[dir]*dist,op->y+=freearr_y[dir]*dist; | | op->x+=freearr_x[dir]*dist,op->y+=freearr_y[dir]*dist; |
if ((op = insert_ob_in_map(op,op->map,op)) == NULL) | | if ((op = insert_ob_in_map(op,op->map,op,0)) == NULL) |
return 1; | | return 1; |
draw(op); | | draw(op); |
op->speed_left= -FABS(op->speed)*5; /* Freeze them for a short while */ | | op->speed_left= -FABS(op->speed)*5; /* Freeze them for a short while */ |
| | |
head->direction = dir; | | head->direction = dir; |
/* Some monsters are sleeping by default - clear that */ | | /* Some monsters are sleeping by default - clear that */ |
CLEAR_FLAG(head, FLAG_SLEEP); | | CLEAR_FLAG(head, FLAG_SLEEP); |
head = insert_ob_in_map (head, op->map, op); | | head = insert_ob_in_map (head, op->map, op,0); |
if (head != NULL && head->randomitems != NULL) { | | if (head != NULL && head->randomitems != NULL) { |
object *tmp; | | object *tmp; |
create_treasure(head->randomitems,head,GT_APPLY,6,0); | | create_treasure(head->randomitems,head,GT_APPLY,6,0); |
| | |
| | |
set_owner(tmp,op); | | set_owner(tmp,op); |
tmp->x=dx,tmp->y=dy; | | tmp->x=dx,tmp->y=dy; |
insert_ob_in_map(tmp,op->map,op); | | insert_ob_in_map(tmp,op->map,op,0); |
return 1; | | return 1; |
} | | } |
| | |
| | |
if (env->type==PLAYER) drop(env,op); | | if (env->type==PLAYER) drop(env,op); |
else { | | else { |
remove_ob(op); | | remove_ob(op); |
if ((op = insert_ob_in_map (op, env->map, op)) == NULL) | | if ((op = insert_ob_in_map (op, env->map, op,0)) == NULL) |
return; | | return; |
} | | } |
} | | } |
| | |
if(op->type==PLAYER) | | if(op->type==PLAYER) |
set_owner(tmp,op); | | set_owner(tmp,op); |
| | |
if ((tmp = insert_ob_in_map(tmp,op->map,op)) != NULL) | | if ((tmp = insert_ob_in_map(tmp,op->map,op,0)) != NULL) |
move_cancellation(tmp); | | move_cancellation(tmp); |
return 1; | | return 1; |
} | | } |
| | |
if(reflwall(op->map,op->x,op->y, op)) { | | if(reflwall(op->map,op->x,op->y, op)) { |
| | |
op->direction=absdir(op->direction+4); | | op->direction=absdir(op->direction+4); |
insert_ob_in_map(op,op->map,op); | | insert_ob_in_map(op,op->map,op,0); |
return; | | return; |
} | | } |
if ((op = insert_ob_in_map (op, op->map, op)) != NULL) | | if ((op = insert_ob_in_map (op, op->map, op,0)) != NULL) |
hit_map (op, 0, op->attacktype); | | hit_map (op, 0, op->attacktype); |
} | | } |
| | |
| | |
tmp-> nrof = small_nuggets; | | tmp-> nrof = small_nuggets; |
tmp->x = x; | | tmp->x = x; |
tmp->y = y; | | tmp->y = y; |
insert_ob_in_map(tmp, op->map, op); | | insert_ob_in_map(tmp, op->map, op,0); |
} | | } |
if (large_nuggets) { | | if (large_nuggets) { |
tmp = get_object(); | | tmp = get_object(); |
| | |
tmp-> nrof = large_nuggets; | | tmp-> nrof = large_nuggets; |
tmp->x = x; | | tmp->x = x; |
tmp->y = y; | | tmp->y = y; |
insert_ob_in_map(tmp, op->map, op); | | insert_ob_in_map(tmp, op->map, op,0); |
} | | } |
} | | } |
| | |
| | |
object *detect_ob = arch_to_object(detect_arch); | | object *detect_ob = arch_to_object(detect_arch); |
detect_ob->x = x; | | detect_ob->x = x; |
detect_ob->y = y; | | detect_ob->y = y; |
insert_ob_in_map(detect_ob, op->map, op); | | insert_ob_in_map(detect_ob, op->map, op,0); |
} | | } |
} | | } |
if ((type == SP_DETECT_MAGIC || type == SP_DETECT_CURSE) && | | if ((type == SP_DETECT_MAGIC || type == SP_DETECT_CURSE) && |
| | |
if((effect=get_archetype("detect_magic"))){ | | if((effect=get_archetype("detect_magic"))){ |
effect->x = tmp->x; | | effect->x = tmp->x; |
effect->y = tmp->y; | | effect->y = tmp->y; |
insert_ob_in_map(effect,tmp->map,op); | | insert_ob_in_map(effect,tmp->map,op,0); |
} | | } |
SET_FLAG(tmp,FLAG_UNAGGRESSIVE); | | SET_FLAG(tmp,FLAG_UNAGGRESSIVE); |
} | | } |
| | |
/* that players will garner much exp with */ | | /* that players will garner much exp with */ |
/* this spell */ | | /* this spell */ |
#endif | | #endif |
insert_ob_in_map(tmp,op->map,op); | | insert_ob_in_map(tmp,op->map,op,0); |
} | | } |
| | |
return 1; | | return 1; |
| | |
free_object(tmp); | | free_object(tmp); |
return 0; | | return 0; |
} | | } |
if ((tmp = insert_ob_in_map (tmp, op->map, op)) == NULL) | | if ((tmp = insert_ob_in_map (tmp, op->map, op,0)) == NULL) |
return 1; | | return 1; |
if(QUERY_FLAG(tmp, FLAG_BLOCKSVIEW)) | | if(QUERY_FLAG(tmp, FLAG_BLOCKSVIEW)) |
update_all_los(op->map); | | update_all_los(op->map, op->x, op->y); |
if(op->type==PLAYER) | | if(op->type==PLAYER) |
draw(op); | | draw(op); |
else | | else |
| | |
if((effect=get_archetype("detect_magic"))){ | | if((effect=get_archetype("detect_magic"))){ |
effect->x = tmp->x; | | effect->x = tmp->x; |
effect->y = tmp->y; | | effect->y = tmp->y; |
insert_ob_in_map(effect,tmp->map,op); | | insert_ob_in_map(effect,tmp->map,op,0); |
} | | } |
set_owner(tmp,op); | | set_owner(tmp,op); |
SET_FLAG(tmp,FLAG_MONSTER); | | SET_FLAG(tmp,FLAG_MONSTER); |
| | |
if((effect=get_archetype("detect_magic"))){ | | if((effect=get_archetype("detect_magic"))){ |
effect->x = tmp->x; | | effect->x = tmp->x; |
effect->y = tmp->y; | | effect->y = tmp->y; |
insert_ob_in_map(effect,tmp->map,op); | | insert_ob_in_map(effect,tmp->map,op,0); |
} | | } |
set_owner(tmp,op); | | set_owner(tmp,op); |
SET_FLAG(tmp,FLAG_MONSTER); | | SET_FLAG(tmp,FLAG_MONSTER); |
| | |
} | | } |
} /* if monster level is much less than character level */ | | } /* if monster level is much less than character level */ |
| | |
head = insert_ob_in_map (head, op->map, op); | | head = insert_ob_in_map (head, op->map, op,0); |
if (head != NULL && head->randomitems != NULL) { | | if (head != NULL && head->randomitems != NULL) { |
object *tmp; | | object *tmp; |
create_treasure(head->randomitems,head,GT_APPLY,6,0); | | create_treasure(head->randomitems,head,GT_APPLY,6,0); |
| | |
tmp->speed_left= -1; | | tmp->speed_left= -1; |
tmp->x=op->x+freearr_x[dir],tmp->y=op->y+freearr_y[dir]; | | tmp->x=op->x+freearr_x[dir],tmp->y=op->y+freearr_y[dir]; |
tmp->direction=dir; | | tmp->direction=dir; |
insert_ob_in_map(tmp,op->map,op); | | insert_ob_in_map(tmp,op->map,op,0); |
return 1; | | return 1; |
} | | } |
| | |
| | |
} | | } |
} | | } |
| | |
insert_ob_in_map(hitter,op->map,op); | | insert_ob_in_map(hitter,op->map,op,0); |
| | |
return success; | | return success; |
} | | } |
| | |
tmp->speed_left= -1; | | tmp->speed_left= -1; |
tmp->x=op->x+freearr_x[dir],tmp->y=op->y+freearr_y[dir]; | | tmp->x=op->x+freearr_x[dir],tmp->y=op->y+freearr_y[dir]; |
tmp->direction=dir; | | tmp->direction=dir; |
insert_ob_in_map(tmp,op->map,op); | | insert_ob_in_map(tmp,op->map,op,0); |
return 1; | | return 1; |
} | | } |
| | |
| | |
tmp=tmp->above; | | tmp=tmp->above; |
if(tmp==NULL) | | if(tmp==NULL) |
continue; | | continue; |
#ifndef USE_LIGHTING | | |
success += hit_player(tmp,dam,op,AT_FIRE|AT_MAGIC); | | |
#else | | |
if(make_object_glow(tmp,1,factor)) { | | if(make_object_glow(tmp,1,factor)) { |
object *effect=get_archetype("detect_magic"); | | object *effect=get_archetype("detect_magic"); |
success++; | | success++; |
if(effect){ | | if(effect){ |
effect->x = tmp->x; | | effect->x = tmp->x; |
effect->y = tmp->y; | | effect->y = tmp->y; |
insert_ob_in_map(effect,op->map,op); | | insert_ob_in_map(effect,op->map,op,0); |
} | | } |
} | | } |
#endif | | |
} | | } |
return success; | | return success; |
} | | } |
| | |
flash->x = x; | | flash->x = x; |
flash->y = y; | | flash->y = y; |
flash->map = walk->map; | | flash->map = walk->map; |
insert_ob_in_map(flash,walk->map,op); | | insert_ob_in_map(flash,walk->map,op,0); |
return 1; | | return 1; |
} | | } |
free_object(disease); | | free_object(disease); |
| | |
| | |
/* we need to jump out of the inventory for a bit | | /* we need to jump out of the inventory for a bit |
in order to hit the map conveniently. */ | | in order to hit the map conveniently. */ |
insert_ob_in_map(aura,env->map,aura); | | insert_ob_in_map(aura,env->map,aura,0); |
for(i=1;i<9;i++) { | | for(i=1;i<9;i++) { |
hit_map(aura,i,aura->attacktype); | | hit_map(aura,i,aura->attacktype); |
if(aura->other_arch) { | | if(aura->other_arch) { |
| | |
new_ob = arch_to_object(aura->other_arch); | | new_ob = arch_to_object(aura->other_arch); |
new_ob->x = nx; | | new_ob->x = nx; |
new_ob->y = ny; | | new_ob->y = ny; |
insert_ob_in_map(new_ob,env->map,aura); | | insert_ob_in_map(new_ob,env->map,aura,0); |
} | | } |
} | | } |
/* put the aura back in the player's inventory */ | | /* put the aura back in the player's inventory */ |