fix(Scripts/Spells): Death Knight Army of the Dead auras (#19795)

This commit is contained in:
Jelle Meeus
2024-12-28 14:23:14 +01:00
committed by GitHub
parent 118c426f74
commit 638b8ea621
6 changed files with 152 additions and 12 deletions

View File

@@ -751,8 +751,8 @@ class spell_dk_pet_scaling : public AuraScript
// Check just if owner has Ravenous Dead since it's effect is not an aura
if (AuraEffect const* rdEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0))
{
SpellInfo const* spellInfo = rdEff->GetSpellInfo(); // Then get the SpellProto and add the dummy effect value
AddPct(modifier, spellInfo->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
SpellInfo const* spellInfo = rdEff->GetSpellInfo(); // Then get the SpellProto and add the dummy effect value
AddPct(modifier, spellInfo->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
}
// xinef: Glyph of the Ghoul
@@ -2203,6 +2203,72 @@ class spell_dk_will_of_the_necropolis : public AuraScript
}
};
// 49040 - Army of the Dead Passive
class spell_dk_army_of_the_dead_passive : public AuraScript
{
PrepareAuraScript(spell_dk_army_of_the_dead_passive);
void CalculateAPAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
// army ghoul inherits 6.5% of AP
if (Unit* owner = GetUnitOwner()->GetOwner())
amount = CalculatePct(std::max<int32>(0, owner->GetTotalAttackPowerValue(BASE_ATTACK)), 6.5f);
}
void CalculateHealthAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
// army ghoul inherits 20% of health
if (Unit* owner = GetUnitOwner()->GetOwner())
amount = owner->CountPctFromMaxHealth(20);
}
void CalculateSPAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
// army ghoul inherits 6.5% of AP
if (Unit* owner = GetUnitOwner()->GetOwner())
amount = CalculatePct(std::max<int32>(0, owner->GetTotalAttackPowerValue(BASE_ATTACK)), 6.5f);
}
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetUnitOwner()->IsPet())
return;
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_STAT, true, SPELL_BLOCK_TYPE_POSITIVE);
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE);
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER, true, SPELL_BLOCK_TYPE_POSITIVE);
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE);
// Heroism / Bloodlust immunity
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_ID, 32182, true);
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_ID, 2825, true);
}
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
{
if (!GetUnitOwner()->IsPet())
return;
isPeriodic = true;
amplitude = 2 * IN_MILLISECONDS;
}
void HandlePeriodic(AuraEffect const* aurEff)
{
PreventDefaultAction();
GetEffect(aurEff->GetEffIndex())->RecalculateAmount();
}
void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_army_of_the_dead_passive::CalculateAPAmount, EFFECT_0, SPELL_AURA_MOD_ATTACK_POWER);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_army_of_the_dead_passive::CalculateHealthAmount, EFFECT_1, SPELL_AURA_MOD_INCREASE_HEALTH);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_army_of_the_dead_passive::CalculateSPAmount, EFFECT_2, SPELL_AURA_MOD_DAMAGE_DONE);
OnEffectApply += AuraEffectApplyFn(spell_dk_army_of_the_dead_passive::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_dk_army_of_the_dead_passive::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_dk_army_of_the_dead_passive::HandlePeriodic, EFFECT_ALL, SPELL_AURA_ANY);
}
};
void AddSC_deathknight_spell_scripts()
{
RegisterSpellScript(spell_dk_wandering_plague);
@@ -2250,4 +2316,5 @@ void AddSC_deathknight_spell_scripts()
RegisterSpellScript(spell_dk_vampiric_blood);
RegisterSpellScript(spell_dk_will_of_the_necropolis);
RegisterSpellScript(spell_dk_ghoul_thrash);
RegisterSpellScript(spell_dk_army_of_the_dead_passive);
}