diff --git a/source/player.cpp b/source/player.cpp index 77d09b067..398e3bffd 100644 --- a/source/player.cpp +++ b/source/player.cpp @@ -3727,15 +3727,14 @@ void Player::doAttacking(uint32_t interval) Item* tool = getWeapon(); bool result = false; const Weapon* weapon = g_weapons->getWeapon(tool); + uint32_t delay = getAttackSpeed(); + if(weapon){ if(!weapon->interruptSwing()){ result = weapon->useWeapon(this, tool, attackedCreature); } else if(!canDoAction()){ - uint32_t delay = getNextActionTime(); - SchedulerTask* task = createSchedulerTask(delay, boost::bind(&Game::checkCreatureAttack, - &g_game, getID())); - setNextActionTask(task); + delay = getNextActionTime(); } else { // If the player is not exhausted OR if the player's weapon @@ -3750,6 +3749,10 @@ void Player::doAttacking(uint32_t interval) result = Weapon::useFist(this, attackedCreature); } + SchedulerTask* task = createSchedulerTask(SCHEDULER_MINTICKS, boost::bind(&Game::checkCreatureAttack, + &g_game, getID())); + setNextActionTask(task); + if(result){ lastAttack = OTSYS_TIME(); }