summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/ouch.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-08 22:28:31 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-08 22:28:31 +0000
commitff184229db597309592f1efc2ff089fa1b79418a (patch)
tree8cf5d9bf90c203ab836b843f41c4ea3a6bd377a3 /crawl-ref/source/ouch.cc
parentb28cc614475b181e7ef8d9b4380acf2cece353c6 (diff)
downloadcrawl-ref-ff184229db597309592f1efc2ff089fa1b79418a.tar.gz
crawl-ref-ff184229db597309592f1efc2ff089fa1b79418a.zip
Implement [2147458]. Using Robert's patch (adjusted for trunk), improve
low levels of life protection by treating experience pool draining similarly to experience level draining. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7199 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/ouch.cc')
-rw-r--r--crawl-ref/source/ouch.cc23
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;