summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/describe.cc9
-rw-r--r--crawl-ref/source/fight.cc10
-rw-r--r--crawl-ref/source/ouch.cc7
-rw-r--r--crawl-ref/source/religion.cc28
-rw-r--r--crawl-ref/source/religion.h1
5 files changed, 47 insertions, 8 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 139baab67e..10232ec6dc 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -3144,6 +3144,15 @@ void describe_god( god_type which_god, bool give_title )
cprintf("You can call upon %s to destroy weapons "
"lying on the ground." EOL, god_name(which_god).c_str());
}
+ else if (which_god == GOD_YREDELEMNUL)
+ {
+ have_any = true;
+ if (!player_under_penance() && you.piety >= piety_breakpoint(0))
+ {
+ cprintf("%s mirrors your injuries on your foes "
+ "during prayer." EOL, god_name(which_god).c_str());
+ }
+ }
// mv: No abilities (except divine protection) under penance
if (!player_under_penance())
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index e8e77072a4..a824eb64c5 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -3971,8 +3971,12 @@ void melee_attack::mons_perform_attack_rounds()
defender->hurt(attacker, damage_done + special_damage);
- if (!defender->alive() || attacker == defender)
+ // Yredelemnul's injury mirroring can kill the attacker.
+ if (!attacker->alive() || !defender->alive()
+ || attacker == defender)
+ {
return;
+ }
special_damage = 0;
special_damage_message.clear();
@@ -3983,6 +3987,10 @@ void melee_attack::mons_perform_attack_rounds()
if (special_damage > 0)
defender->hurt(attacker, special_damage);
+
+ // Yredelemnul's injury mirroring can kill the attacker.
+ if (!attacker->alive())
+ return;
}
item_def *weap = atk->mslot_item(MSLOT_WEAPON);
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index a01ddcfa0c..145ee6d316 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -848,6 +848,13 @@ 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]
+ && death_source != 0 && !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 1db10e13e9..7e4de96d0b 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -719,6 +719,27 @@ void dec_penance(int val)
dec_penance(you.religion, val);
}
+void yred_mirror_injury(monsters *mon, int dam)
+{
+ if (dam <= 0)
+ return;
+
+ simple_god_message(" mirrors your injury!");
+
+#ifndef USE_TILE
+ flash_monster_colour(mon, RED, 200);
+#endif
+
+ hurt_monster(mon, dam);
+
+ if (mon->hit_points < 1)
+ monster_die(mon, KILL_YOU, 0);
+ else
+ print_wounds(mon);
+
+ lose_piety(integer_sqrt(dam));
+}
+
bool beogh_water_walk()
{
return (you.religion == GOD_BEOGH && !player_under_penance()
@@ -5568,13 +5589,6 @@ harm_protection_type god_protects_from_harm(god_type god, bool actual)
// the player from harm, but doesn't actually do so.
switch (god)
{
- case GOD_YREDELEMNUL:
- if (!actual || praying)
- {
- if (you.piety >= min_piety)
- return HPT_PRAYING;
- }
- break;
case GOD_BEOGH:
if (!penance && (!actual || anytime))
return HPT_ANYTIME;
diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h
index 03e30ce72e..bab2a8cfef 100644
--- a/crawl-ref/source/religion.h
+++ b/crawl-ref/source/religion.h
@@ -94,6 +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 beogh_water_walk();
void beogh_idol_revenge();
void good_god_holy_attitude_change(monsters *holy);