From e1617a0044a100bfee6d8ba76ce81a89c759edda Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Fri, 21 Jan 2022 17:39:11 +0100 Subject: [PATCH] fix(Core/Spells): Restored special Rolling DoTs mechanic for Corruption and SW:Pain (#10206) Fixes #9867 --- src/server/game/Spells/Auras/SpellAuras.cpp | 22 +++++++++++++++++++++ src/server/game/Spells/Auras/SpellAuras.h | 1 + src/server/scripts/Spells/spell_priest.cpp | 2 +- src/server/scripts/Spells/spell_warlock.cpp | 2 +- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 886a8d9db..2c389ed95 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -940,6 +940,28 @@ void Aura::RefreshTimers(bool periodicReset /*= false*/) } } +// xinef: dot's rolling function +void Aura::RefreshTimersWithMods() +{ + Unit* caster = GetCaster(); + m_maxDuration = CalcMaxDuration(); + if ((caster && caster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, m_spellInfo)) || m_spellInfo->HasAttribute(SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC)) + { + m_maxDuration = int32(m_maxDuration * caster->GetFloatValue(UNIT_MOD_CAST_SPEED)); + } + + // xinef: we should take ModSpellDuration into account, but none of the spells using this function is affected by contents of ModSpellDuration + RefreshDuration(); + + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + { + if (AuraEffect* aurEff = m_effects[i]) + { + aurEff->CalculatePeriodic(caster, false, false); + } + } +} + void Aura::SetCharges(uint8 charges) { if (m_procCharges == charges) diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index 15320e5a1..bcf0d6408 100644 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -134,6 +134,7 @@ public: void SetDuration(int32 duration, bool withMods = false); void RefreshDuration(bool withMods = false); void RefreshTimers(bool periodicReset = false); + void RefreshTimersWithMods(); bool IsExpired() const { return !GetDuration();} bool IsPermanent() const { return GetMaxDuration() == -1; } diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 944221d64..cd1459242 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -462,7 +462,7 @@ class spell_pri_pain_and_suffering_proc : public SpellScript if (Unit* unitTarget = GetHitUnit()) if (AuraEffect* aur = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x8000, 0, 0, GetCaster()->GetGUID())) { - aur->GetBase()->RefreshTimers(); + aur->GetBase()->RefreshTimersWithMods(); aur->ChangeAmount(aur->CalculateAmount(aur->GetCaster()), false); } } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index a5fba203c..3d03fc6d4 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -625,7 +625,7 @@ class spell_warl_everlasting_affliction : public SpellScript // Refresh corruption on target if (AuraEffect* aur = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x2, 0, 0, GetCaster()->GetGUID())) { - aur->GetBase()->RefreshTimers(); + aur->GetBase()->RefreshTimersWithMods(); aur->ChangeAmount(aur->CalculateAmount(aur->GetCaster()), false); } }