diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 53efc6a206..3ab698c7ed 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -94,8 +94,8 @@ class TC_GAME_API Creature : public Unit, public GridObject, public Ma CreatureMovementData const& GetMovementTemplate() const; bool CanWalk() const { return GetMovementTemplate().IsGroundAllowed(); } bool CanSwim() const override { return GetMovementTemplate().IsSwimAllowed() || IsPet(); } - bool CanFly() const override { return GetMovementTemplate().IsFlightAllowed(); } - bool CanHover() const { return GetMovementTemplate().Ground == CreatureGroundMovementType::Hover; } + bool CanFly() const override { return GetMovementTemplate().IsFlightAllowed() || IsFlying() || IsGravityDisabled(); }; + bool CanHover() const { return GetMovementTemplate().Ground == CreatureGroundMovementType::Hover || IsHovering(); }; bool IsDungeonBoss() const { return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_DUNGEON_BOSS) != 0; } bool IsAffectedByDiminishingReturns() const override { return Unit::IsAffectedByDiminishingReturns() || (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH) != 0; } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 1d060b651e..a1c1ad266f 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -14377,7 +14377,7 @@ bool Unit::SetDisableGravity(bool disable, bool packetOnly /*= false*/) { if (!packetOnly) { - if (disable == IsLevitating()) + if (disable == IsGravityDisabled()) return false; if (disable) @@ -14454,7 +14454,7 @@ bool Unit::SetCanFly(bool enable, bool packetOnly) } else { - if (IsFlying() && !IsLevitating()) + if (IsFlying() && !IsGravityDisabled()) SetFall(true); RemoveUnitMovementFlag(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_MASK_MOVING_FLY); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 5b2653f631..5039fb3283 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1344,7 +1344,7 @@ class TC_GAME_API Unit : public WorldObject void SendSetPlayHoverAnim(bool enable); void SendMovementSetSplineAnim(Movement::AnimType anim); - bool IsLevitating() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY); } + bool IsGravityDisabled() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY); } bool IsWalking() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING); } bool IsHovering() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_HOVER); } bool SetWalk(bool enable); diff --git a/src/server/game/Movement/PathGenerator.cpp b/src/server/game/Movement/PathGenerator.cpp index 6350e38338..33000f7144 100644 --- a/src/server/game/Movement/PathGenerator.cpp +++ b/src/server/game/Movement/PathGenerator.cpp @@ -180,7 +180,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con { TC_LOG_DEBUG("maps.mmaps", "++ BuildPolyPath :: (startPoly == 0 || endPoly == 0)"); BuildShortcut(); - bool path = _source->GetTypeId() == TYPEID_UNIT && _source->ToCreature()->IsFlying(); + bool path = _source->GetTypeId() == TYPEID_UNIT && _source->ToCreature()->CanFly(); bool waterPath = _source->GetTypeId() == TYPEID_UNIT && _source->ToCreature()->CanSwim(); if (waterPath) @@ -234,7 +234,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con TC_LOG_DEBUG("maps.mmaps", "++ BuildPolyPath :: flying case"); if (const Unit* _sourceUnit = _source->ToUnit()) { - if (_sourceUnit->IsFlying()) + if (_sourceUnit->CanFly()) buildShotrcut = true; // Allow to build a shortcut if the unit is falling and it's trying to move downwards towards a target (i.e. charging) else if (_sourceUnit->IsFalling() && endPos.z < startPos.z) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 86f19a3be5..8f54ff9f62 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -2737,7 +2737,7 @@ void AuraEffect::HandleAuraAllowFlight(AuraApplication const* aurApp, uint8 mode target->SetCanFly(apply); - if (!apply && target->GetTypeId() == TYPEID_UNIT && !target->IsLevitating()) + if (!apply && target->GetTypeId() == TYPEID_UNIT && !target->IsGravityDisabled()) target->GetMotionMaster()->MoveFall(); } @@ -3097,7 +3097,7 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const* aurApp, { target->SetCanFly(apply); - if (!apply && target->GetTypeId() == TYPEID_UNIT && !target->IsLevitating()) + if (!apply && target->GetTypeId() == TYPEID_UNIT && !target->IsGravityDisabled()) target->GetMotionMaster()->MoveFall(); }