From a0de356f3d007e58152f257212ed13d8b44fdfc0 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Sun, 1 Nov 2009 10:10:02 -0600 Subject: Move checks for a player or monster's being chaotic into another convenience function in the actor interface. --- crawl-ref/source/monster.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'crawl-ref/source/monster.cc') 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); -- cgit v1.2.3-54-g00ecf