diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-03-13 19:38:07 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-03-13 19:38:07 +0000 |
commit | ac47f23453abed6f2b26174bd01121cb033f59a5 (patch) | |
tree | 967e9514f2616b9f7ebf5511507056be450ee7b5 /crawl-ref/source/spells2.cc | |
parent | 0dcc48ebb807e4216d2a1a7d0c3fa1f68636cef6 (diff) | |
download | crawl-ref-ac47f23453abed6f2b26174bd01121cb033f59a5.tar.gz crawl-ref-ac47f23453abed6f2b26174bd01121cb033f59a5.zip |
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
Diffstat (limited to 'crawl-ref/source/spells2.cc')
-rw-r--r-- | crawl-ref/source/spells2.cc | 22 |
1 files 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); |