Core/Auras: Implemented SPELL_AURA_MOD_STUN_DISABLE_GRAVITY
Port From (https://github.com/TrinityCore/TrinityCore/commit/6515319b7542930ffe2237c309a3dc3773d70f72)
This commit is contained in:
@@ -5240,7 +5240,7 @@ namespace Game.Entities
|
||||
auraList.First().HandleEffect(this, AuraEffectHandleModes.SendForClient, true);
|
||||
}
|
||||
|
||||
if (HasAuraType(AuraType.ModStun))
|
||||
if (HasAuraType(AuraType.ModStun) || HasAuraType(AuraType.ModStunDisableGravity))
|
||||
SetRooted(true);
|
||||
|
||||
MoveSetCompoundState setCompoundState = new();
|
||||
|
||||
@@ -1216,7 +1216,7 @@ namespace Game.Entities
|
||||
switch (state)
|
||||
{
|
||||
case UnitState.Stunned:
|
||||
if (HasAuraType(AuraType.ModStun))
|
||||
if (HasAuraType(AuraType.ModStun) || HasAuraType(AuraType.ModStunDisableGravity))
|
||||
return;
|
||||
|
||||
ClearUnitState(state);
|
||||
@@ -1255,7 +1255,7 @@ namespace Game.Entities
|
||||
void ApplyControlStatesIfNeeded()
|
||||
{
|
||||
// Unit States might have been already cleared but auras still present. I need to check with HasAuraType
|
||||
if (HasUnitState(UnitState.Stunned) || HasAuraType(AuraType.ModStun))
|
||||
if (HasUnitState(UnitState.Stunned) || HasAuraType(AuraType.ModStun) || HasAuraType(AuraType.ModStunDisableGravity))
|
||||
SetStunned(true);
|
||||
|
||||
if (HasUnitState(UnitState.Root) || HasAuraType(AuraType.ModRoot) || HasAuraType(AuraType.ModRoot2))
|
||||
|
||||
@@ -2467,6 +2467,31 @@ namespace Game.Spells
|
||||
target.SetControlled(false, UnitState.Fleeing);
|
||||
}
|
||||
|
||||
[AuraEffectHandler(AuraType.ModStunDisableGravity)]
|
||||
void HandleAuraModStunAndDisableGravity(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
|
||||
{
|
||||
if (!mode.HasAnyFlag(AuraEffectHandleModes.Real))
|
||||
return;
|
||||
|
||||
Unit target = aurApp.GetTarget();
|
||||
|
||||
target.SetControlled(apply, UnitState.Stunned);
|
||||
|
||||
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(AuraType.ModStunDisableGravity)
|
||||
|| (target.IsCreature() && target.ToCreature().GetMovementTemplate().Flight == CreatureFlightMovementType.DisableGravity)))
|
||||
return;
|
||||
|
||||
if (target.SetDisableGravity(apply))
|
||||
if (!apply && !target.IsFlying())
|
||||
target.GetMotionMaster().MoveFall();
|
||||
}
|
||||
|
||||
/***************************/
|
||||
/*** CHARM ***/
|
||||
/***************************/
|
||||
@@ -3245,7 +3270,7 @@ namespace Game.Spells
|
||||
|
||||
aurApp.GetTarget().UpdateArmor();
|
||||
}
|
||||
|
||||
|
||||
[AuraEffectHandler(AuraType.ModStatBonusPct)]
|
||||
void HandleModStatBonusPercent(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
|
||||
{
|
||||
@@ -4646,7 +4671,7 @@ namespace Game.Spells
|
||||
target.RemoveUnitFlag3(UnitFlags3.AlternativeDefaultLanguage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[AuraEffectHandler(AuraType.Linked)]
|
||||
void HandleAuraLinked(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
|
||||
{
|
||||
@@ -5762,7 +5787,7 @@ namespace Game.Spells
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[AuraEffectHandler(AuraType.SetFFAPvp)]
|
||||
void HandleSetFFAPvP(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
|
||||
{
|
||||
|
||||
@@ -5901,6 +5901,7 @@ namespace Game.Spells
|
||||
switch (auraType)
|
||||
{
|
||||
case AuraType.ModStun:
|
||||
case AuraType.ModStunDisableGravity:
|
||||
return SpellCastResult.Stunned;
|
||||
case AuraType.ModFear:
|
||||
return SpellCastResult.Fleeing;
|
||||
@@ -5939,6 +5940,12 @@ namespace Game.Spells
|
||||
SpellCastResult mechanicResult = mechanicCheck(AuraType.ModFear, ref param1);
|
||||
if (mechanicResult != SpellCastResult.SpellCastOk)
|
||||
result = mechanicResult;
|
||||
else
|
||||
{
|
||||
mechanicResult = mechanicCheck(AuraType.ModStunDisableGravity, ref param1);
|
||||
if (mechanicResult != SpellCastResult.SpellCastOk)
|
||||
result = mechanicResult;
|
||||
}
|
||||
}
|
||||
else if (!CheckSpellCancelsFear(ref param1))
|
||||
result = SpellCastResult.Fleeing;
|
||||
|
||||
Reference in New Issue
Block a user