summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-02 03:32:49 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-02 03:32:49 +0000
commiteea780a4ce6f65322040c52a49a56a3a60003249 (patch)
treea255c8d8c0dd57524020ddc8fdf9ea0dbe708ac0 /crawl-ref/source/monstuff.cc
parent635887d54e242f2150146f7f980246df04cbac5b (diff)
downloadcrawl-ref-eea780a4ce6f65322040c52a49a56a3a60003249.tar.gz
crawl-ref-eea780a4ce6f65322040c52a49a56a3a60003249.zip
Make berserking and non-living monsters stop retreating from Sanctuary as
soon as they leave it, since they're being forced out rather than actually afraid. Also give a "stops retreating" message for them instead of the "regaining courage" one. Remove faulty logic that was causing monsters to not notice the player as soon as they stopped fleeing Sanctuary. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6320 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 4ad21c1801..2d6e2892aa 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -3418,13 +3418,6 @@ static void _handle_behaviour(monsters *mon)
mon->foe = new_foe;
}
-
- if (is_sanctuary(mon->target_x, mon->target_y) && mon->foe != MHITNOT
- && !isFriendly && !mons_is_pacified(mon) && mon->behaviour != BEH_FLEE
- && mon->target_pos() != mon->pos())
- {
- mon->foe = MHITNOT;
- }
}
static bool _mons_check_set_foe(monsters *mon, int x, int y,
@@ -3667,12 +3660,17 @@ static void _handle_movement(monsters *monster)
}
else if (mons_is_fleeing(monster) && inside_level_bounds(env.sanctuary_pos)
&& !is_sanctuary(monster->x, monster->y)
- && monster->target_x == env.sanctuary_pos.x
- && monster->target_y == env.sanctuary_pos.y)
+ && monster->target_pos() == env.sanctuary_pos)
{
// Once outside there's a chance they'll regain their courage.
- if (random2(5) > 2)
+ // Nonliving and berserking monsters always stop imediately,
+ // since they're only being forced out rather than actually scared.
+ if (monster->holiness() == MH_NONLIVING
+ || monster->has_ench(ENCH_BERSERK)
+ || random2(5) > 2)
+ {
monster->del_ench(ENCH_FEAR);
+ }
}
// some calculations