From b5ea5e1bc66f90cf3644dabac2d9c00697e68d4d Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Thu, 5 Nov 2009 14:51:19 -0600 Subject: Create an is_evil() function in the actor interface. Currently, only unholy monsters are marked as evil this way. --- crawl-ref/source/monster.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'crawl-ref/source/monster.cc') diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index f8ef9febe5..74fbdeb27d 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -2849,6 +2849,11 @@ mon_holy_type monsters::holiness() const return (mons_class_holiness(type)); } +bool monsters::is_evil() const +{ + return (is_unholy() || mons_class_flag(type, M_EVIL)); +} + bool monsters::is_unholy() const { const mon_holy_type holi = holiness(); @@ -3080,7 +3085,7 @@ int monsters::res_rotting() const int monsters::res_holy_energy(const actor *attacker) const { - if (mons_is_evil(this)) + if (is_evil()) return (-1); if (is_unholy()) -- cgit v1.2.3-54-g00ecf