Core/Movement: MotionMaster reimplementation

Port From (https://github.com/TrinityCore/TrinityCore/commit/426f9f2f92b26fbb68e7cda9290ccbd586c6af4e)
This commit is contained in:
hondacrx
2021-09-29 18:24:37 -04:00
parent cf13f32062
commit a968772bad
47 changed files with 1954 additions and 1227 deletions
+1 -10
View File
@@ -2439,8 +2439,6 @@ namespace Game.Spells
[AuraEffectHandler(AuraType.ModPossessPet)]
void HandleModPossessPet(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
{
// Used by spell "Eyes of the Beast"
if (!mode.HasAnyFlag(AuraEffectHandleModes.Real))
return;
@@ -2459,9 +2457,6 @@ namespace Game.Spells
if (caster.ToPlayer().GetPet() != pet)
return;
// Must clear current motion or pet leashes back to owner after a few yards
// when under spell 'Eyes of the Beast'
pet.GetMotionMaster().Clear();
pet.SetCharmedBy(caster, CharmType.Possess, aurApp);
}
else
@@ -2475,13 +2470,9 @@ namespace Game.Spells
// Reinitialize the pet bar or it will appear greyed out
caster.ToPlayer().PetSpellInitialize();
// Follow owner only if not fighting or owner didn't click "stay" at new location
// This may be confusing because pet bar shows "stay" when under the spell but it retains
// the "follow" flag. Player MUST click "stay" while under the spell.
// TODO: remove this
if (pet.GetVictim() == null && !pet.GetCharmInfo().HasCommandState(CommandStates.Stay))
{
pet.GetMotionMaster().MoveFollow(caster, SharedConst.PetFollowDist, pet.GetFollowAngle());
}
}
}
}
+1 -5
View File
@@ -1922,11 +1922,7 @@ namespace Game.Spells
if (unitTarget.HasUnitState(UnitState.Confused | UnitState.Stunned | UnitState.Fleeing))
return;
if (unitTarget.IsTypeId(TypeId.Unit))
unitTarget.GetMotionMaster().MoveDistract((uint)(damage * Time.InMilliseconds));
unitTarget.StopMoving();
unitTarget.SetFacingTo(unitTarget.GetAbsoluteAngle(destTarget));
unitTarget.GetMotionMaster().MoveDistract((uint)(damage * Time.InMilliseconds), unitTarget.GetAbsoluteAngle(destTarget));
}
[SpellEffectHandler(SpellEffectName.Pickpocket)]