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:
@@ -3528,21 +3528,17 @@ namespace Game.Spells
|
||||
if (m_preGeneratedPath == null)
|
||||
{
|
||||
Position pos = unitTarget.GetFirstCollisionPosition(unitTarget.GetCombatReach(), unitTarget.GetRelativeAngle(m_caster.GetPosition()));
|
||||
if (MathFunctions.fuzzyGt(m_spellInfo.Speed, 0.0f) && m_spellInfo.HasAttribute(SpellAttr9.SpecialDelayCalculation))
|
||||
speed = pos.GetExactDist(m_caster) / speed;
|
||||
|
||||
unitCaster.GetMotionMaster().MoveCharge(pos.posX, pos.posY, pos.posZ, speed, EventId.Charge, false, unitTarget, spellEffectExtraData);
|
||||
m_preGeneratedPath = new PathGenerator(unitCaster);
|
||||
m_preGeneratedPath.CalculatePath(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MathFunctions.fuzzyGt(m_spellInfo.Speed, 0.0f) && m_spellInfo.HasAttribute(SpellAttr9.SpecialDelayCalculation))
|
||||
{
|
||||
Vector3 pos = m_preGeneratedPath.GetActualEndPosition();
|
||||
speed = new Position(pos.X, pos.Y, pos.Z).GetExactDist(m_caster) / speed;
|
||||
}
|
||||
|
||||
unitCaster.GetMotionMaster().MoveCharge(m_preGeneratedPath, speed, unitTarget, spellEffectExtraData);
|
||||
}
|
||||
if (MathFunctions.fuzzyGt(m_spellInfo.Speed, 0.0f) && m_spellInfo.HasAttribute(SpellAttr9.SpecialDelayCalculation))
|
||||
speed = m_preGeneratedPath.GetPathLength() / speed;
|
||||
|
||||
unitCaster.GetMotionMaster().MoveCharge(m_preGeneratedPath, speed, unitTarget, spellEffectExtraData);
|
||||
|
||||
// abuse implementation detail of MoveCharge accepting PathGenerator argument (instantly started spline)
|
||||
UpdateDelayMomentForUnitTarget(unitTarget, (uint)unitCaster.MoveSpline.Duration());
|
||||
}
|
||||
|
||||
if (effectHandleMode == SpellEffectHandleMode.HitTarget)
|
||||
@@ -3578,7 +3574,18 @@ namespace Game.Spells
|
||||
pos = unitCaster.GetFirstCollisionPosition(dist, angle);
|
||||
}
|
||||
|
||||
unitCaster.GetMotionMaster().MoveCharge(pos.posX, pos.posY, pos.posZ);
|
||||
PathGenerator path = new(unitCaster);
|
||||
path.CalculatePath(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), false);
|
||||
|
||||
float speed = MathFunctions.fuzzyGt(m_spellInfo.Speed, 0.0f) ? m_spellInfo.Speed : MotionMaster.SPEED_CHARGE;
|
||||
|
||||
if (MathFunctions.fuzzyGt(m_spellInfo.Speed, 0.0f) && m_spellInfo.HasAttribute(SpellAttr9.SpecialDelayCalculation))
|
||||
speed = path.GetPathLength() / speed;
|
||||
|
||||
unitCaster.GetMotionMaster().MoveCharge(path, speed);
|
||||
|
||||
// abuse implementation detail of MoveCharge accepting PathGenerator argument (instantly started spline)
|
||||
UpdateDelayMomentForDst((uint)unitCaster.MoveSpline.Duration());
|
||||
}
|
||||
else if (effectHandleMode == SpellEffectHandleMode.Hit)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user