summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-util.cc
diff options
context:
space:
mode:
authorJude Brown <bookofjude@users.sourceforge.net>2010-01-16 18:48:09 +1000
committerJude Brown <bookofjude@users.sourceforge.net>2010-01-16 18:49:28 +1000
commit7423e92a652914c2085e76410d3dcbe914d59b6b (patch)
treedc0b9302d837195b74d1463d354def8278eab9dc /crawl-ref/source/mon-util.cc
parentdecb6b25c768d8e4ea0a2af37e5b4c699d86b036 (diff)
downloadcrawl-ref-7423e92a652914c2085e76410d3dcbe914d59b6b.tar.gz
crawl-ref-7423e92a652914c2085e76410d3dcbe914d59b6b.zip
Provide "waste of time" checks for Mislead, fake Mara summon, player ghost.
This moves the code out of the relevant functions and into the ms_waste_of_time function in mon-util.cc.
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r--crawl-ref/source/mon-util.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 0c47414cab..7821d0c1e8 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -21,7 +21,9 @@
#include "goditem.h"
#include "itemname.h"
#include "kills.h"
+#include "mislead.h"
#include "mon-behv.h"
+#include "mon-iter.h"
#include "mon-place.h"
#include "coord.h"
#include "mon-stuff.h"
@@ -2233,6 +2235,17 @@ static bool _beneficial_beam_flavour(beam_type flavour)
}
}
+// For SUMMON_PLAYER_GHOST.
+bool _find_players_ghost ()
+{
+ bool found = false;
+ for (monster_iterator mi; mi; ++mi)
+ if (mi->type == MONS_PLAYER_GHOST && mi->mname == you.your_name)
+ found = true;
+
+ return found;
+}
+
bool mons_should_fire(struct bolt &beam)
{
#ifdef DEBUG_DIAGNOSTICS
@@ -2582,6 +2595,25 @@ bool ms_waste_of_time( const monsters *mon, spell_type monspell )
break;
}
+ case SPELL_MISLEAD:
+ if (you.duration[DUR_MISLED] > 10 && one_chance_in(3))
+ ret = true;
+
+ break;
+
+ case SPELL_SUMMON_PLAYER_GHOST:
+ // Only ever want one at a time.
+ if (_find_players_ghost())
+ ret = true;
+
+ break;
+
+ case SPELL_FAKE_MARA_SUMMON:
+ if (count_mara_fakes() == 2)
+ ret = true;
+
+ break;
+
case SPELL_NO_SPELL:
ret = true;
break;