summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-util.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-09-20 14:19:42 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-09-20 14:19:42 +0000
commit1db426b1b8d3fcfa2122dee47290597bcd63ee91 (patch)
tree360ef66174eed525363b0b5b07a59d9ba2be2831 /crawl-ref/source/mon-util.cc
parent913179f028b4a254eb5034ef6ce945d07ac5925a (diff)
downloadcrawl-ref-1db426b1b8d3fcfa2122dee47290597bcd63ee91.tar.gz
crawl-ref-1db426b1b8d3fcfa2122dee47290597bcd63ee91.zip
Add monster-specific rotting resistance.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10740 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r--crawl-ref/source/mon-util.cc24
1 files changed, 17 insertions, 7 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index a4394ac806..8bc73d39f9 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -1368,6 +1368,14 @@ int mons_res_sticky_flame(const monsters *mon)
return (res);
}
+int mons_res_rotting(const monsters *mon)
+{
+ int res = get_mons_resists(mon).rotting;
+ if (mons_holiness(mon) != MH_NATURAL)
+ res += 1;
+ return (res);
+}
+
int mons_res_steam(const monsters *mon)
{
int res = get_mons_resists(mon).steam;
@@ -6055,6 +6063,11 @@ int monsters::res_sticky_flame() const
return (mons_res_sticky_flame(this));
}
+int monsters::res_rotting() const
+{
+ return (mons_res_rotting(this));
+}
+
int monsters::res_holy_energy(const actor *attacker) const
{
if (mons_is_evil(this))
@@ -6080,11 +6093,6 @@ 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);
-}
-
int monsters::res_torment() const
{
const mon_holy_type holy = mons_holiness(this);
@@ -9265,7 +9273,7 @@ std::string get_mon_shape_str(const mon_body_shape shape)
mon_resist_def::mon_resist_def()
: elec(0), poison(0), fire(0), steam(0), cold(0), hellfire(0),
- asphyx(0), acid(0), sticky_flame(false), pierce(0),
+ asphyx(0), acid(0), sticky_flame(false), rotting(false), pierce(0),
slice(0), bludgeon(0)
{
}
@@ -9288,7 +9296,7 @@ short mon_resist_def::get_default_res_level(int resist, short level) const
mon_resist_def::mon_resist_def(int flags, short level)
: elec(0), poison(0), fire(0), steam(0), cold(0), hellfire(0),
- asphyx(0), acid(0), sticky_flame(false), pierce(0),
+ asphyx(0), acid(0), sticky_flame(false), rotting(false), pierce(0),
slice(0), bludgeon(0)
{
for (int i = 0; i < 32; ++i)
@@ -9323,6 +9331,7 @@ mon_resist_def::mon_resist_def(int flags, short level)
case MR_VUL_BLUDGEON: bludgeon = -nl; break;
case MR_RES_STICKY_FLAME: sticky_flame = true; break;
+ case MR_RES_ROTTING: rotting = true; break;
default: break;
}
@@ -9342,6 +9351,7 @@ const mon_resist_def &mon_resist_def::operator |= (const mon_resist_def &o)
slice += o.slice;
bludgeon += o.bludgeon;
sticky_flame = sticky_flame || o.sticky_flame;
+ rotting = rotting || o.rotting;
return (*this);
}