diff options
author | David Lawrence Ramsey <dolorous@users.sourceforge.net> | 2009-11-05 16:12:18 -0600 |
---|---|---|
committer | David Lawrence Ramsey <dolorous@users.sourceforge.net> | 2009-11-05 16:13:54 -0600 |
commit | 8906a6bb5c2f1caca99203876ed2657a1e818437 (patch) | |
tree | bbe95429bd7a47d42ab6fb5e52537796e8973f17 /crawl-ref/source/monster.cc | |
parent | b11642c2114307bb2cb26cfdcc09707d5f390fc2 (diff) | |
download | crawl-ref-8906a6bb5c2f1caca99203876ed2657a1e818437.tar.gz crawl-ref-8906a6bb5c2f1caca99203876ed2657a1e818437.zip |
In is_evil(), mark monsters with explicitly evil spells.
Unify checks for monsters with chaotic spells, and do the same for them.
Diffstat (limited to 'crawl-ref/source/monster.cc')
-rw-r--r-- | crawl-ref/source/monster.cc | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index 2bb73f9683..21b8efb4db 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -2702,6 +2702,24 @@ bool monsters::has_spells() const return (false); } +bool monsters::has_evil_spells() const +{ + for (int i = 0; i < NUM_MONSTER_SPELL_SLOTS; ++i) + if (is_evil_spell(spells[i])) + return (true); + + return (false); +} + +bool monsters::has_chaotic_spells() const +{ + for (int i = 0; i < NUM_MONSTER_SPELL_SLOTS; ++i) + if (is_chaotic_spell(spells[i])) + return (true); + + return (false); +} + bool monsters::has_spell(spell_type spell) const { for (int i = 0; i < NUM_MONSTER_SPELL_SLOTS; ++i) @@ -2858,6 +2876,9 @@ bool monsters::is_evil() const if (is_priest() && (is_evil_god(god) || god == GOD_NAMELESS)) return (true); + if (has_evil_spells()) + return (true); + if (mons_class_flag(type, M_EVIL)) return (true); @@ -2883,12 +2904,8 @@ bool monsters::is_chaotic() const if (is_priest() && is_chaotic_god(god)) return (true); - if (has_spell(SPELL_POLYMORPH_OTHER) - || has_spell(SPELL_SUMMON_UGLY_THING) - || has_spell(SPELL_PORKALATOR)) - { + if (has_chaotic_spells()) return (true); - } if (has_attack_flavour(AF_MUTATE) || has_attack_flavour(AF_ROT) |