summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.cc
diff options
context:
space:
mode:
authorNicholas Feinberg <pleasingfung@gmail.com>2014-07-25 23:34:03 -0700
committerNicholas Feinberg <pleasingfung@gmail.com>2014-07-25 23:34:03 -0700
commitabea293a62c99dfa66bc3b3947e472c134a77fe6 (patch)
tree2424bd44d15ee8be7964e9355d4387876a5dabaa /crawl-ref/source/player.cc
parent97ab1de69b8c3bc7317c6ff0717fdbd564c50c1a (diff)
downloadcrawl-ref-abea293a62c99dfa66bc3b3947e472c134a77fe6.tar.gz
crawl-ref-abea293a62c99dfa66bc3b3947e472c134a77fe6.zip
Make ranged weapon delay display properly on @
It only works if you have the appropriate projectile type quivered (otherwise it shows you as if using the weapon in melee, i.e. breadswing speed), but that's still an improvement. Also, constify.
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc22
1 files changed, 14 insertions, 8 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index ad50d699d2..59debfe31f 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -4067,19 +4067,25 @@ static const char* _attack_delay_desc(int attack_delay)
"blindingly fast";
}
+/**
+ * Print a message indicating the player's attack delay with their current
+ * weapon & quivered ammo (if applicable).
+ *
+ * Uses melee attack delay for ranged weapons if no appropriate ammo is
+ * is quivered, purely for simplicity of implementation; XXX fix this
+ */
static void _display_attack_delay()
{
- const int delay = you.attack_delay(you.weapon(), NULL, false, false);
+ const item_def* ammo = NULL;
+ you.m_quiver->get_desired_item(&ammo, NULL);
+ const bool uses_ammo = ammo && you.weapon()
+ && ammo->sub_type == fires_ammo_type(*you.weapon());
+ const int delay = you.attack_delay(you.weapon(), uses_ammo ? ammo : NULL,
+ false, false);
// Scale to fit the displayed weapon base delay, i.e.,
// normal speed is 100 (as in 100%).
- int avg;
- // FIXME for new ranged combat
-/* const item_def* weapon = you.weapon();
- if (weapon && is_range_weapon(*weapon))
- avg = launcher_final_speed(*weapon, you.shield(), false);
- else */
- avg = 10 * delay;
+ int avg = 10 * delay;
// Haste shouldn't be counted, but let's show finesse.
if (you.duration[DUR_FINESSE])