summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/actor.cc
diff options
context:
space:
mode:
authorNicholas Feinberg <pleasingfung@gmail.com>2014-07-25 21:48:12 -0700
committerNicholas Feinberg <pleasingfung@gmail.com>2014-07-25 21:50:26 -0700
commitf054a6457fa0f54580893607c794b7356a9fa5f8 (patch)
treeabab95239f37583619af1e92a7926403f4848cd4 /crawl-ref/source/actor.cc
parenta02710520930951c3f3b6685483d157d3b32bfcb (diff)
downloadcrawl-ref-f054a6457fa0f54580893607c794b7356a9fa5f8.tar.gz
crawl-ref-f054a6457fa0f54580893607c794b7356a9fa5f8.zip
Make torpor snail slow end immediately after LOS is broken
Or after they die, etc. Also no longer require the torpor snail to be visible, thus preventing powerful /invis secret tech. rip :(
Diffstat (limited to 'crawl-ref/source/actor.cc')
-rw-r--r--crawl-ref/source/actor.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/crawl-ref/source/actor.cc b/crawl-ref/source/actor.cc
index 54d1c3edde..4a422c8224 100644
--- a/crawl-ref/source/actor.cc
+++ b/crawl-ref/source/actor.cc
@@ -1,6 +1,7 @@
#include "AppHdr.h"
#include <sstream>
+#include "act-iter.h"
#include "actor.h"
#include "areas.h"
#include "artefact.h"
@@ -13,6 +14,7 @@
#include "libutil.h"
#include "los.h"
#include "misc.h"
+#include "mon-abil.h"
#include "mon-death.h"
#include "ouch.h"
#include "player.h"
@@ -799,3 +801,32 @@ string actor::describe_props() const
}
return oss.str();
}
+
+/**
+ * Is the actor currently being slowed by a torpor snail?
+ */
+bool actor::torpor_slowed() const
+{
+ if (!props.exists(TORPOR_SLOWED_KEY) || is_sanctuary(pos())
+ || is_stationary()
+ || (is_monster() && this->as_monster()->check_stasis(true))
+ || (!is_monster() && stasis()))
+ {
+ return false;
+ }
+
+ for (monster_near_iterator ri(pos(), LOS_SOLID_SEE); ri; ++ri)
+ {
+ const monster *mons = *ri;
+ if (mons && mons->type == MONS_TORPOR_SNAIL
+ && !is_sanctuary(mons->pos())
+ && !mons_aligned(mons, this)
+ && !mons->has_ench(ENCH_CHARM) && mons->attitude == ATT_HOSTILE)
+ // friendly torpor snails are way too abusable otherwise :(
+ {
+ return true;
+ }
+ }
+
+ return false;
+}