summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/throw.cc
diff options
context:
space:
mode:
authorSteve Melenchuk <smelenchuk@gmail.com>2014-04-16 21:08:32 -0600
committerSteve Melenchuk <smelenchuk@gmail.com>2014-04-27 17:02:33 -0600
commitfde016144d74dc363d43e65ef647e980391aeadc (patch)
tree49d3673f03e94bc9c7cd3d9e52233b11288cb366 /crawl-ref/source/throw.cc
parentec5b00754ba4caf6cd637a454de3f9989dd7ea0f (diff)
downloadcrawl-ref-fde016144d74dc363d43e65ef647e980391aeadc.tar.gz
crawl-ref-fde016144d74dc363d43e65ef647e980391aeadc.zip
Ranged weapon delay.
Moves the delay calculations into player and monster respectively so that it can properly be done at the start of the ranged attack; it doesn't make sense to have them in attack or ranged_attack.
Diffstat (limited to 'crawl-ref/source/throw.cc')
-rw-r--r--crawl-ref/source/throw.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/crawl-ref/source/throw.cc b/crawl-ref/source/throw.cc
index f1489991ce..4b82e57846 100644
--- a/crawl-ref/source/throw.cc
+++ b/crawl-ref/source/throw.cc
@@ -848,6 +848,9 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
did_return = true;
}
+ you.time_taken = finesse_adjust_delay(you.attack_delay(you.weapon(),
+ &item));
+
// Create message.
mprf("%s %s%s %s.",
teleport ? "Magically, you" : "You",
@@ -987,8 +990,17 @@ bool mons_throw(monster* mons, bolt &beam, int msl, bool teleport)
ASSERT(slot != NUM_MONSTER_SLOTS);
// Energy is already deducted for the spell cast, if using portal projectile
+ // FIXME: should it use this delay and not the spell delay?
if (!teleport)
- mons->lose_energy(EUT_MISSILE);
+ {
+ const int energy = mons->action_energy(EUT_MISSILE);
+ const int delay = mons->attack_delay(weapon != NON_ITEM ? &mitm[weapon]
+ : NULL,
+ &mitm[msl]);
+ ASSERT(energy > 0);
+ ASSERT(delay > 0);
+ mons->speed_increment -= div_rand_round(energy * delay, 10);
+ }
actor* victim = actor_at(beam.target);
const int old_hp = (victim) ? victim->stat_hp() : 0;