Skip to content

Commit

Permalink
Merge pull request #126 from diegorodriguesvieira/master
Browse files Browse the repository at this point in the history
Fix attack speed extra delay
fix #103
  • Loading branch information
peonso authored Feb 17, 2017
2 parents fe237dc + ff439c5 commit 1dc53ad
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions source/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
}
Expand Down

0 comments on commit 1dc53ad

Please sign in to comment.