version 1.15 | | version 1.16 |
---|
| | |
/* | | /* |
* static char *rcsid_move_c = | | * static char *rcsid_move_c = |
* "$Id: move.c,v 1.15 2001/11/04 20:22:55 michtoen Exp $"; | | * "$Id: move.c,v 1.16 2001/11/26 17:52:26 michtoen Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
return 1; | | return 1; |
} | | } |
| | |
| | /* returns 0 if a monster was pushed and 1 if not - however */ |
int push_ob(object *who, int dir, object *pusher) { | | int push_ob(object *who, int dir, object *pusher) { |
int str1, str2; | | int str1, str2; |
object *owner; | | object *owner; |
| | |
if (who->head != NULL) | | if (who->head != NULL) |
who = who->head; | | who = who->head; |
owner = get_owner(who); | | owner = get_owner(who); |
if (who->more == NULL && owner == pusher) { | | |
| | CLEAR_FLAG(who,FLAG_SLEEP); /* what ever: this action lets wakeup the sucker */ |
| | |
| | /* player change place with his pets or summoned creature */ |
| | /* TODO: allow multi arch pushing. Can't be very difficult */ |
| | if (who->more == NULL && owner == pusher) |
| | { |
int temp; | | int temp; |
remove_ob(who); | | remove_ob(who); |
remove_ob(pusher); | | remove_ob(pusher); |
| | |
insert_ob_in_map (pusher,pusher->map,pusher,0); | | insert_ob_in_map (pusher,pusher->map,pusher,0); |
return 0; | | return 0; |
} | | } |
if(QUERY_FLAG(who,FLAG_UNAGGRESSIVE) && owner != pusher) | | |
| | |
| | /* We want ONLY become enemy of evil, unaggressive monster. We must RUN in them */ |
| | /* In original we have here a unaggressive check only - that was the reason why */ |
| | /* we so often become an enemy of friendly monsters... */ |
| | /* funny: was they set to unaggressive 0 (= not so nice) they don't attack */ |
| | if(owner != pusher && pusher->type == PLAYER && who->type != PLAYER && |
| | !QUERY_FLAG(who,FLAG_FRIENDLY)&& !QUERY_FLAG(who,FLAG_NEUTRAL)) |
| | { |
| | if(pusher->contr->run_on) /* only when we run */ |
| | { |
| | new_draw_info_format(NDI_UNIQUE, 0, pusher, |
| | "You start to attack %s !!",who->name); |
| | // CLEAR_FLAG(who,FLAG_UNAGGRESSIVE); /* the sucker don't like you anymore */ |
who->enemy = pusher; | | who->enemy = pusher; |
| | } |
| | else |
| | { |
| | new_draw_info_format(NDI_UNIQUE, 0, pusher, |
| | "You avoid to attack %s .",who->name); |
| | } |
| | } |
| | |
| | /* now, lets test stand still we NEVER can psuh stand_still monsters. */ |
| | if(QUERY_FLAG(who,FLAG_STAND_STILL)) |
| | { |
| | new_draw_info_format(NDI_UNIQUE, 0, pusher, |
| | "You can't push %s.",who->name); |
| | return 1; |
| | } |
| | |
| | /* ok, now we are here. I only allow player pushing */ |
| | /* for monsters, we have the arch commands how and why they can move/pushed */ |
| | /* and we have melee power like knockback */ |
str1 = (who->stats.Str>0?who->stats.Str:who->level); | | str1 = (who->stats.Str>0?who->stats.Str:who->level); |
str2 = (pusher->stats.Str>0?pusher->stats.Str:pusher->level); | | str2 = (pusher->stats.Str>0?pusher->stats.Str:pusher->level); |
if(QUERY_FLAG(who,FLAG_WIZ) || | | if(QUERY_FLAG(who,FLAG_WIZ) || |
| | |
new_draw_info_format(NDI_UNIQUE, 0, who, | | new_draw_info_format(NDI_UNIQUE, 0, who, |
"%s tried to push you.",pusher->name); | | "%s tried to push you.",pusher->name); |
} | | } |
if (QUERY_FLAG(who, FLAG_MONSTER)) { | | |
new_draw_info_format(NDI_UNIQUE, 0, pusher, | | |
"Your pushing annoys %s.",who->name); | | |
} | | |
return 0; | | return 0; |
} | | } |
| | |
if (who->type == PLAYER) { | | if (who->type == PLAYER) { |
new_draw_info_format(NDI_UNIQUE, 0, who, | | new_draw_info_format(NDI_UNIQUE, 0, who, |
"%s pushed you.",pusher->name); | | "%s pushed you.",pusher->name); |
} | | } |
if (QUERY_FLAG(who, FLAG_MONSTER)) { | | else if (QUERY_FLAG(who, FLAG_MONSTER)) { |
if(owner == pusher) | | |
new_draw_info_format(NDI_UNIQUE, 0,pusher, | | new_draw_info_format(NDI_UNIQUE, 0,pusher, |
"%s doesn't seem pleased with your action.",who->name); | | "You pushed %s back.", who->name); |
else | | |
new_draw_info_format(NDI_UNIQUE, 0,pusher, | | |
"%s is definitely annoyed at your pushing.",who->name); | | |
} | | } |
| | |
return 1; | | return 1; |
} | | } |