Core/Auras: Implemented SPELL_AURA_MOD_ROOT_DISABLE_GRAVITY

Port From (https://github.com/TrinityCore/TrinityCore/commit/dbed48becc30e10b4b17d95f595056d08a987bad)
This commit is contained in:
hondacrx
2023-01-05 17:26:59 -05:00
parent a14038d374
commit 7d6b86fb2e
4 changed files with 29 additions and 4 deletions
+22
View File
@@ -2467,6 +2467,28 @@ namespace Game.Spells
target.SetControlled(false, UnitState.Fleeing);
}
[AuraEffectHandler(AuraType.ModRootDisableGravity)]
void HandleAuraModRootAndDisableGravity(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
if (!mode.HasAnyFlag(AuraEffectHandleModes.Real))
return;
Unit target = aurApp.GetTarget();
target.SetControlled(apply, UnitState.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(AuraType.ModStunDisableGravity)
|| (target.IsCreature() && target.ToCreature().GetMovementTemplate().Flight == CreatureFlightMovementType.DisableGravity)))
return;
if (target.SetDisableGravity(apply))
if (!apply && !target.IsFlying())
target.GetMotionMaster().MoveFall();
}
[AuraEffectHandler(AuraType.ModStunDisableGravity)]
void HandleAuraModStunAndDisableGravity(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{