summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-goditem.cc
diff options
context:
space:
mode:
authorShmuale Mark <shm.mark@gmail.com>2014-06-19 16:05:04 -0400
committerShmuale Mark <shm.mark@gmail.com>2014-06-22 10:03:45 -0400
commit465957cba490a2a9d5444a64523572a90cfb837f (patch)
tree536c94ce0702e60217120aa2bb27325aff1b8f2d /crawl-ref/source/spl-goditem.cc
parent393eda0d444702a7eda580e6c363bbdcaba8d54e (diff)
downloadcrawl-ref-465957cba490a2a9d5444a64523572a90cfb837f.tar.gz
crawl-ref-465957cba490a2a9d5444a64523572a90cfb837f.zip
The great mon-stuff migration.
A good deal of functions move to the two new files, mon-poly and mon-message. Of the others, some go to where they are used, some to mon-util, and a few are made member methods of monster. This probably breaks Xcode compilation, and I'm not able to test the changes I made to MSVC that will (hopefully) keep it working.
Diffstat (limited to 'crawl-ref/source/spl-goditem.cc')
-rw-r--r--crawl-ref/source/spl-goditem.cc56
1 files changed, 55 insertions, 1 deletions
diff --git a/crawl-ref/source/spl-goditem.cc b/crawl-ref/source/spl-goditem.cc
index abc10d0baf..275a20138f 100644
--- a/crawl-ref/source/spl-goditem.cc
+++ b/crawl-ref/source/spl-goditem.cc
@@ -30,7 +30,6 @@
#include "mon-abil.h"
#include "mon-behv.h"
#include "mon-death.h"
-#include "mon-stuff.h"
#include "mon-util.h"
#include "options.h"
#include "random.h"
@@ -422,6 +421,61 @@ void antimagic()
contaminate_player(-1 * (1000 + random2(4000)));
}
+void debuff_monster(monster* mon)
+{
+ // List of magical enchantments which will be dispelled.
+ const enchant_type lost_enchantments[] =
+ {
+ ENCH_SLOW,
+ ENCH_HASTE,
+ ENCH_SWIFT,
+ ENCH_MIGHT,
+ ENCH_FEAR,
+ ENCH_CONFUSION,
+ ENCH_INVIS,
+ ENCH_CORONA,
+ ENCH_CHARM,
+ ENCH_PARALYSIS,
+ ENCH_PETRIFYING,
+ ENCH_PETRIFIED,
+ ENCH_REGENERATION,
+ ENCH_STICKY_FLAME,
+ ENCH_TP,
+ ENCH_INNER_FLAME,
+ ENCH_OZOCUBUS_ARMOUR
+ };
+
+ bool dispelled = false;
+
+ // Dispel all magical enchantments...
+ for (unsigned int i = 0; i < ARRAYSZ(lost_enchantments); ++i)
+ {
+ if (lost_enchantments[i] == ENCH_INVIS)
+ {
+ // ...except for natural invisibility.
+ if (mons_class_flag(mon->type, M_INVIS))
+ continue;
+ }
+ if (lost_enchantments[i] == ENCH_CONFUSION)
+ {
+ // Don't dispel permaconfusion.
+ if (mons_class_flag(mon->type, M_CONFUSED))
+ continue;
+ }
+ if (lost_enchantments[i] == ENCH_REGENERATION)
+ {
+ // Don't dispel regen if it's from Trog.
+ if (mon->has_ench(ENCH_RAISED_MR))
+ continue;
+ }
+
+ if (mon->del_ench(lost_enchantments[i], true, true))
+ dispelled = true;
+ }
+ if (dispelled)
+ simple_monster_message(mon, "'s magical effects unravel!");
+}
+
int detect_traps(int pow)
{
pow = min(50, pow);