fix(Core/Movement): properly handle UNIT_STATE_CHARGING (#7152)

- Closes #6065
- Closes #6669
This commit is contained in:
UltraNix
2021-08-05 13:55:11 +02:00
committed by GitHub
parent 7822a270ff
commit 36a1777b99
2 changed files with 13 additions and 6 deletions
@@ -29,6 +29,11 @@ void PointMovementGenerator<T>::DoInitialize(T* unit)
unit->StopMoving(); unit->StopMoving();
unit->AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); unit->AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE);
if (id == EVENT_CHARGE)
{
unit->AddUnitState(UNIT_STATE_CHARGING);
}
i_recalculateSpeed = false; i_recalculateSpeed = false;
Movement::MoveSplineInit init(unit); Movement::MoveSplineInit init(unit);
if (m_precomputedPath.size() > 2) // pussywizard: for charge if (m_precomputedPath.size() > 2) // pussywizard: for charge
@@ -131,6 +136,10 @@ template<class T>
void PointMovementGenerator<T>::DoFinalize(T* unit) void PointMovementGenerator<T>::DoFinalize(T* unit)
{ {
unit->ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); unit->ClearUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE);
if (id == EVENT_CHARGE)
{
unit->ClearUnitState(UNIT_STATE_CHARGING);
}
if (unit->movespline->Finalized()) if (unit->movespline->Finalized())
MovementInform(unit); MovementInform(unit);
@@ -143,6 +152,10 @@ void PointMovementGenerator<T>::DoReset(T* unit)
unit->StopMoving(); unit->StopMoving();
unit->AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE); unit->AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE);
if (id == EVENT_CHARGE)
{
unit->AddUnitState(UNIT_STATE_CHARGING);
}
} }
template<class T> template<class T>
-6
View File
@@ -5043,8 +5043,6 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
{ {
sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer()); sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer());
} }
m_caster->AddUnitState(UNIT_STATE_CHARGING);
} }
else else
{ {
@@ -5064,8 +5062,6 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
{ {
sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer()); sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer());
} }
m_caster->AddUnitState(UNIT_STATE_CHARGING);
} }
} }
@@ -5074,8 +5070,6 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
if (!unitTarget) if (!unitTarget)
return; return;
m_caster->ClearUnitState(UNIT_STATE_CHARGING);
if (m_caster->ToPlayer()) if (m_caster->ToPlayer())
{ {
sScriptMgr->AnticheatSetSkipOnePacketForASH(m_caster->ToPlayer(), true); sScriptMgr->AnticheatSetSkipOnePacketForASH(m_caster->ToPlayer(), true);