summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--crawl-ref/source/describe.cc14
-rw-r--r--crawl-ref/source/ouch.cc29
-rw-r--r--crawl-ref/source/player.cc6
3 files changed, 35 insertions, 14 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index dd8ee451f4..0f2141a89d 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -2527,15 +2527,13 @@ void describe_god( god_type which_god, bool give_title )
else if (which_god == GOD_SHINING_ONE)
{
have_any = true;
- if (you.piety >= 50)
- {
- const char *how = (you.piety >= 150) ? "carefully" : // l.p. 3
- (you.piety >= 100) ? "often" :
- "sometimes";
+ const char *how = (you.piety >= 150) ? "carefully" : // l.p. 3
+ (you.piety >= 100) ? "often" :
+ (you.piety >= 50) ? "sometimes" :
+ "occasionally";
- cprintf("%s %s protects your life force." EOL,
- god_name(which_god).c_str(), how);
- }
+ cprintf("%s %s shields you from negative energy." EOL,
+ god_name(which_god).c_str(), how);
}
else if (which_god == GOD_TROG)
{
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;
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 320cce9ef6..31d1755bd6 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -1601,10 +1601,8 @@ int player_prot_life(bool calc_unid)
pl += you.mutation[MUT_NEGATIVE_ENERGY_RESISTANCE];
// TSO's protection
- if (you.religion == GOD_SHINING_ONE)
- {
- pl += you.piety / 50;
- }
+ if (you.religion == GOD_SHINING_ONE && you.piety > pl * 50)
+ pl = you.piety / 50;
if (pl > 3)
pl = 3;