summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/fight.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-20 22:53:13 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-20 22:53:13 +0000
commit8e6aed77dcf612ec06f14c8ad8f79d83d813ac5b (patch)
tree46b6b0d5cc01cc5e17bd77e47addf3508432855c /crawl-ref/source/fight.cc
parent28b0d8ccf5840100bb223502ae19951c859d84b6 (diff)
downloadcrawl-ref-8e6aed77dcf612ec06f14c8ad8f79d83d813ac5b.tar.gz
crawl-ref-8e6aed77dcf612ec06f14c8ad8f79d83d813ac5b.zip
Clean up rotting in melee attacks to not kill the target directly and to
use special_damage_msg, as with draining. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8636 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r--crawl-ref/source/fight.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index cf96b82527..d1556307a8 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -2082,6 +2082,21 @@ void melee_attack::drain_defender()
}
}
+void melee_attack::rot_defender(int amount, int immediate)
+{
+ if (defender->rot(attacker, amount, immediate, true))
+ {
+ if (defender->atype() == ACT_MONSTER && defender_visible)
+ {
+ special_damage_message =
+ make_stringf(
+ "%s %s!",
+ def_name(DESC_CAP_THE).c_str(),
+ amount > 0 ? "rots" : "looks less resilient");
+ }
+ }
+}
+
bool melee_attack::distortion_affects_defender()
{
//jmf: blink frogs *like* distortion
@@ -4298,7 +4313,7 @@ void melee_attack::mons_apply_attack_flavour(const mon_attack_def &attk)
case AF_ROT:
if (one_chance_in(20) || (damage_done > 2 && one_chance_in(3)))
- defender->rot(attacker, 2 + random2(3), damage_done > 5 ? 1 : 0);
+ rot_defender(2 + random2(3), damage_done > 5 ? 1 : 0);
break;
case AF_DISEASE:
@@ -4401,7 +4416,7 @@ void melee_attack::mons_apply_attack_flavour(const mon_attack_def &attk)
{
if (defender->atype() == ACT_PLAYER)
mprf("You feel less resilient.");
- defender->rot(attacker, 0, coinflip() ? 2 : 1);
+ rot_defender(0, coinflip() ? 2 : 1);
}
}
break;