From a6d89fbabb631ecbdcbb86c59aa70c28fd7da696 Mon Sep 17 00:00:00 2001 From: dolorous Date: Sun, 18 Jan 2009 21:31:22 +0000 Subject: Consolidate the player and monster draining functions in fight.cc, make monster draining take multiple levels of negative energy resistance into account, and only set the necromancy conduct if draining actually took place, as with draining beams. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8551 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/ouch.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'crawl-ref/source/ouch.cc') diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index 2faca91b49..ca82412f81 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -636,7 +636,7 @@ void lose_level() xom_is_stimulated(255); } -void drain_exp(bool announce_full) +bool drain_exp(bool announce_full) { const int protection = player_prot_life(); @@ -644,20 +644,23 @@ void drain_exp(bool announce_full) { if (announce_full) canned_msg(MSG_YOU_RESIST); - return; + + return (false); } if (you.experience == 0) { ouch(INSTANT_DEATH, NON_MONSTER, KILLED_BY_DRAINING); + // Return in case death was escaped via wizard mode. - return; + return (true); } if (you.experience_level == 1) { you.experience = 0; - return; + + return (true); } unsigned long total_exp = exp_needed(you.experience_level + 2) @@ -708,7 +711,11 @@ void drain_exp(bool announce_full) if (you.experience < exp_needed(you.experience_level + 1)) lose_level(); + + return (true); } + + return (false); } static void _xom_checks_damage(kill_method_type death_type, -- cgit v1.2.3-54-g00ecf