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

This commit is contained in:
Shauren
2019-08-31 01:29:54 +02:00
parent c924840ce7
commit 04ab611111
4 changed files with 50 additions and 22 deletions

View File

@@ -4240,14 +4240,14 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
{
//unitTarget->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ);
Position pos = unitTarget->GetFirstCollisionPosition(unitTarget->GetObjectSize(), unitTarget->GetRelativeAngle(m_caster));
if (m_spellInfo->HasAttribute(SPELL_ATTR9_SPECIAL_DELAY_CALCULATION))
if (G3D::fuzzyGt(m_spellInfo->Speed, 0.0f) && m_spellInfo->HasAttribute(SPELL_ATTR9_SPECIAL_DELAY_CALCULATION))
speed = pos.GetExactDist(m_caster) / speed;
m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ, speed, EVENT_CHARGE, false, unitTarget, spellEffectExtraData.get_ptr());
}
else
{
if (m_spellInfo->HasAttribute(SPELL_ATTR9_SPECIAL_DELAY_CALCULATION))
if (G3D::fuzzyGt(m_spellInfo->Speed, 0.0f) && m_spellInfo->HasAttribute(SPELL_ATTR9_SPECIAL_DELAY_CALCULATION))
{
G3D::Vector3 pos = m_preGeneratedPath->GetActualEndPosition();
speed = Position(pos.x, pos.y, pos.z).GetExactDist(m_caster) / speed;