diff options
author | Adam Borowski <kilobyte@angband.pl> | 2013-10-19 19:35:59 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2013-10-19 19:38:47 +0200 |
commit | bd08a7f36084fd8693cd2350724f3ca1641f827e (patch) | |
tree | 98fc4221a1c8d26aefa3b52c9ff8a8418000a43e /crawl-ref/source/godcompanions.cc | |
parent | 6f9563e63611233e76847de1851333e564826800 (diff) | |
download | crawl-ref-bd08a7f36084fd8693cd2350724f3ca1641f827e.tar.gz crawl-ref-bd08a7f36084fd8693cd2350724f3ca1641f827e.zip |
Unify some duplicated monster regen code.
Note that for some reason monsters that get recalled with Beogh's/Yred's
ability get healed ten times as fast as they would normally. This doesn't
strike me as intentional.
Diffstat (limited to 'crawl-ref/source/godcompanions.cc')
-rw-r--r-- | crawl-ref/source/godcompanions.cc | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/crawl-ref/source/godcompanions.cc b/crawl-ref/source/godcompanions.cc index e8f05a1ad0..83b6b83a25 100644 --- a/crawl-ref/source/godcompanions.cc +++ b/crawl-ref/source/godcompanions.cc @@ -147,17 +147,11 @@ bool recall_offlevel_ally(mid_t mid) you.moveto(coord_def(0, 0)); int turns = you.elapsed_time - comp->timestamp; - if (mons_can_regenerate(mons)) - { - if (mons_class_fast_regen(mons->type)) - mons->heal(turns); - else - { - const int regen_rate = - max(mons_natural_regen_rate(mons) * 2, 5); - mons->heal(div_rand_round(turns * regen_rate, 50)); - } - } + // Note: these are auts, not turns, thus healing is 10 times as fast as + // for other monsters, confusion goes away after a single turn, etc. + + mons->heal(div_rand_round(turns * mons_off_level_regen_rate(mons), 100)); + if (turns >= 10 && mons->alive()) { // Remove confusion manually (so that the monster |