diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 0b5317015..39f0d1565 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -823,12 +823,16 @@ void Spell::AddUnitTarget(Unit* pVictim, SpellEffectIndex effIndex) // Calculate hit result target.missCondition = m_caster->SpellHitResult(pVictim, m_spellInfo, m_canReflect); + // spell fly from visual cast object + WorldObject* affectiveObject = GetAffectiveCasterObject(); + // Spell have speed - need calculate incoming time - if (m_spellInfo->speed > 0.0f) + if (m_spellInfo->speed > 0.0f && affectiveObject && pVictim != affectiveObject) { // calculate spell incoming interval - float dist = m_caster->GetDistance(pVictim->GetPositionX(), pVictim->GetPositionY(), pVictim->GetPositionZ()); - if (dist < 5.0f) dist = 5.0f; + float dist = affectiveObject->GetDistance(pVictim->GetPositionX(), pVictim->GetPositionY(), pVictim->GetPositionZ()); + if (dist < 5.0f) + dist = 5.0f; target.timeDelay = (uint64) floor(dist / m_spellInfo->speed * 1000.0f); // Calculate minimum incoming time @@ -888,11 +892,14 @@ void Spell::AddGOTarget(GameObject* pVictim, SpellEffectIndex effIndex) target.effectMask = (1 << effIndex); target.processed = false; // Effects not apply on target + // spell fly from visual cast object + WorldObject* affectiveObject = GetAffectiveCasterObject(); + // Spell have speed - need calculate incoming time - if (m_spellInfo->speed > 0.0f) + if (m_spellInfo->speed > 0.0f && affectiveObject && pVictim != affectiveObject) { // calculate spell incoming interval - float dist = m_caster->GetDistance(pVictim->GetPositionX(), pVictim->GetPositionY(), pVictim->GetPositionZ()); + float dist = affectiveObject->GetDistance(pVictim->GetPositionX(), pVictim->GetPositionY(), pVictim->GetPositionZ()); if (dist < 5.0f) dist = 5.0f; target.timeDelay = (uint64) floor(dist / m_spellInfo->speed * 1000.0f); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 8bd8b9603..941982ff1 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10546" + #define REVISION_NR "10547" #endif // __REVISION_NR_H__