diff options
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r-- | crawl-ref/source/monstuff.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 79bbab27f1..affd188b41 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -1995,7 +1995,13 @@ static void handle_behaviour(monsters *mon) // we can jump back to WANDER if the foe // isn't present. - if (proxFoe) + if (isFriendly) + { + // Special-cased below so that it will flee *towards* you + mon->target_x = you.x_pos; + mon->target_y = you.y_pos; + } + else if (proxFoe) { // try to flee _from_ the correct position mon->target_x = foe_x; @@ -2173,7 +2179,9 @@ static void handle_movement(monsters *monster) mmov_x = (dx > 0) ? 1 : ((dx < 0) ? -1 : 0); mmov_y = (dy > 0) ? 1 : ((dy < 0) ? -1 : 0); - if (monster->behaviour == BEH_FLEE) + if (monster->behaviour == BEH_FLEE && + (!mons_friendly(monster) || + monster->target_x != you.x_pos || monster->target_y != you.y_pos)) { mmov_x *= -1; mmov_y *= -1; |