diff options
author | Shauren <shauren.trinity@gmail.com> | 2012-08-18 21:02:39 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2012-08-18 21:02:39 +0200 |
commit | c7aa77bcc07611eedd6bbcb4cafeabd14749bf28 (patch) | |
tree | ce0f81f1a31e82b4112acb658ece4fc2765c4f52 /src | |
parent | bbe13bd12641d86e9b2e11d057d944fcf8939bd0 (diff) |
Core/Spells: Fixed adding extra periodic ticks from haste
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Spells/Spell.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index d1cd1a9bae5..697be0e48c9 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2692,14 +2692,28 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA duration = m_originalCaster->ModSpellDuration(aurSpellInfo, unit, duration, positive, effectMask); - // Haste modifies duration of channeled spells - if (m_spellInfo->IsChanneled()) + if (duration > 0) { - if (m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION) - m_originalCaster->ModSpellCastTime(aurSpellInfo, duration, this); + // Haste modifies duration of channeled spells + if (m_spellInfo->IsChanneled()) + { + if (m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION) + m_originalCaster->ModSpellCastTime(aurSpellInfo, duration, this); + } + else if (m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION) + { + int32 origDuration = duration; + duration = 0; + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + if (AuraEffect const* eff = m_spellAura->GetEffect(i)) + if (int32 amplitude = eff->GetAmplitude()) // amplitude is hastened by UNIT_MOD_CAST_SPEED + duration = std::max(std::max(origDuration / amplitude, 1) * amplitude, duration); + + // if there is no periodic effect + if (!duration) + duration = int32(origDuration * m_originalCaster->GetFloatValue(UNIT_MOD_CAST_SPEED)); + } } - else if (m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION) - duration = int32(duration * m_originalCaster->GetFloatValue(UNIT_MOD_CAST_SPEED)); if (duration != m_spellAura->GetMaxDuration()) { |