Core/Spells: Fixed calling spellhit script hooks on launch when spell hits both caster and target with different effects

Port From (https://github.com/TrinityCore/TrinityCore/commit/04ab611111824c7709582637660d01eb117fe9fc)
This commit is contained in:
hondacrx
2019-09-04 13:22:38 -04:00
parent 0877e73ff2
commit b3bcfd1a8f
3 changed files with 49 additions and 21 deletions
+2 -2
View File
@@ -4114,14 +4114,14 @@ namespace Game.Spells
if (m_preGeneratedPath.GetPathType() == PathType.Blank)
{
Position pos = unitTarget.GetFirstCollisionPosition(unitTarget.GetObjectSize(), unitTarget.GetRelativeAngle(m_caster.GetPosition()));
if (m_spellInfo.HasAttribute(SpellAttr9.SpecialDelayCalculation))
if (MathFunctions.fuzzyGt(m_spellInfo.Speed, 0.0f) && m_spellInfo.HasAttribute(SpellAttr9.SpecialDelayCalculation))
speed = pos.GetExactDist(m_caster) / speed;
m_caster.GetMotionMaster().MoveCharge(pos.posX, pos.posY, pos.posZ, speed, EventId.Charge, false, unitTarget, spellEffectExtraData);
}
else
{
if (m_spellInfo.HasAttribute(SpellAttr9.SpecialDelayCalculation))
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;