mirror of
https://github.com/araxiaonline/TrinityCore2.git
synced 2026-06-13 03:22:40 -04:00
Core/Spells: Fixed adding extra periodic ticks from haste
This commit is contained in:
@@ -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())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user