From 06fba355d8d03c7df958e47e8e2ef191b52ad84d Mon Sep 17 00:00:00 2001 From: dolorous Date: Fri, 1 May 2009 00:10:47 +0000 Subject: Fix [2728128]: Properly scale current HP to maximum HP when changing levels. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9712 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/player.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index a6bb401b64..4f5f0a1346 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -2982,6 +2982,9 @@ void level_change(bool skip_attribute_increase) skip_more = true; } + const int old_hp = you.hp; + const int old_maxhp = you.hp_max; + int hp_adjust = 0; int mp_adjust = 0; @@ -3521,6 +3524,7 @@ void level_change(bool skip_attribute_increase) deflate_hp(you.hp_max, false); + you.hp = old_hp * you.hp_max / old_maxhp; you.magic_points = std::max(0, you.magic_points); // Get "real" values for note-taking, i.e. ignore Berserk, -- cgit v1.2.3-54-g00ecf