*Use dest to calculate time delay for missile spells. (Only SPELL_EFFECT_TRIGGER_MISSILE for now, need to fix all "dest required spells")

--HG--
branch : trunk
This commit is contained in:
megamage
2008-12-03 17:30:14 -06:00
parent b36929bc79
commit cd4e545155

View File

@@ -800,7 +800,13 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
if (m_spellInfo->speed > 0.0f)
{
// calculate spell incoming interval
float dist = m_caster->GetDistance(pVictim->GetPositionX(), pVictim->GetPositionY(), pVictim->GetPositionZ());
// TODO: this is a hack
float dist;
if(m_spellInfo->Effect[effIndex] == SPELL_EFFECT_TRIGGER_MISSILE && m_targets.HasDest())
dist = m_caster->GetDistance(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ);
else
dist = m_caster->GetDistance(pVictim->GetPositionX(), pVictim->GetPositionY(), pVictim->GetPositionZ());
if (dist < 5.0f) dist = 5.0f;
target.timeDelay = (uint64) floor(dist / m_spellInfo->speed * 1000.0f);