mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Auras: Implement SPELL_AURA_DISABLE_GRAVITY (#30365)
This commit is contained in:
@@ -24574,7 +24574,7 @@ void Player::SendInitialPacketsAfterAddToMap()
|
||||
if (HasAuraType(SPELL_AURA_HOVER))
|
||||
setCompoundState.StateChanges.emplace_back(SMSG_MOVE_SET_HOVERING, m_movementCounter++);
|
||||
|
||||
if (HasAuraType(SPELL_AURA_MOD_ROOT_DISABLE_GRAVITY) || HasAuraType(SPELL_AURA_MOD_STUN_DISABLE_GRAVITY))
|
||||
if (HasAuraType(SPELL_AURA_MOD_ROOT_DISABLE_GRAVITY) || HasAuraType(SPELL_AURA_MOD_STUN_DISABLE_GRAVITY) || HasAuraType(SPELL_AURA_DISABLE_GRAVITY))
|
||||
setCompoundState.StateChanges.emplace_back(SMSG_MOVE_DISABLE_GRAVITY, m_movementCounter++);
|
||||
|
||||
if (HasAuraType(SPELL_AURA_CAN_TURN_WHILE_FALLING))
|
||||
|
||||
@@ -579,7 +579,7 @@ enum AuraType : uint32
|
||||
SPELL_AURA_MOD_MOVEMENT_FORCE_MAGNITUDE = 485,
|
||||
SPELL_AURA_486 = 486,
|
||||
SPELL_AURA_COSMETIC_MOUNTED = 487,
|
||||
SPELL_AURA_488 = 488,
|
||||
SPELL_AURA_DISABLE_GRAVITY = 488,
|
||||
SPELL_AURA_MOD_ALTERNATIVE_DEFAULT_LANGUAGE = 489,
|
||||
SPELL_AURA_490 = 490,
|
||||
SPELL_AURA_491 = 491,
|
||||
|
||||
@@ -557,7 +557,7 @@ NonDefaultConstructible<pAuraEffectHandler> AuraEffectHandler[TOTAL_AURAS]=
|
||||
&AuraEffect::HandleModMovementForceMagnitude, //485 SPELL_AURA_MOD_MOVEMENT_FORCE_MAGNITUDE
|
||||
&AuraEffect::HandleNULL, //486
|
||||
&AuraEffect::HandleCosmeticMounted, //487 SPELL_AURA_COSMETIC_MOUNTED
|
||||
&AuraEffect::HandleNULL, //488
|
||||
&AuraEffect::HandleAuraDisableGravity, //488 SPELL_AURA_DISABLE_GRAVITY
|
||||
&AuraEffect::HandleModAlternativeDefaultLanguage, //489 SPELL_AURA_MOD_ALTERNATIVE_DEFAULT_LANGUAGE
|
||||
&AuraEffect::HandleNULL, //490
|
||||
&AuraEffect::HandleNULL, //491
|
||||
@@ -3144,6 +3144,21 @@ void AuraEffect::HandlePreventFleeing(AuraApplication const* aurApp, uint8 mode,
|
||||
target->SetControlled(false, UNIT_STATE_FLEEING);
|
||||
}
|
||||
|
||||
static void HandleAuraDisableGravity(Unit* target, bool apply)
|
||||
{
|
||||
// Do not remove DisableGravity if there are more than this auraEffect of that kind on the unit or if it's a creature with DisableGravity on its movement template.
|
||||
if (!apply)
|
||||
if (target->HasAuraType(SPELL_AURA_MOD_ROOT_DISABLE_GRAVITY)
|
||||
|| target->HasAuraType(SPELL_AURA_MOD_STUN_DISABLE_GRAVITY)
|
||||
|| target->HasAuraType(SPELL_AURA_DISABLE_GRAVITY)
|
||||
|| (target->IsCreature() && target->ToCreature()->IsFloating()))
|
||||
return;
|
||||
|
||||
if (target->SetDisableGravity(apply))
|
||||
if (!apply && !target->IsFlying())
|
||||
target->GetMotionMaster()->MoveFall();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraModRootAndDisableGravity(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
||||
{
|
||||
if (!(mode & AURA_EFFECT_HANDLE_REAL))
|
||||
@@ -3153,13 +3168,7 @@ void AuraEffect::HandleAuraModRootAndDisableGravity(AuraApplication const* aurAp
|
||||
|
||||
target->SetControlled(apply, UNIT_STATE_ROOT);
|
||||
|
||||
// Do not remove DisableGravity if there are more than this auraEffect of that kind on the unit or if it's a creature with DisableGravity on its movement template.
|
||||
if (!apply && (target->HasAuraType(GetAuraType()) || target->HasAuraType(SPELL_AURA_MOD_STUN_DISABLE_GRAVITY) || (target->IsCreature() && target->ToCreature()->IsFloating())))
|
||||
return;
|
||||
|
||||
if (target->SetDisableGravity(apply))
|
||||
if (!apply && !target->IsFlying())
|
||||
target->GetMotionMaster()->MoveFall();
|
||||
::HandleAuraDisableGravity(target, apply);
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraModStunAndDisableGravity(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
||||
@@ -3174,13 +3183,17 @@ void AuraEffect::HandleAuraModStunAndDisableGravity(AuraApplication const* aurAp
|
||||
if (apply)
|
||||
target->GetThreatManager().EvaluateSuppressed();
|
||||
|
||||
// Do not remove DisableGravity if there are more than this auraEffect of that kind on the unit or if it's a creature with DisableGravity on its movement template.
|
||||
if (!apply && (target->HasAuraType(GetAuraType()) || target->HasAuraType(SPELL_AURA_MOD_ROOT_DISABLE_GRAVITY) || (target->IsCreature() && target->ToCreature()->IsFloating())))
|
||||
::HandleAuraDisableGravity(target, apply);
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraDisableGravity(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
||||
{
|
||||
if (!(mode & AURA_EFFECT_HANDLE_REAL))
|
||||
return;
|
||||
|
||||
if (target->SetDisableGravity(apply))
|
||||
if (!apply && !target->IsFlying())
|
||||
target->GetMotionMaster()->MoveFall();
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
::HandleAuraDisableGravity(target, apply);
|
||||
}
|
||||
|
||||
/***************************/
|
||||
|
||||
@@ -204,6 +204,7 @@ class TC_GAME_API AuraEffect
|
||||
void HandlePreventFleeing(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModRootAndDisableGravity(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModStunAndDisableGravity(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraDisableGravity(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// charm
|
||||
void HandleModPossess(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModPossessPet(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
|
||||
Reference in New Issue
Block a user