From 6cdd66c768ef483fcaec5f6b66bc1835b5797eda Mon Sep 17 00:00:00 2001 From: zelgadis Date: Thu, 22 Jan 2009 07:35:07 +0000 Subject: If death from stat loss is escaped via wizard mode then reset the stat to max, and don't reset HP to max HP. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8683 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/ouch.cc | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'crawl-ref/source/ouch.cc') diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index ca1954ef41..ea31b2e37c 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -816,6 +816,28 @@ static void _yred_mirrors_injury(int dam, int death_source) } } +static void _wizard_restore_life() +{ + if (you.hp <= 0) + set_hp(you.hp_max, false); + if (you.strength <= 0) + { + you.strength = you.max_strength; + you.redraw_strength = true; + } + if (you.dex <= 0) + { + you.dex = you.max_dex; + you.redraw_dexterity = true; + you.redraw_evasion = true; + } + if (you.intel <= 0) + { + you.intel = you.max_intel; + you.redraw_intelligence = true; + } +} + // 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) @@ -880,11 +902,11 @@ void ouch(int dam, int death_source, kill_method_type death_type, { damage_desc = scorefile_entry(dam, death_source, death_type, aux, true) - .death_description(scorefile_entry::DDV_TERSE); + .death_description(scorefile_entry::DDV_TERSE); } take_note( - Note(NOTE_HP_CHANGE, you.hp, you.hp_max, damage_desc.c_str()) ); + Note(NOTE_HP_CHANGE, you.hp, you.hp_max, damage_desc.c_str()) ); _yred_mirrors_injury(dam, death_source); @@ -951,7 +973,7 @@ void ouch(int dam, int death_source, kill_method_type death_type, { take_note(Note( NOTE_DEATH, you.hp, you.hp_max, death_desc.c_str()), true); - set_hp(you.hp_max, false); + _wizard_restore_life(); return; } #else // !def USE_OPTIONAL_WIZARD_DEATH @@ -960,7 +982,7 @@ void ouch(int dam, int death_source, kill_method_type death_type, take_note(Note( NOTE_DEATH, you.hp, you.hp_max, death_desc.c_str()), true); - set_hp(you.hp_max, false); + _wizard_restore_life(); return; #endif // USE_OPTIONAL_WIZARD_DEATH } -- cgit v1.2.3-54-g00ecf