From beb469a9f1450e99042798eebeb1d23a4c45311b Mon Sep 17 00:00:00 2001 From: dshaligram Date: Sun, 4 Mar 2007 11:05:55 +0000 Subject: When untransforming, player's hp is scaled back down by the same amount it was scaled up. We should eventually clean up the transform system like 4.1 does. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@978 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/transfor.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/crawl-ref/source/transfor.cc b/crawl-ref/source/transfor.cc index c456a48b15..eed691ff5f 100644 --- a/crawl-ref/source/transfor.cc +++ b/crawl-ref/source/transfor.cc @@ -387,6 +387,8 @@ void untransform(void) you.attribute[ ATTR_TRANSFORMATION ] = TRAN_NONE; you.duration[ DUR_TRANSFORMATION ] = 0; + int hp_downscale = 10; + switch (old_form) { case TRAN_SPIDER: @@ -411,6 +413,9 @@ void untransform(void) if (you.duration[DUR_STONESKIN]) you.duration[DUR_STONESKIN] = 1; + + hp_downscale = 15; + break; case TRAN_ICE_BEAST: @@ -420,6 +425,9 @@ void untransform(void) // but the reverse isn't true. -- bwr if (you.duration[DUR_ICY_ARMOUR]) you.duration[DUR_ICY_ARMOUR] = 1; + + hp_downscale = 12; + break; case TRAN_DRAGON: @@ -428,6 +436,9 @@ void untransform(void) // re-check terrain now that be may no longer be flying. move_player_to_grid( you.x_pos, you.y_pos, false, true, true ); + + hp_downscale = 16; + break; case TRAN_LICH: @@ -444,6 +455,7 @@ void untransform(void) case TRAN_SERPENT_OF_HELL: mpr( "Your transformation has ended.", MSGCH_DURATION ); modify_stat(STAT_STRENGTH, -13, true); + hp_downscale = 17; break; } @@ -459,6 +471,14 @@ void untransform(void) } calc_hp(); + if (hp_downscale != 10) + { + you.hp = you.hp * 10 / hp_downscale; + if (you.hp < 1) + you.hp = 1; + else if (you.hp > you.hp_max) + you.hp = you.hp_max; + } } // end untransform() // XXX: This whole system is a mess as it still relies on special -- cgit v1.2.3-54-g00ecf