From fc9bbe1046c1adcb089d5532f9e5baaa9fb543f1 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 28 Dec 2012 22:18:19 +0100 Subject: 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 --- src/server/game/Spells/Spell.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 6a6caed68f0..c7ecae443b8 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -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; } -- cgit v1.2.3