diff options
author | Adam Borowski <kilobyte@angband.pl> | 2010-09-24 18:04:59 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2010-09-24 18:04:59 +0200 |
commit | 814b9ad73495075be2883e09c37c9d54b10199b7 (patch) | |
tree | 516e582dc92a9d4f113d955b821152fd5aa751cc /crawl-ref/source/fineff.cc | |
parent | 14e952c988dda42938131fc1d922facccd914a95 (diff) | |
download | crawl-ref-814b9ad73495075be2883e09c37c9d54b10199b7.tar.gz crawl-ref-814b9ad73495075be2883e09c37c9d54b10199b7.zip |
Reduce spam when getting hit by multiple attacks while praying to Yred.
This also reduces the piety cost in that case somewhat.
It should also protect against crashes or DEAD MONSTER messages in some
obscure cases (and potentially introduce other bugs...).
Diffstat (limited to 'crawl-ref/source/fineff.cc')
-rw-r--r-- | crawl-ref/source/fineff.cc | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/crawl-ref/source/fineff.cc b/crawl-ref/source/fineff.cc index 45547341cc..116da6331e 100644 --- a/crawl-ref/source/fineff.cc +++ b/crawl-ref/source/fineff.cc @@ -6,10 +6,13 @@ */ #include "AppHdr.h" +#include <math.h> #include "effects.h" #include "env.h" #include "fineff.h" #include "ouch.h" +#include "religion.h" +#include "view.h" void add_final_effect(final_effect_flavour flavour, const actor *attacker, @@ -79,14 +82,28 @@ void fire_final_effects() conduct_electricity(fe.pos, attacker); break; case FINEFF_MIRROR_DAMAGE: - if (!attacker) - continue; + if (!attacker || attacker == defender || !attacker->alive()) + continue; // defender being dead is ok, if we killed them we still suffer if (attacker->atype() == ACT_PLAYER) { mpr("It reflects your damage back at you!"); ouch(fe.x, NON_MONSTER, KILLED_BY_REFLECTION); } + else if (defender->atype() == ACT_PLAYER) + { + simple_god_message(" mirrors your injury!"); +#ifndef USE_TILE + flash_monster_colour(attacker->as_monster(), RED, 200); +#endif + + attacker->hurt(&you, fe.x); + + if (attacker->alive()) + print_wounds(attacker->as_monster()); + + lose_piety(ceil(sqrt((float)fe.x))); + } else { simple_monster_message(attacker->as_monster(), |