summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-09-30 04:29:25 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-09-30 04:29:25 +0000
commitb638f0eb21f238ce8f143f09d0d99effb3cff497 (patch)
tree295598c876e69ad690ccf73766340b888392f8a9 /crawl-ref/source
parentb3a157e60e8c01aae3827e35e49306d775ea85d1 (diff)
downloadcrawl-ref-b638f0eb21f238ce8f143f09d0d99effb3cff497.tar.gz
crawl-ref-b638f0eb21f238ce8f143f09d0d99effb3cff497.zip
Properly enforce the limitations of Yred's injury mirroring.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7072 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/ouch.cc6
-rw-r--r--crawl-ref/source/religion.cc28
-rw-r--r--crawl-ref/source/religion.h2
3 files changed, 20 insertions, 16 deletions
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index 1556b49e95..7bb59beb1f 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -848,12 +848,8 @@ void ouch(int dam, int death_source, kill_method_type death_type,
take_note(
Note(NOTE_HP_CHANGE, you.hp, you.hp_max, damage_desc.c_str()) );
- if (you.religion == GOD_YREDELEMNUL
- && you.duration[DUR_PRAYER]
- && !invalid_monster_index(death_source))
- {
+ if (!invalid_monster_index(death_source))
yred_mirror_injury(&menv[death_source], dam);
- }
return;
} // else hp <= 0
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 5ae27aea28..8900835a99 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -739,25 +739,33 @@ void dec_penance(int val)
dec_penance(you.religion, val);
}
-void yred_mirror_injury(monsters *mon, int dam)
+bool yred_mirror_injury(monsters *mon, int dam)
{
if (dam <= 0)
- return;
+ return (false);
- simple_god_message(" mirrors your injury!");
+ if (you.religion == GOD_YREDELEMNUL && you.duration[DUR_PRAYER]
+ && !player_under_penance() && you.piety >= piety_breakpoint(0))
+ {
+ simple_god_message(" mirrors your injury!");
#ifndef USE_TILE
- flash_monster_colour(mon, RED, 200);
+ flash_monster_colour(mon, RED, 200);
#endif
- hurt_monster(mon, dam);
+ hurt_monster(mon, dam);
- if (mon->hit_points < 1)
- monster_die(mon, KILL_YOU, NON_MONSTER);
- else
- print_wounds(mon);
+ if (mon->hit_points < 1)
+ monster_die(mon, KILL_YOU, NON_MONSTER);
+ else
+ print_wounds(mon);
- lose_piety(integer_sqrt(dam));
+ lose_piety(integer_sqrt(dam));
+
+ return (true);
+ }
+
+ return (false);
}
bool beogh_water_walk()
diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h
index 121924ffe6..86ebdc91bd 100644
--- a/crawl-ref/source/religion.h
+++ b/crawl-ref/source/religion.h
@@ -94,7 +94,7 @@ void god_smites_you(god_type god, const char *message = NULL,
kill_method_type death_type = NUM_KILLBY);
void divine_retribution(god_type god);
-void yred_mirror_injury(monsters *mon, int dam);
+bool yred_mirror_injury(monsters *mon, int dam);
bool beogh_water_walk();
void beogh_idol_revenge();
void good_god_holy_attitude_change(monsters *holy);