Core/Spells: Implemented SPELL_ATTR9_SPECIAL_DELAY_CALCULATION. Spells using this attribute have missile travel time stored in Speed field (in seconds) instead of speed

This commit is contained in:
Shauren committed 2012-12-28 22:18:19 +01:00
1 parent abbbf55931
commit fc9bbe1046
1 file changed
+15 -3
+15 -3
View File
@@ -795,7 +795,10 @@ void Spell::SelectSpellTargets()
else if (m_spellInfo->Speed > 0.0f)
{
float dist = m_caster->GetDistance(*m_targets.GetDstPos());
m_delayMoment = (uint64) floor(dist / m_spellInfo->Speed * 1000.0f);
if (!(m_spellInfo->AttributesEx9 & SPELL_ATTR9_SPECIAL_DELAY_CALCULATION))
m_delayMoment = uint64(floor(dist / m_spellInfo->Speed * 1000.0f));
else
m_delayMoment = uint64(m_spellInfo->Speed * 1000.0f);
}
}
}
@@ -2162,7 +2165,11 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*=
if (dist < 5.0f)
dist = 5.0f;
targetInfo.timeDelay = (uint64) floor(dist / m_spellInfo->Speed * 1000.0f);
if (!(m_spellInfo->AttributesEx9 & SPELL_ATTR9_SPECIAL_DELAY_CALCULATION))
targetInfo.timeDelay = uint64(floor(dist / m_spellInfo->Speed * 1000.0f));
else
targetInfo.timeDelay = uint64(m_spellInfo->Speed * 1000.0f);
// Calculate minimum incoming time
if (m_delayMoment == 0 || m_delayMoment > targetInfo.timeDelay)
@@ -2241,7 +2248,12 @@ void Spell::AddGOTarget(GameObject* go, uint32 effectMask)
float dist = m_caster->GetDistance(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ());
if (dist < 5.0f)
dist = 5.0f;
target.timeDelay = uint64(floor(dist / m_spellInfo->Speed * 1000.0f));
if (!(m_spellInfo->AttributesEx9 & SPELL_ATTR9_SPECIAL_DELAY_CALCULATION))
target.timeDelay = uint64(floor(dist / m_spellInfo->Speed * 1000.0f));
else
target.timeDelay = uint64(m_spellInfo->Speed * 1000.0f);
if (m_delayMoment == 0 || m_delayMoment > target.timeDelay)
m_delayMoment = target.timeDelay;
}