summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/ouch.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-20 23:55:11 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-20 23:55:11 +0000
commitb30aacda1fd2b82ae1436f3ac24e3c588d8209d1 (patch)
tree01c5bfe35c39b802a258983dff4233edfa28e7cd /crawl-ref/source/ouch.cc
parent47dd86930dcbbe92a989a3f049887b8ae47412d5 (diff)
downloadcrawl-ref-b30aacda1fd2b82ae1436f3ac24e3c588d8209d1.tar.gz
crawl-ref-b30aacda1fd2b82ae1436f3ac24e3c588d8209d1.zip
Smooth out TSO's draining protection to work with fractional piety for
both the raw damage and the experience loss. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3312 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/ouch.cc')
-rw-r--r--crawl-ref/source/ouch.cc29
1 files changed, 27 insertions, 2 deletions
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index dd2678b970..ebe78389ad 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -187,7 +187,18 @@ int check_your_resists(int hurted, beam_type flavour)
case BEAM_NEG:
resist = player_prot_life();
- if (resist > 0)
+ // TSO's protection
+ if (you.religion == GOD_SHINING_ONE && you.piety > resist * 50)
+ {
+ int unhurted = (you.piety * hurted) / 150;
+
+ if (unhurted > hurted)
+ unhurted = hurted;
+
+ if (unhurted > 0)
+ hurted -= unhurted;
+ }
+ else if (resist > 0)
hurted -= (resist * hurted) / 3;
drain_exp();
@@ -630,7 +641,21 @@ void drain_exp(bool announce_full)
exp_drained /= 100;
- if (protection > 0)
+ // TSO's protection
+ if (you.religion == GOD_SHINING_ONE && you.piety > protection * 50)
+ {
+ unsigned long undrained = (you.piety * exp_drained) / 150;
+
+ if (undrained > exp_drained)
+ undrained = exp_drained;
+
+ if (undrained > 0)
+ {
+ simple_god_message(" protects your life force!");
+ exp_drained -= undrained;
+ }
+ }
+ else if (protection > 0)
{
mpr("You partially resist.");
exp_drained -= (protection * exp_drained) / 3;