diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-09-30 05:04:29 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-09-30 05:04:29 +0000 |
commit | e9c49344ae30fe4e976bb4695c4c0d22d0af802d (patch) | |
tree | 0faf92a084d51be5d633ac39c5b17d77ba002548 /crawl-ref/source/ouch.cc | |
parent | b638f0eb21f238ce8f143f09d0d99effb3cff497 (diff) | |
download | crawl-ref-e9c49344ae30fe4e976bb4695c4c0d22d0af802d.tar.gz crawl-ref-e9c49344ae30fe4e976bb4695c4c0d22d0af802d.zip |
Consolidate and clean up Yred's injury mirroring routines.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7073 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/ouch.cc')
-rw-r--r-- | crawl-ref/source/ouch.cc | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index 7bb59beb1f..0495e0faa9 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -790,6 +790,32 @@ static void _xom_checks_damage(kill_method_type death_type, xom_is_stimulated(amusementvalue); } +static void _yred_mirrors_injury(int dam, int death_source) +{ + if (dam <= 0 || invalid_monster_index(death_source)) + return; + + if (yred_injury_mirror() && you.duration[DUR_PRAYER]) + { + simple_god_message(" mirrors your injury!"); + + monsters *mon = &menv[death_source]; + +#ifndef USE_TILE + flash_monster_colour(mon, RED, 200); +#endif + + hurt_monster(mon, dam); + + if (mon->hit_points < 1) + monster_die(mon, KILL_YOU, NON_MONSTER); + else + print_wounds(mon); + + lose_piety(integer_sqrt(dam)); + } +} + // death_source should be set to NON_MONSTER for non-monsters. {dlb} void ouch(int dam, int death_source, kill_method_type death_type, const char *aux, bool see_source) @@ -848,8 +874,7 @@ 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 (!invalid_monster_index(death_source)) - yred_mirror_injury(&menv[death_source], dam); + _yred_mirrors_injury(dam, death_source); return; } // else hp <= 0 |