summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-30 03:58:49 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-30 03:58:49 +0000
commit7beeddfca47ed76fe6c605a45d21079ed38a4dfe (patch)
treee1ea895a94d9b740e3b009373e8f88dc83c6eee3 /crawl-ref/source/monstuff.cc
parent5a4971c1df16f37d42d3eb1108d01958ebde16b8 (diff)
downloadcrawl-ref-7beeddfca47ed76fe6c605a45d21079ed38a4dfe.tar.gz
crawl-ref-7beeddfca47ed76fe6c605a45d21079ed38a4dfe.zip
Make sure pacified monsters don't use emergency spells that harm the
area (i.e. torment). Spells that harm targets are still okay, since pacified monsters are also allowed to harm targets via melee. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6236 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index f8d80ee91b..5c98a7f347 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -5232,14 +5232,22 @@ static bool _handle_spell(monsters *monster, bolt &beem)
{
bool spellOK = false;
-
- // Setup spell - monsters that are fleeing or leaving
- // the level will always try to choose their emergency
- // spell.
+ // Setup spell - monsters that are fleeing or pacified
+ // and leaving the level will always try to choose their
+ // emergency spell.
if (mons_is_fleeing(monster) || mons_is_pacified(monster))
{
spell_cast = (one_chance_in(5) ? SPELL_NO_SPELL
: hspell_pass[5]);
+
+ // Pacified monsters leaving the level won't choose
+ // emergency spells harmful to the area.
+ if (spell_cast != SPELL_NO_SPELL
+ && mons_is_pacified(monster)
+ && spell_harms_area(spell_cast))
+ {
+ spell_cast = SPELL_NO_SPELL;
+ }
}
else
{