fix(Scripts/Spell): snapshot %dmg and crit when spreading or refreshing diseases with pestilence (#22306)

This commit is contained in:
Tereneckla
2025-06-22 09:38:09 +00:00
committed by GitHub
parent 90eb27cd15
commit 86f460c0ca
2 changed files with 42 additions and 4 deletions

View File

@@ -1727,6 +1727,16 @@ class spell_dk_pestilence : public SpellScript
{
PrepareSpellScript(spell_dk_pestilence);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo(
{
SPELL_DK_GLYPH_OF_DISEASE,
SPELL_DK_BLOOD_PLAGUE,
SPELL_DK_FROST_FEVER
});
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
@@ -1743,11 +1753,38 @@ class spell_dk_pestilence : public SpellScript
// And spread them on target
// Blood Plague
if (target->GetAura(SPELL_DK_BLOOD_PLAGUE, caster->GetGUID()))
caster->CastSpell(hitUnit, SPELL_DK_BLOOD_PLAGUE, true);
if (Aura* disOld = target->GetAura(SPELL_DK_BLOOD_PLAGUE, caster->GetGUID()))
if (AuraEffect* effOld = disOld->GetEffect(EFFECT_0))
{
float pctMods = effOld->GetPctMods();
float crit = effOld->GetCritChance();
caster->CastSpell(hitUnit, SPELL_DK_BLOOD_PLAGUE, true);
if (Aura* disNew = hitUnit->GetAura(SPELL_DK_BLOOD_PLAGUE, caster->GetGUID()))
if (AuraEffect* effNew = disNew->GetEffect(EFFECT_0))
{
effNew->SetPctMods(pctMods);
effNew->SetCritChance(crit);
effNew->SetAmount(effNew->CalculateAmount(effNew->GetCaster()));
}
}
// Frost Fever
if (target->GetAura(SPELL_DK_FROST_FEVER, caster->GetGUID()))
caster->CastSpell(hitUnit, SPELL_DK_FROST_FEVER, true);
if (Aura* disOld = target->GetAura(SPELL_DK_FROST_FEVER, caster->GetGUID()))
if (AuraEffect* effOld = disOld->GetEffect(EFFECT_0))
{
float pctMods = effOld->GetPctMods();
float crit = effOld->GetCritChance();
caster->CastSpell(hitUnit, SPELL_DK_FROST_FEVER, true);
if (Aura* disNew = hitUnit->GetAura(SPELL_DK_FROST_FEVER, caster->GetGUID()))
if (AuraEffect* effNew = disNew->GetEffect(EFFECT_0))
{
effNew->SetPctMods(pctMods);
effNew->SetCritChance(crit);
effNew->SetAmount(effNew->CalculateAmount(effNew->GetCaster()));
}
}
}
}