version 1.15 | | version 1.16 |
---|
| | |
/* | | /* |
* static char *rcsid_spell_util_c = | | * static char *rcsid_spell_util_c = |
* "$Id: spell_util.c,v 1.15 2000/05/29 16:31:26 jec Exp $"; | | * "$Id: spell_util.c,v 1.16 2000/06/08 16:08:42 jec Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
} else { | | } else { |
if(QUERY_FLAG(op, FLAG_FRIENDLY)) { | | if(QUERY_FLAG(op, FLAG_FRIENDLY)) { |
object *owner = get_owner(op); | | object *owner = get_owner(op); |
if(owner != NULL) /* For now, we transfer ownership */ | | if (owner != NULL) { /* For now, we transfer ownership */ |
set_owner(tmp,owner); | | set_owner(tmp,owner); |
tmp->move_type = PETMOVE; | | tmp->move_type = PETMOVE; |
add_friendly_object(tmp); | | add_friendly_object(tmp); |
SET_FLAG(tmp, FLAG_FRIENDLY); | | SET_FLAG(tmp, FLAG_FRIENDLY); |
} | | } |
| | } |
SET_FLAG(tmp, FLAG_MONSTER); | | SET_FLAG(tmp, FLAG_MONSTER); |
} | | } |
/* This sets the level dependencies on dam and hp for monsters */ | | /* This sets the level dependencies on dam and hp for monsters */ |
| | |
if(QUERY_FLAG(tmp, FLAG_IS_TURNABLE)) | | if(QUERY_FLAG(tmp, FLAG_IS_TURNABLE)) |
SET_ANIMATION(tmp, dir); | | SET_ANIMATION(tmp, dir); |
set_owner(tmp,op); | | set_owner(tmp,op); |
| | tmp->level = SK_level (caster); |
#if 0 | | #if 0 |
if(op->type==PLAYER) | | if(op->type==PLAYER) |
tmp->stats.wc=5+(op->contr->shootstrength-5)/5, | | tmp->stats.wc=5+(op->contr->shootstrength-5)/5, |
| | |
tmp->x=op->x,tmp->y=op->y; | | tmp->x=op->x,tmp->y=op->y; |
tmp->direction=absdir(tmp->direction+4); | | tmp->direction=absdir(tmp->direction+4); |
} | | } |
insert_ob_in_map(tmp,op->map,op); | | if ((tmp = insert_ob_in_map(tmp,op->map,op)) != NULL) |
move_bolt(tmp); | | move_bolt(tmp); |
return 1; | | return 1; |
} | | } |
| | |
if(op->type==PLAYER) | | if(op->type==PLAYER) |
tmp->stats.hp=(op->contr->shootstrength-10)/10+10; | | tmp->stats.hp=(op->contr->shootstrength-10)/10+10; |
#endif | | #endif |
insert_ob_in_map(tmp,op->map,op); | | if ((tmp = insert_ob_in_map (tmp, op->map, op)) == NULL) |
/* object was used when it was inserted into the map - don't do anything | | return 1; |
* more | | |
*/ | | |
if (QUERY_FLAG(tmp, FLAG_FREED)) return 1; | | |
switch(type) { | | switch(type) { |
case SP_M_MISSILE: | | case SP_M_MISSILE: |
move_missile(tmp); | | move_missile(tmp); |
| | |
return; | | return; |
} | | } |
if(op->above!=NULL&&op->above->type!=PLAYER) { | | if(op->above!=NULL&&op->above->type!=PLAYER) { |
| | SET_FLAG (op, FLAG_NO_APPLY); |
remove_ob(op); | | remove_ob(op); |
insert_ob_in_map(op,op->map,op); | | insert_ob_in_map(op,op->map,op); |
| | CLEAR_FLAG (op, FLAG_NO_APPLY); |
} | | } |
hit_map(op,0,op->attacktype); | | hit_map(op,0,op->attacktype); |
if(op->stats.hp>2&&!op->value) { | | if(op->stats.hp>2&&!op->value) { |
| | |
tmp->value=0; | | tmp->value=0; |
tmp->stats.hp++; | | tmp->stats.hp++; |
tmp->x+=DIRX(tmp),tmp->y+=DIRY(tmp); | | tmp->x+=DIRX(tmp),tmp->y+=DIRY(tmp); |
insert_ob_in_map(tmp,op->map,op); | | tmp = insert_ob_in_map(tmp,op->map,op); |
| | if (tmp) { |
if (!tmp->stats.food) { | | if (!tmp->stats.food) { |
tmp->stats.food = 1; | | tmp->stats.food = 1; |
move_bolt(tmp); | | move_bolt(tmp); |
} else | | } else { |
tmp->stats.food = 0; | | tmp->stats.food = 0; |
} | | } |
} | | } |
} | | } |
| | } |
| | } |
| | |
| | |
/* updated this to allow more than the golem 'head' to attack */ | | /* updated this to allow more than the golem 'head' to attack */ |
| | |
void move_golem(object *op) { | | void move_golem(object *op) { |
int made_attack=0; | | int made_attack=0; |
object *tmp; | | object *tmp; |
| | tag_t tag; |
| | |
if(QUERY_FLAG(op, FLAG_MONSTER)) | | if(QUERY_FLAG(op, FLAG_MONSTER)) |
return; /* Has already been moved */ | | return; /* Has already been moved */ |
| | |
* move_ob (makes recursive calls to other parts) | | * move_ob (makes recursive calls to other parts) |
* move_ob returns 0 if the creature was not able to move. | | * move_ob returns 0 if the creature was not able to move. |
*/ | | */ |
| | tag = op->count; |
if(move_ob(op,op->direction,op)) return; | | if(move_ob(op,op->direction,op)) return; |
| | if (was_destroyed (op, tag)) |
| | return; |
| | |
for(tmp=op;tmp;tmp=tmp->more) { | | for(tmp=op;tmp;tmp=tmp->more) { |
int x=tmp->x+freearr_x[op->direction],y=tmp->y+freearr_y[op->direction]; | | int x=tmp->x+freearr_x[op->direction],y=tmp->y+freearr_y[op->direction]; |
| | |
| | |
if(reflwall(op->map,op->x,op->y)) { | | if(reflwall(op->map,op->x,op->y)) { |
op->direction=absdir(op->direction+4); | | op->direction=absdir(op->direction+4); |
insert_ob_in_map(op,op->map,op); | | if ((op = insert_ob_in_map(op,op->map,op)) != NULL) |
update_turn_face(op); | | update_turn_face(op); |
return; | | return; |
} | | } |
| | |
tmp->head=head; | | tmp->head=head; |
prev->more=tmp; | | prev->more=tmp; |
} | | } |
insert_ob_in_map(tmp,op->map,op); | | |
/* If something happens on the insert, don't insert anymore parts */ | | |
if (QUERY_FLAG(tmp,FLAG_FREED)) break; | | |
if (!head) head=tmp; | | if (!head) head=tmp; |
prev=tmp; | | prev=tmp; |
at=at->more; | | at=at->more; |
} | | } |
| | |
| | insert_ob_in_map(head,op->map,op); |
| | |
/* thought it'd be cool to insert a burnout, too.*/ | | /* thought it'd be cool to insert a burnout, too.*/ |
tmp=get_archetype("burnout"); | | tmp=get_archetype("burnout"); |
tmp->map = op->map; | | tmp->map = op->map; |