summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-04-30 23:02:27 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-04-30 23:19:39 +0200
commitf84906fd493fe77a0f6591afb167ee62c9315506 (patch)
tree6fa149d9d37446b8e53504c080245e760c3be0b8 /src
parentb75f3328363940e630a030964036813236fe17bd (diff)
downloadmana-f84906fd493fe77a0f6591afb167ee62c9315506.tar.gz
mana-f84906fd493fe77a0f6591afb167ee62c9315506.tar.bz2
mana-f84906fd493fe77a0f6591afb167ee62c9315506.tar.xz
mana-f84906fd493fe77a0f6591afb167ee62c9315506.zip
Fix attack speed on both servers.
Currently, we actually receive the local player attack speed in milliseconds for tA. Yet, we don't support receiving the attack speed for other beings, so the old behaviour will remain for them until someone adds that. As for Manaserv, we're only using the default speed atm. Most urgent part of mana-mantis: #343. Reviewed-by: Thorbjorn.
Diffstat (limited to 'src')
-rw-r--r--src/localplayer.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 34f58988..bc041def 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -823,11 +823,18 @@ void LocalPlayer::attack(Being *target, bool keep)
if (mAction != STAND && mAction != ATTACK)
return;
- mKeepAttacking = keep;
-
if (!target || target->getType() == ActorSprite::NPC)
return;
+ // Can't attack more times than its attack speed
+ static int lastAttackTime = 0;
+ if (get_elapsed_time(lastAttackTime) < mAttackSpeed)
+ return;
+
+ lastAttackTime = tick_time;
+
+ mKeepAttacking = keep;
+
if (mTarget != target || !mTarget)
{
mLastTarget = -1;