summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monster.cc
diff options
context:
space:
mode:
authorDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-11-10 21:30:42 -0600
committerDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-11-10 22:04:09 -0600
commitd209dced6edfec770b03610e54a2836fb2bc0f30 (patch)
tree131c8f4bddb17dad5ab719bfdb7d8f825d52f4d7 /crawl-ref/source/monster.cc
parent219ce41e6713bcdf4432f977a1fce0c770cee348 (diff)
downloadcrawl-ref-d209dced6edfec770b03610e54a2836fb2bc0f30.tar.gz
crawl-ref-d209dced6edfec770b03610e54a2836fb2bc0f30.zip
Properly split up unholy and evil items, reworking is_(unholy|evil)().
This is mainly for Fedhas, who hates the latter but not the former.
Diffstat (limited to 'crawl-ref/source/monster.cc')
-rw-r--r--crawl-ref/source/monster.cc19
1 files changed, 16 insertions, 3 deletions
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.