mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 17:19:07 +00:00
fix(Scripts/Spells): Death Knight Army of the Dead auras (#19795)
This commit is contained in:
@@ -5320,6 +5320,65 @@ class spell_gen_set_health : public SpellScript
|
||||
}
|
||||
};
|
||||
|
||||
// 67561 - Serverside - Pet Scaling - Master Spell 06 - Spell Hit, Expertise, Spell Penetration
|
||||
class spell_pet_spellhit_expertise_spellpen_scaling : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_pet_spellhit_expertise_spellpen_scaling)
|
||||
|
||||
int32 CalculatePercent(float hitChance, float cap, float maxChance)
|
||||
{
|
||||
return (hitChance / cap) * maxChance;
|
||||
}
|
||||
|
||||
void CalculateSpellHitAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
|
||||
{
|
||||
if (Player* modOwner = GetUnitOwner()->GetSpellModOwner())
|
||||
amount = CalculatePercent(modOwner->m_modMeleeHitChance, 8.0f, 17.0f);
|
||||
}
|
||||
|
||||
void CalculateExpertiseAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
|
||||
{
|
||||
if (Player* modOwner = GetUnitOwner()->GetSpellModOwner())
|
||||
amount = CalculatePercent(modOwner->m_modMeleeHitChance, 8.0f, 26.0f);
|
||||
}
|
||||
|
||||
void CalculateSpellPenAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
|
||||
{
|
||||
if (Player* modOwner = GetUnitOwner()->GetSpellModOwner())
|
||||
amount = modOwner->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, SPELL_SCHOOL_MASK_SPELL);
|
||||
}
|
||||
|
||||
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
GetUnitOwner()->ApplySpellImmune(GetId(), IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE);
|
||||
}
|
||||
|
||||
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
|
||||
{
|
||||
if (!GetUnitOwner()->IsPet())
|
||||
return;
|
||||
|
||||
isPeriodic = true;
|
||||
amplitude = 3 * IN_MILLISECONDS;
|
||||
}
|
||||
|
||||
void HandlePeriodic(AuraEffect const* aurEff)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
GetEffect(aurEff->GetEffIndex())->RecalculateAmount();
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pet_spellhit_expertise_spellpen_scaling::CalculateSpellHitAmount, EFFECT_0, SPELL_AURA_MOD_SPELL_HIT_CHANCE);
|
||||
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pet_spellhit_expertise_spellpen_scaling::CalculateExpertiseAmount, EFFECT_1, SPELL_AURA_MOD_EXPERTISE);
|
||||
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pet_spellhit_expertise_spellpen_scaling::CalculateSpellPenAmount, EFFECT_2, SPELL_AURA_MOD_TARGET_RESISTANCE);
|
||||
OnEffectApply += AuraEffectApplyFn(spell_pet_spellhit_expertise_spellpen_scaling::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
|
||||
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_pet_spellhit_expertise_spellpen_scaling::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY);
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_pet_spellhit_expertise_spellpen_scaling::HandlePeriodic, EFFECT_ALL, SPELL_AURA_ANY);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_generic_spell_scripts()
|
||||
{
|
||||
RegisterSpellScript(spell_silithyst);
|
||||
@@ -5478,4 +5537,5 @@ void AddSC_generic_spell_scripts()
|
||||
RegisterSpellScript(spell_gen_sober_up);
|
||||
RegisterSpellScript(spell_gen_steal_weapon);
|
||||
RegisterSpellScript(spell_gen_set_health);
|
||||
RegisterSpellScript(spell_pet_spellhit_expertise_spellpen_scaling);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user