summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-29 08:19:15 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-29 08:19:15 +0000
commit04b39d34b1eaffd6223743966efab334caf08e8c (patch)
tree1813d8426bfec66537bc8822f93db900779f5966 /crawl-ref/source/monstuff.cc
parent8cffb32e8c61a88ce23b389c5d1e4255e21e59d9 (diff)
downloadcrawl-ref-04b39d34b1eaffd6223743966efab334caf08e8c.tar.gz
crawl-ref-04b39d34b1eaffd6223743966efab334caf08e8c.zip
Force berserking and non-living monsters to flee sanctuary.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6212 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index c40052035e..ffb6f30b3e 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -2053,14 +2053,20 @@ void behaviour_event(monsters *mon, int event, int src,
break;
case ME_SCARE:
- // Berserking monsters don't flee.
- if (mon->has_ench(ENCH_BERSERK))
+ {
+ const bool flee_sanct = !mons_wont_attack(mon)
+ && is_sanctuary(mon->x, mon->y);
+
+ // Berserking monsters don't flee, unless it's from sanctuary.
+ if (mon->has_ench(ENCH_BERSERK) && !flee_sanct)
break;
- // Neither do plants or nonliving beings.
+ // Neither do plants or nonliving beings, and sanctuary doesn't
+ // affect plants.
if (mons_class_holiness(mon->type) == MH_PLANT
- || mons_class_holiness(mon->type) == MH_NONLIVING)
+ || (mons_class_holiness(mon->type) == MH_NONLIVING && !flee_sanct))
{
+ mon->del_ench(ENCH_FEAR, true, true);
break;
}
@@ -2072,6 +2078,7 @@ void behaviour_event(monsters *mon, int event, int src,
if (see_grid(mon->x, mon->y))
learned_something_new(TUT_FLEEING_MONSTER);
break;
+ }
case ME_CORNERED:
// Plants or nonliving monsters cannot flee.