summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-util.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-23 21:30:08 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-23 21:30:08 +0000
commit8bc8c04fbe230fb0f962f43da1acb3c51c4f88f0 (patch)
tree70f4c3d5336e09492f3c46b73c58c47014825e45 /crawl-ref/source/mon-util.cc
parent7ace26d7f10f5eaefbe12f454183c88dbcb09b73 (diff)
downloadcrawl-ref-8bc8c04fbe230fb0f962f43da1acb3c51c4f88f0.tar.gz
crawl-ref-8bc8c04fbe230fb0f962f43da1acb3c51c4f88f0.zip
Fix monster emergency spells not checking for ENCH_TP, thus allowing
monsters to cancel their teleportation without meaning to. (BR 2000428) Fix the quiver not being cleared when wielding the only quiverable (and thus previously quivered) item. (Un)wielding such an item now switches nicely between "Nothing wielded" and "Nothing quivered", as it should be. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6089 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r--crawl-ref/source/mon-util.cc22
1 files changed, 15 insertions, 7 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 3c8140893a..91e073f839 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -1546,7 +1546,7 @@ void define_monster(monsters &mons)
case MONS_DEEP_ELF_KNIGHT:
case MONS_DEEP_ELF_SOLDIER:
case MONS_ORC_WIZARD:
- spells = static_cast<mon_spellbook_type>(MST_ORC_WIZARD_I+random2(3));
+ spells = static_cast<mon_spellbook_type>(MST_ORC_WIZARD_I + random2(3));
break;
case MONS_LICH:
@@ -2340,6 +2340,10 @@ bool ms_low_hitpoint_cast( const monsters *mon, spell_type monspell )
switch (monspell)
{
case SPELL_TELEPORT_SELF:
+ // Don't cast again if already about to teleport.
+ if (mon->has_ench(ENCH_TP))
+ return (false);
+ // intentional fall-through
case SPELL_TELEPORT_OTHER:
case SPELL_LESSER_HEALING:
case SPELL_GREATER_HEALING:
@@ -2371,11 +2375,15 @@ bool ms_quick_get_away( const monsters *mon /*unused*/, spell_type monspell )
{
switch (monspell)
{
- case SPELL_TELEPORT_SELF:
- case SPELL_BLINK:
- return true;
- default:
- return false;
+ case SPELL_TELEPORT_SELF:
+ // Don't cast again if already about to teleport.
+ if (mon->has_ench(ENCH_TP))
+ return (false);
+ // intentional fall-through
+ case SPELL_BLINK:
+ return (true);
+ default:
+ return (false);
}
}
@@ -2451,7 +2459,7 @@ bool ms_waste_of_time( const monsters *mon, spell_type monspell )
case SPELL_TELEPORT_SELF:
// Monsters aren't smart enough to know when to cancel teleport.
- if (mon->has_ench( ENCH_TP ))
+ if (mon->has_ench(ENCH_TP))
ret = true;
break;