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/xom.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/xom.cc')
-rw-r--r-- | crawl-ref/source/xom.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index 3c0f422c49..3d9c00add9 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -1859,7 +1859,7 @@ static int _xom_throw_divine_lightning(bool debug = false) if (you.escaped_death_cause == KILLED_BY_WILD_MAGIC && you.escaped_death_aux == "Xom's lightning strike") { - you.hp = 1; + set_hp(1); you.reset_escaped_death(); } @@ -3647,7 +3647,7 @@ static void _handle_accidental_death(const int orig_hp, } if (pre_mut_hp <= 0) - you.hp = min(orig_hp, you.hp_max); + set_hp(min(orig_hp, you.hp_max)); for (int i = 0; i < 3; ++i) { @@ -3998,7 +3998,7 @@ bool xom_saves_your_life(const int dam, const int death_source, // Give back some hp. if (you.hp < 1) - you.hp = 1 + random2(you.hp_max/4); + set_hp(1 + random2(you.hp_max/4)); // Make sure all stats are at least 1. // XXX: This could lead to permanent stat gains. |