diff options
author | elliptic <hyperelliptical@gmail.com> | 2014-04-07 13:55:04 -0400 |
---|---|---|
committer | elliptic <hyperelliptical@gmail.com> | 2014-04-07 13:56:46 -0400 |
commit | da4a0999e32825c045062dfcbb2887e6dd0bc3e3 (patch) | |
tree | fae492efd30f8394c1be5955a218928bf33c4205 | |
parent | d827497410ed5daaedc76ef5a7811998f3c3b6e1 (diff) | |
download | crawl-ref-da4a0999e32825c045062dfcbb2887e6dd0bc3e3.tar.gz crawl-ref-da4a0999e32825c045062dfcbb2887e6dd0bc3e3.zip |
Let @ (and lua) display negative values for poison_survival().
So that players have a way of guessing whether heal wounds might be enough
to survive.
-rw-r--r-- | crawl-ref/source/output.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/player.cc | 8 | ||||
-rw-r--r-- | crawl-ref/source/status.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/tileweb.cc | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index da0e4c117c..1eaf30be46 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -701,7 +701,7 @@ static void _print_stats_hp(int x, int y) EP_Bar.draw(19, y, you.hp, you.hp_max); else #endif - HP_Bar.draw(19, y, you.hp, you.hp_max, false, you.hp - poison_survival()); + HP_Bar.draw(19, y, you.hp, you.hp_max, false, you.hp - max(0, poison_survival())); } static short _get_stat_colour(stat_type stat) diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index e05f3efa90..606f167ed7 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -5308,14 +5308,14 @@ bool poison_is_lethal() return get_player_poisoning(); if (get_player_poisoning() < you.hp) return false; - return !poison_survival(); + return (poison_survival() <= 0); } // Try to predict the minimum value of the player's health in the coming // turns given the current poison amount and regen rate. int poison_survival() { - if (!get_player_poisoning() || you.hp <= 0) + if (!get_player_poisoning()) return you.hp; const int rr = player_regen(); const bool chei = (you.religion == GOD_CHEIBRIADOS && you.piety >= piety_breakpoint(0)); @@ -5340,7 +5340,7 @@ int poison_survival() if (rr == 0) { - return max(0, min(you.hp, you.hp - amount / 1000 + regen_beats_poison / 1000)); + return min(you.hp, you.hp - amount / 1000 + regen_beats_poison / 1000); } // Calculate the amount of time until regen starts to beat poison. @@ -5374,7 +5374,7 @@ int poison_survival() prediction1 -= (amount / 1000 - test_amount1 / 1000 - (predicted_regen - 1)); prediction2 -= (amount / 1000 - test_amount2 / 1000 - predicted_regen); - return max(0, min(prediction1, prediction2)); + return min(prediction1, prediction2); } bool miasma_player(string source, string source_aux) diff --git a/crawl-ref/source/status.cc b/crawl-ref/source/status.cc index ff6ce8404c..565aa140a6 100644 --- a/crawl-ref/source/status.cc +++ b/crawl-ref/source/status.cc @@ -831,7 +831,7 @@ static void _describe_regen(status_info* inf) static void _describe_poison(status_info* inf) { int pois_perc = (you.hp <= 0) ? 100 - : ((you.hp - poison_survival()) * 100 / you.hp); + : ((you.hp - max(0, poison_survival())) * 100 / you.hp); inf->light_colour = (player_res_poison(false) >= 3 ? DARKGREY : _bad_ench_colour(pois_perc, 35, 100)); inf->light_text = "Pois"; diff --git a/crawl-ref/source/tileweb.cc b/crawl-ref/source/tileweb.cc index ba82c81771..665ff680a9 100644 --- a/crawl-ref/source/tileweb.cc +++ b/crawl-ref/source/tileweb.cc @@ -733,7 +733,7 @@ void TilesFramework::_send_player(bool force_full) _update_int(force_full, c.mp, you.magic_points, "mp"); _update_int(force_full, c.mp_max, you.max_magic_points, "mp_max"); #endif - _update_int(force_full, c.poison_survival, poison_survival(), + _update_int(force_full, c.poison_survival, max(0, poison_survival()), "poison_survival"); if (you.species == SP_LAVA_ORC) |