From ac47f23453abed6f2b26174bd01121cb033f59a5 Mon Sep 17 00:00:00 2001 From: dolorous Date: Fri, 13 Mar 2009 19:38:07 +0000 Subject: Refix [2686002]: Vampiric draining, if it successfully damages a monster, will now always restore a minimum of 1 HP. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9434 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/spells2.cc | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index e730a7a7a8..6c52094cb7 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -757,26 +757,30 @@ bool vampiric_drain(int pow, const dist &vmove) } // The practical maximum of this is about 25 (pow @ 100). -- bwr - int inflicted = 3 + random2avg(9, 2) + random2(pow) / 7; + int hp_gain = 3 + random2avg(9, 2) + random2(pow) / 7; - inflicted = std::min(monster->hit_points, inflicted); - inflicted = std::min(you.hp_max - you.hp, inflicted); + hp_gain = std::min(monster->hit_points, hp_gain); + hp_gain = std::min(you.hp_max - you.hp, hp_gain); - if (inflicted == 0) + if (hp_gain == 0) { canned_msg(MSG_NOTHING_HAPPENS); return (false); } - mprf("You feel life coursing from %s into your body!", - monster->name(DESC_NOCAP_THE).c_str()); - - monster->hurt(&you, inflicted); + monster->hurt(&you, hp_gain); if (monster->alive()) print_wounds(monster); - inc_hp(inflicted / 2, false); + hp_gain /= 2; + + if (hp_gain) + { + mprf("You feel life coursing from %s into your body!", + monster->name(DESC_NOCAP_THE).c_str()); + inc_hp(hp_gain, false); + } } return (success); -- cgit v1.2.3-54-g00ecf