summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/ouch.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-21 17:26:20 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-21 17:26:20 +0000
commit164413a87b0544768389c91b9ae6e833ecabb6ef (patch)
tree7e0435a9cdefba5d6e2526feffb8d0296eccf570 /crawl-ref/source/ouch.cc
parent33652ed46d6663adcc4b4c5233dc7083746431d0 (diff)
downloadcrawl-ref-164413a87b0544768389c91b9ae6e833ecabb6ef.tar.gz
crawl-ref-164413a87b0544768389c91b9ae6e833ecabb6ef.zip
Implement reliable protection from harm for Elyvilon (available under
prayer at high enough piety, but with a significant piety cost). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7898 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/ouch.cc')
-rw-r--r--crawl-ref/source/ouch.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index 2779920550..2bdda4bf10 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -850,10 +850,20 @@ void ouch(int dam, int death_source, kill_method_type death_type,
if (dam != INSTANT_DEATH) // that is, a "death" caused by hp loss {dlb}
{
- if (dam >= you.hp && god_protects_from_harm(you.religion))
+ if (dam >= you.hp)
{
- simple_god_message(" protects you from harm!");
- return;
+ if (harm_protection_type hpt = god_protects_from_harm(you.religion))
+ {
+ simple_god_message(" protects you from harm!");
+
+ if (you.duration[DUR_PRAYER]
+ && hpt == HPT_RELIABLE_PRAYING_PLUS_ANYTIME)
+ {
+ lose_piety(21 + random2(20));
+ }
+
+ return;
+ }
}
dec_hp(dam, true);