summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/fight.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-01 10:44:11 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-01 10:44:11 +0000
commitd22abf31c5f56320e1ee6c5ff25a75b8bd09b6c0 (patch)
tree224891df1b503798e8826385261c3f825b4a7fd2 /crawl-ref/source/fight.cc
parent2b9197efde1c28e983c988def8f7d673f8699ebe (diff)
downloadcrawl-ref-d22abf31c5f56320e1ee6c5ff25a75b8bd09b6c0.tar.gz
crawl-ref-d22abf31c5f56320e1ee6c5ff25a75b8bd09b6c0.zip
Fixed vampiric healing on death using raw damage instead of actual damage, which produced super-healing for stabbing (jarpiain).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2283 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r--crawl-ref/source/fight.cc21
1 files changed, 11 insertions, 10 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 9bfc3ead91..4b033bb609 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -869,11 +869,7 @@ bool melee_attack::player_apply_aux_unarmed()
stab_bonus = 0;
aux_damage = player_apply_monster_ac(aux_damage);
- if (aux_damage < 1)
- aux_damage = 0;
- else
- hurt_monster(def, aux_damage);
-
+ aux_damage = hurt_monster(def, aux_damage);
damage_done = aux_damage;
if (damage_done > 0)
@@ -1437,7 +1433,7 @@ int melee_attack::player_weapon_type_modify(int damage)
bool melee_attack::player_hurt_monster()
{
- return damage_done && hurt_monster(def, damage_done);
+ return damage_done && (damage_done = hurt_monster(def, damage_done));
}
void melee_attack::player_exercise_combat_skills()
@@ -1480,14 +1476,20 @@ bool melee_attack::player_monattk_hit_effects(bool mondied)
if (mondied && damage_brand == SPWPN_VAMPIRICISM)
{
if (defender->holiness() == MH_NATURAL
- && damage_done > 0 && you.hp < you.hp_max
+ && damage_done > 0
+ && you.hp < you.hp_max
&& !one_chance_in(5))
{
mpr("You feel better.");
// more than if not killed
- int heal = 1 + random2(damage_done);
+ const int heal = 1 + random2(damage_done);
+#ifdef DEBUG_DIAGNOSTICS
+ mprf(MSGCH_DIAGNOSTICS,
+ "Vampiric healing: damage %d, healed %d",
+ damage_done, heal);
+#endif
inc_hp(heal, false);
if (you.hunger_state != HS_ENGORGED)
@@ -1525,8 +1527,7 @@ bool melee_attack::player_monattk_hit_effects(bool mondied)
if (needs_message && !special_damage_message.empty())
mprf("%s", special_damage_message.c_str());
-
- hurt_monster(def, special_damage);
+ special_damage = hurt_monster(def, special_damage);
if (def->hit_points < 1)
{