diff options
author | Vsevolod Kozlov <zaba@thorium.homeunix.org> | 2009-11-10 16:48:44 +0300 |
---|---|---|
committer | Vsevolod Kozlov <zaba@thorium.homeunix.org> | 2009-11-10 16:48:44 +0300 |
commit | 54ccf63c382d3e27c7165ee57a721929dc45f77c (patch) | |
tree | 50084e3a093d19b7826ea54834d4d3a5db2e3153 /crawl-ref/source/monstuff.cc | |
parent | 672df2f6a49ff8683255e5bad316674d16285f0c (diff) | |
download | crawl-ref-54ccf63c382d3e27c7165ee57a721929dc45f77c.tar.gz crawl-ref-54ccf63c382d3e27c7165ee57a721929dc45f77c.zip |
Make actor::heal return bool; move heal_monster to monsters::heal.
monsters::heal and heal_monster used to have slightly different logic for
increasing maximum HP. Now the heal_monster logic is used everywhere.
player::heal always returns true at the moment, but since its return value is
never checked, that does not affect anything.
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r-- | crawl-ref/source/monstuff.cc | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index d8e71794f8..9cee1e134a 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -1982,8 +1982,7 @@ int monster_die(monsters *monster, killer_type killer, { simple_monster_message(killer_mon, " looks invigorated."); - heal_monster(killer_mon, - 1 + random2(monster->hit_dice / 4), false); + killer_mon->heal(1 + random2(monster->hit_dice / 4)); } } @@ -3508,42 +3507,6 @@ unsigned int monster_index(const monsters *monster) return (monster - menv.buffer()); } -bool heal_monster(monsters * patient, int health_boost, - bool permit_growth) -{ - if (mons_is_statue(patient->type)) - return (false); - - if (health_boost < 1) - return (false); - else if (!permit_growth && patient->hit_points == patient->max_hit_points) - return (false); - - patient->hit_points += health_boost; - - bool success = true; - - if (patient->hit_points > patient->max_hit_points) - { - if (permit_growth) - { - const monsterentry* m = get_monster_data(patient->type); - const int maxhp = - m->hpdice[0] * (m->hpdice[1] + m->hpdice[2]) + m->hpdice[3]; - - // Limit HP growth. - if (random2(3 * maxhp) > 2 * patient->max_hit_points) - patient->max_hit_points++; - else - success = false; - } - - patient->hit_points = patient->max_hit_points; - } - - return (success); -} - void seen_monster(monsters *monster) { // If the monster is in the auto_exclude list, automatically |