diff options
author | David Lawrence Ramsey <dolorous@users.sourceforge.net> | 2009-11-10 21:12:28 -0600 |
---|---|---|
committer | David Lawrence Ramsey <dolorous@users.sourceforge.net> | 2009-11-10 22:04:08 -0600 |
commit | 42876e1c49d03e594d7d129bd96fd9874ebe0106 (patch) | |
tree | e87fb003057c93dd3d10f195efd5b2d69a324c9d /crawl-ref/source | |
parent | 46a9a48fae192feb0ee6440bee0623a8c026163c (diff) | |
download | crawl-ref-42876e1c49d03e594d7d129bd96fd9874ebe0106.tar.gz crawl-ref-42876e1c49d03e594d7d129bd96fd9874ebe0106.zip |
Add actor::undead_or_demonic() to check for those holiness types.
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/actor.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/monster.cc | 7 | ||||
-rw-r--r-- | crawl-ref/source/monster.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/player.cc | 7 | ||||
-rw-r--r-- | crawl-ref/source/player.h | 1 |
5 files changed, 17 insertions, 0 deletions
diff --git a/crawl-ref/source/actor.h b/crawl-ref/source/actor.h index 1bd4c2cfe8..97bae34914 100644 --- a/crawl-ref/source/actor.h +++ b/crawl-ref/source/actor.h @@ -185,6 +185,7 @@ public: virtual int mons_species() const = 0; virtual mon_holy_type holiness() const = 0; + virtual bool undead_or_demonic() const = 0; virtual bool is_holy() const = 0; virtual bool is_unholy() const = 0; virtual bool is_evil() const = 0; diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index ae61c51364..e102e81615 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -2981,6 +2981,13 @@ mon_holy_type monsters::holiness() const return (mons_class_holiness(type)); } +bool monsters::undead_or_demonic() const +{ + const mon_holy_type holi = holiness(); + + return (holi == MH_UNDEAD || holi == MH_DEMONIC); +} + bool monsters::is_holy() const { if (holiness() == MH_HOLY) diff --git a/crawl-ref/source/monster.h b/crawl-ref/source/monster.h index 84a351e774..2f76628541 100644 --- a/crawl-ref/source/monster.h +++ b/crawl-ref/source/monster.h @@ -297,6 +297,7 @@ public: int mons_species() const; mon_holy_type holiness() const; + bool undead_or_demonic() const; bool is_holy() const; bool is_unholy() const; bool is_evil() const; diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 6dc93fb6f4..c3e79c0cfd 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -6363,6 +6363,13 @@ mon_holy_type player::holiness() const return (MH_NATURAL); } +bool player::undead_or_demonic() const +{ + const mon_holy_type holi = holiness(); + + return (holi == MH_UNDEAD || holi == MH_DEMONIC); +} + bool player::is_holy() const { if (is_good_god(religion)) diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index 3f19574b95..900d6bb52f 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -439,6 +439,7 @@ public: int mons_species() const; mon_holy_type holiness() const; + bool undead_or_demonic() const; bool is_holy() const; bool is_unholy() const; bool is_evil() const; |