diff options
author | gammafunk <gammafunk@gmail.com> | 2014-03-17 20:10:33 -0500 |
---|---|---|
committer | gammafunk <gammafunk@gmail.com> | 2014-03-18 00:16:40 -0500 |
commit | a18227ede66e02d668551662e35476ed00ef7e13 (patch) | |
tree | 7f6fca6ea4bf53148232bacfc35698eef069b604 /crawl-ref/source/misc.cc | |
parent | fbd6e7ded89bf1ad2ebe2393fe0c11dd2e298bd0 (diff) | |
download | crawl-ref-a18227ede66e02d668551662e35476ed00ef7e13.tar.gz crawl-ref-a18227ede66e02d668551662e35476ed00ef7e13.zip |
Clean up the player hp change and calculation functions
Move calc_hp() to player.cc, and fix all but a couple instances where
you.hp is changed directly to use set_hp() instead. We'll eventually
just move these functions to inline methods for the player class, but
this reorganization will do for now.
Diffstat (limited to 'crawl-ref/source/misc.cc')
-rw-r--r-- | crawl-ref/source/misc.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 71aaa1054f..d2d0332822 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -1306,6 +1306,15 @@ bool scramble(void) return you.burden < (max_carry / 2) + random2(max_carry / 2); } +/** + * Make the player go berserk! + * @param intentional If true, this was initiated by the player, and additional + * messages can be printed if we can't berserk. + * @param potion If true, this was caused by the player quaffing !berserk; + * and we get the same additional messages as when + * intentional is true. + * @returns True if we went berserk, false otherwise. + */ bool go_berserk(bool intentional, bool potion) { ASSERT(!crawl_state.game_is_arena()); @@ -1362,7 +1371,7 @@ bool go_berserk(bool intentional, bool potion) you.increase_duration(DUR_BERSERK, berserk_duration); calc_hp(); - you.hp = you.hp * 3 / 2; + set_hp(you.hp * 3 / 2); deflate_hp(you.hp_max, false); |