primate
Member
I wish the attack will not stop when I'm moving.
Example;
https://gfycat.com/RashClearcutGannet
Thank you very much for your valuable time!
Example;
https://gfycat.com/RashClearcutGannet
Code:
void Player::doAttacking(uint32_t)
{
if (lastAttack == 0) {
lastAttack = OTSYS_TIME() - getAttackSpeed() - 1;
}
if (hasCondition(CONDITION_PACIFIED)) {
return;
}
if ((OTSYS_TIME() - lastAttack) >= getAttackSpeed()) {
bool result = false;
Item* tool = getWeapon();
const Weapon* weapon = g_weapons->getWeapon(tool);
if (weapon) {
result = weapon->useWeapon(this, tool, attackedCreature);
SchedulerTask* task = createSchedulerTask(getAttackSpeed(), std::bind(&Game::checkCreatureAttack, &g_game, getID()));
setNextActionTask(task);
} else {
result = Weapon::useFist(this, attackedCreature);
}
if (result) {
lastAttack = OTSYS_TIME();
}
}
}
Thank you very much for your valuable time!