diff options
author | Neil Moore <neil@s-z.org> | 2013-08-10 04:10:35 -0400 |
---|---|---|
committer | Neil Moore <neil@s-z.org> | 2013-08-10 04:27:53 -0400 |
commit | b8a0f35253dacce58825d5b1536a45bc47dfcc37 (patch) | |
tree | c5a5a810675b0304054bd614557793259860e5d0 /crawl-ref/source/fight.cc | |
parent | a9403497d928c93c25626c3bdae52a4c67972ae4 (diff) | |
download | crawl-ref-b8a0f35253dacce58825d5b1536a45bc47dfcc37.tar.gz crawl-ref-b8a0f35253dacce58825d5b1536a45bc47dfcc37.zip |
Refactor out finesse delay adjustment code.
As a side effect, make the one case that used /= 2 (namely,
launcher_final_speed()) use div_round_rand() like the others.
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r-- | crawl-ref/source/fight.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 0c92d7ca2e..ffcc381049 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -464,3 +464,16 @@ void attack_cleave_targets(actor* attacker, list<actor*> &targets, targets.pop_front(); } } + +int finesse_adjust_delay(int delay) +{ + if (you.duration[DUR_FINESSE]) + { + ASSERT(!you.duration[DUR_BERSERK]); + // Need to undo haste by hand. + if (you.duration[DUR_HASTE]) + delay = haste_mul(delay); + delay = div_rand_round(delay, 2); + } + return delay; +} |