Core/Spells: Fixed effects targeting the caster not hitting him immediately on spell launch if the spell targets a dest

Port From (https://github.com/TrinityCore/TrinityCore/commit/295c8f63269d966812f37a8bd8e988a9f2dc1235)
This commit is contained in:
hondacrx
2023-05-02 15:40:21 -04:00
parent 9decc17cd0
commit 5e5e17e23c
5 changed files with 78 additions and 36 deletions
@@ -920,6 +920,15 @@ namespace Game.Movement
return (p1 - p2).LengthSquared();
}
public float GetPathLength()
{
float length = 0.0f;
for (var i = 0; i < _pathPoints.Length - 1; ++i)
length += (_pathPoints[i + 1] - _pathPoints[i]).Length();
return length;
}
public void ShortenPathUntilDist(Position pos, float dist) { ShortenPathUntilDist(new Vector3(pos.posX, pos.posY, pos.posZ), dist); }
public void ShortenPathUntilDist(Vector3 target, float dist)
@@ -192,7 +192,9 @@ namespace Game.Movement
public void MovementInform(Unit owner)
{
owner.ToCreature()?.GetAI()?.MovementInform(MovementGeneratorType.Point, _movementId);
// deliver EVENT_CHARGE to scripts, EVENT_CHARGE_PREPATH is just internal implementation detail of this movement generator
uint movementId = _movementId == EventId.ChargePrepath ? EventId.Charge : _movementId;
owner.ToCreature()?.GetAI()?.MovementInform(MovementGeneratorType.Point, movementId);
}
public override void UnitSpeedChanged()