fix(Core/Spells): Restored special Rolling DoTs mechanic for Corruption and SW:Pain (#10206)

Fixes #9867
This commit is contained in:
UltraNix
2022-01-21 17:39:11 +01:00
committed by GitHub
parent fcd950c888
commit e1617a0044
4 changed files with 25 additions and 2 deletions

View File

@@ -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)

View File

@@ -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; }

View File

@@ -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);
}
}

View File

@@ -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);
}
}