diff options
Diffstat (limited to 'crawl-ref/source/ouch.cc')
-rw-r--r-- | crawl-ref/source/ouch.cc | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index 06e68a04ae..0dee66ba27 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -678,26 +678,34 @@ void drain_exp(bool announce_full) return; } - unsigned long total_exp = exp_needed( you.experience_level + 2 ) - - exp_needed( you.experience_level + 1 ); + unsigned long total_exp = exp_needed(you.experience_level + 2) + - exp_needed(you.experience_level + 1); unsigned long exp_drained = (total_exp * (10 + random2(11))) / 100; + unsigned long pool_drained = std::min(exp_drained, + (unsigned long)you.exp_available); // TSO's protection. if (you.religion == GOD_SHINING_ONE && you.piety > protection * 50) { unsigned long undrained = std::min(exp_drained, - (you.piety * exp_drained) / 150); + (you.piety * exp_drained) / 150); + unsigned long pool_undrained = std::min(pool_drained, + (you.piety * pool_drained) / 150); - if (undrained > 0) + if (undrained > 0 || pool_undrained > 0) { simple_god_message(" protects your life force!"); - exp_drained -= undrained; + if (undrained > 0) + exp_drained -= undrained; + if (pool_undrained > 0) + pool_drained -= pool_undrained; } } else if (protection > 0) { canned_msg(MSG_YOU_PARTIALLY_RESIST); exp_drained -= (protection * exp_drained) / 3; + pool_drained -= (protection * pool_drained) / 3; } if (exp_drained > 0) @@ -705,12 +713,13 @@ void drain_exp(bool announce_full) mpr("You feel drained."); xom_is_stimulated(20); you.experience -= exp_drained; - you.exp_available -= exp_drained; + you.exp_available -= pool_drained; you.exp_available = std::max(0, you.exp_available); #if DEBUG_DIAGNOSTICS - mprf(MSGCH_DIAGNOSTICS, "You lose %ld experience points.",exp_drained); + mprf(MSGCH_DIAGNOSTICS, "You lose %ld experience points, %ld from pool.", + exp_drained, pool_drained); #endif you.redraw_experience = true; |