summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells4.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/spells4.cc')
-rw-r--r--crawl-ref/source/spells4.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index ad6cdb8a78..5ac7df2a32 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -2041,3 +2041,29 @@ void cast_stoneskin(int pow)
if (you.duration[DUR_STONESKIN] > 50)
you.duration[DUR_STONESKIN] = 50;
}
+
+bool do_slow_monster(monsters* mon, kill_category whose_kill)
+{
+ // Try to remove haste, if monster is hasted.
+ if (mon->del_ench(ENCH_HASTE, true))
+ {
+ if (simple_monster_message(mon, " is no longer moving quickly."))
+ {
+ return true;
+ }
+ }
+
+ // Not hasted, slow it.
+ if (!mon->has_ench(ENCH_SLOW)
+ && !mons_is_stationary(mon)
+ && mon->add_ench(mon_enchant(ENCH_SLOW, 0, whose_kill)))
+ {
+ if (!mons_is_paralysed(mon) && !mons_is_petrified(mon)
+ && simple_monster_message(mon, " seems to slow down."))
+ {
+ return true;
+ }
+ }
+
+ return false;
+}