diff options
-rw-r--r-- | src/localplayer.cpp | 11 |
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; |