From d209dced6edfec770b03610e54a2836fb2bc0f30 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Tue, 10 Nov 2009 21:30:42 -0600 Subject: Properly split up unholy and evil items, reworking is_(unholy|evil)(). This is mainly for Fedhas, who hates the latter but not the former. --- crawl-ref/source/monster.cc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'crawl-ref/source/monster.cc') diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index 14020cb7f3..ab8dc0dba3 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -2757,6 +2757,15 @@ bool monsters::has_holy_spell() const return (false); } +bool monsters::has_unholy_spell() const +{ + for (int i = 0; i < NUM_MONSTER_SPELL_SLOTS; ++i) + if (is_unholy_spell(spells[i])) + return (true); + + return (false); +} + bool monsters::has_evil_spell() const { for (int i = 0; i < NUM_MONSTER_SPELL_SLOTS; ++i) @@ -3005,14 +3014,18 @@ bool monsters::is_holy() const bool monsters::is_unholy() const { - const mon_holy_type holi = holiness(); + if (holiness() == MH_DEMONIC) + return (true); - return (holi == MH_UNDEAD || holi == MH_DEMONIC); + if (has_unholy_spell()) + return (true); + + return (false); } bool monsters::is_evil() const { - if (is_unholy()) + if (holiness() == MH_UNDEAD) return (true); // Assume that all unknown gods (GOD_NAMELESS) are evil. -- cgit v1.2.3-54-g00ecf