summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monster.cc
diff options
context:
space:
mode:
authorDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-11-01 10:10:02 -0600
committerDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-11-01 10:10:59 -0600
commita0de356f3d007e58152f257212ed13d8b44fdfc0 (patch)
treef58fc43277e2f4fcb5f99ef57b51eeeef05a9905 /crawl-ref/source/monster.cc
parent7e8ebade4e8c0001439b89f333174f9443b74eb0 (diff)
downloadcrawl-ref-a0de356f3d007e58152f257212ed13d8b44fdfc0.tar.gz
crawl-ref-a0de356f3d007e58152f257212ed13d8b44fdfc0.zip
Move checks for a player or monster's being chaotic into another
convenience function in the actor interface.
Diffstat (limited to 'crawl-ref/source/monster.cc')
-rw-r--r--crawl-ref/source/monster.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index 637fb3c078..b6fc7c0bd1 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -2776,6 +2776,28 @@ bool monsters::is_unholy() const
return (holi == MH_UNDEAD || holi == MH_DEMONIC);
}
+bool monsters::is_chaotic() const
+{
+ if (type == MONS_UGLY_THING || type == MONS_VERY_UGLY_THING)
+ return (true);
+
+ if (mons_is_shapeshifter(this))
+ return (true);
+
+ if (has_spell(SPELL_POLYMORPH_OTHER))
+ return (true);
+
+ if (has_attack_flavour(AF_MUTATE)
+ || has_attack_flavour(AF_ROT)
+ || has_attack_flavour(AF_CHAOS)
+ || has_attack_flavour(AF_KLOWN))
+ {
+ return (true);
+ }
+
+ return (false);
+}
+
int monsters::res_fire() const
{
const mon_resist_def res = get_mons_resists(this);