diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-02 21:57:41 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-02 21:57:41 +0000 |
commit | a3a8c0f837972ec556dc6a89b411603953344da0 (patch) | |
tree | e18e7c5d0b60b01a49e48bb6ffe959db21d07c69 /crawl-ref/source/mon-util.cc | |
parent | 72760b7751173d389735f6f129f92ef5963b1adc (diff) | |
download | crawl-ref-a3a8c0f837972ec556dc6a89b411603953344da0.tar.gz crawl-ref-a3a8c0f837972ec556dc6a89b411603953344da0.zip |
Add res_rotting() method to the actor class so that the "are you the right
type of undead to resist rotting" logic can be in just one place instead
of duplicated every time the check is made.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6354 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r-- | crawl-ref/source/mon-util.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index d5f1a9ad71..5f4748cb0d 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -4548,6 +4548,11 @@ int monsters::res_negative_energy() const return (mons_res_negative_energy(this)); } +int monsters::res_rotting() const +{ + return (mons_holiness(this) == MH_NATURAL ? 0 : 1); +} + flight_type monsters::flight_mode() const { return (mons_flies(this)); @@ -4634,7 +4639,7 @@ int monsters::hurt(const actor *agent, int amount) void monsters::rot(actor *agent, int rotlevel, int immed_rot) { - if (mons_holiness(this) != MH_NATURAL) + if (res_rotting() > 0) return; // Apply immediate damage because we can't handle rotting for monsters yet. |