Core/Movement: properly fix aura interrupts during movement

Port From (https://github.com/TrinityCore/TrinityCore/commit/43a7091e8a86179e195e2bc021133ce751d48d48)
This commit is contained in:
hondacrx
2022-01-06 10:24:20 -05:00
parent 923a993f1e
commit 8c71ecf0b2
4 changed files with 42 additions and 5 deletions
+14 -5
View File
@@ -600,13 +600,8 @@ namespace Game.Entities
Math.Abs(GetPositionY() - y) > 0.001f ||
Math.Abs(GetPositionZ() - z) > 0.001f);
if (turn)
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Turning);
if (relocated)
{
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Moving);
// move and update visible state if need
if (IsTypeId(TypeId.Player))
GetMap().PlayerRelocation(ToPlayer(), x, y, z, orientation);
@@ -618,6 +613,9 @@ namespace Game.Entities
UpdatePositionData();
_positionUpdateInfo.Relocated = relocated;
_positionUpdateInfo.Turned = turn;
bool isInWater = IsInWater();
if (!IsFalling() || isInWater || IsFlying())
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2.Ground);
@@ -1741,6 +1739,17 @@ namespace Game.Entities
UpdatePosition(loc.X, loc.Y, loc.Z, loc.W);
}
void InterruptMovementBasedAuras()
{
// TODO: Check if orientation transport offset changed instead of only global orientation
if (_positionUpdateInfo.Turned)
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Turning);
if (_positionUpdateInfo.Relocated && !GetVehicle())
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.Moving);
}
public void DisableSpline()
{
m_movementInfo.RemoveMovementFlag(MovementFlag.Forward);