summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-18 06:29:14 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-18 06:29:14 +0000
commit76cf7eda1e78548dcb3b3e417e8aeb92e2cf1b1e (patch)
tree5e84a9382857ac9a59eb7be71c5cfe909c20d888 /crawl-ref/source
parentda651d3cf70da11fb5178027a4f2d58e7755648f (diff)
downloadcrawl-ref-76cf7eda1e78548dcb3b3e417e8aeb92e2cf1b1e.tar.gz
crawl-ref-76cf7eda1e78548dcb3b3e417e8aeb92e2cf1b1e.zip
Take good neutrals into account when checking if a monster's enemies are
around, and have a monster leaving the level cast spells like a fleeing monster, for the sake of getting out of the way. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5936 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/monstuff.cc18
-rw-r--r--crawl-ref/source/view.cc6
2 files changed, 13 insertions, 11 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index f84d4c9037..59d9c02e79 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -5110,10 +5110,10 @@ static bool _handle_spell(monsters *monster, bolt &beem)
SPELL_GREATER_HEALING : SPELL_LESSER_HEALING;
finalAnswer = true;
}
- else if (mons_is_fleeing(monster))
+ else if (mons_is_fleeing(monster) || mons_is_leaving(monster))
{
// Since the player isn't around, we'll extend the monster's
- // normal fleeing choices to include the self-enchant slot.
+ // normal choices to include the self-enchant slot.
int foundcount = 0;
for (int i = NUM_MONSTER_SPELL_SLOTS - 1; i >= 0; --i)
{
@@ -5154,7 +5154,7 @@ static bool _handle_spell(monsters *monster, bolt &beem)
// get here... even if the monster is on its last HP. That
// way we don't have to worry about monsters infinitely casting
// Healing on themselves (e.g. orc high priests).
- if (mons_is_fleeing(monster)
+ if ((mons_is_fleeing(monster) || mons_is_leaving(monster))
&& ms_low_hitpoint_cast(monster, hspell_pass[5]))
{
spell_cast = hspell_pass[5];
@@ -5178,8 +5178,9 @@ static bool _handle_spell(monsters *monster, bolt &beem)
if (!finalAnswer)
{
- // If nothing found by now, safe friendlies will rarely cast.
- if (mons_friendly(monster) && !mon_enemies_around(monster)
+ // If nothing found by now, safe friendlies and good
+ // neutrals will rarely cast.
+ if (mons_wont_attack(monster) && !mon_enemies_around(monster)
&& !one_chance_in(10))
{
return (false);
@@ -5214,9 +5215,10 @@ static bool _handle_spell(monsters *monster, bolt &beem)
{
bool spellOK = false;
- // Setup spell - fleeing monsters will always try to
- // choose their emergency spell.
- if (mons_is_fleeing(monster))
+ // Setup spell - monsters that are fleeing or leaving
+ // the level will always try to choose their emergency
+ // spell.
+ if (mons_is_fleeing(monster) || mons_is_leaving(monster))
{
spell_cast = (one_chance_in(5) ? SPELL_NO_SPELL
: hspell_pass[5]);
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index b55698383d..0eff2a9b85 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -3660,10 +3660,10 @@ bool mon_enemies_around(const monsters *monster)
if (monster->foe != MHITNOT && monster->foe != MHITYOU)
return (true);
- if (mons_friendly(monster))
+ if (mons_wont_attack(monster))
{
- // Additionally, if an ally is nearby and *you* have a foe, consider
- // it as the ally's enemy too.
+ // Additionally, if an ally is nearby and *you* have a foe,
+ // consider it as the ally's enemy too.
return (mons_near(monster) && !i_feel_safe());
}
else