fix(Core/Spells): Volley should suspend auto-shot. (#12596)

This commit is contained in:
UltraNix
2022-08-06 02:07:03 +02:00
committed by GitHub
parent 1288539b58
commit e2c4c5a5dc
+11 -2
View File
@@ -464,6 +464,7 @@ void Unit::Update(uint32 p_time)
// xinef: if attack time > 0, reduce by diff // xinef: if attack time > 0, reduce by diff
// if on next update, attack time < 0 assume player didnt attack - set to 0 // if on next update, attack time < 0 assume player didnt attack - set to 0
bool suspendAttackTimer = false; bool suspendAttackTimer = false;
bool suspendRangedAttackTimer = false;
if (IsPlayer() && HasUnitState(UNIT_STATE_CASTING)) if (IsPlayer() && HasUnitState(UNIT_STATE_CASTING))
{ {
for (Spell* spell : m_currentSpells) for (Spell* spell : m_currentSpells)
@@ -472,6 +473,11 @@ void Unit::Update(uint32 p_time)
{ {
if (spell->GetSpellInfo()->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS)) if (spell->GetSpellInfo()->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS))
{ {
if (spell->IsChannelActive())
{
suspendRangedAttackTimer = true;
}
suspendAttackTimer = true; suspendAttackTimer = true;
break; break;
} }
@@ -492,9 +498,12 @@ void Unit::Update(uint32 p_time)
} }
} }
if (int32 ranged_attack = getAttackTimer(RANGED_ATTACK)) if (!suspendRangedAttackTimer)
{ {
setAttackTimer(RANGED_ATTACK, ranged_attack > 0 ? ranged_attack - (int32) p_time : 0); if (int32 ranged_attack = getAttackTimer(RANGED_ATTACK))
{
setAttackTimer(RANGED_ATTACK, ranged_attack > 0 ? ranged_attack - (int32)p_time : 0);
}
} }
// update abilities available only for fraction of time // update abilities available only for fraction of time