diff options
-rw-r--r-- | src/server/scripts/Spells/spell_paladin.cpp | 2737 |
1 files changed, 1140 insertions, 1597 deletions
diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 598553235d2..a33ac2139cd 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -143,210 +143,166 @@ enum MiscSpellIcons }; // -31850 - Ardent Defender -class spell_pal_ardent_defender : public SpellScriptLoader +class spell_pal_ardent_defender : public AuraScript { - public: - spell_pal_ardent_defender() : SpellScriptLoader("spell_pal_ardent_defender") { } - - class spell_pal_ardent_defender_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_ardent_defender_AuraScript); - - uint32 _absorbPct = 0; - uint32 _healPct = 0; - - enum Spell - { - PAL_SPELL_ARDENT_DEFENDER_HEAL = 66235 - }; - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ PAL_SPELL_ARDENT_DEFENDER_HEAL }); - } + PrepareAuraScript(spell_pal_ardent_defender); - bool Load() override - { - _absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); - _healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); - return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER; - } - - void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) - { - // Set absorbtion amount to unlimited - amount = -1; - } + uint32 _absorbPct = 0; + uint32 _healPct = 0; - void Absorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount) - { - Unit* victim = GetTarget(); - int32 remainingHealth = victim->GetHealth() - dmgInfo.GetDamage(); - uint32 allowedHealth = victim->CountPctFromMaxHealth(35); - // If damage kills us - if (remainingHealth <= 0 && !victim->GetSpellHistory()->HasCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL)) - { - // Cast healing spell, completely avoid damage - absorbAmount = dmgInfo.GetDamage(); + enum Spell + { + PAL_SPELL_ARDENT_DEFENDER_HEAL = 66235 + }; - float defenseSkillValue = victim->GetDefenseSkillValue(); - // Max heal when defense skill denies critical hits from raid bosses - // Formula: max defense at level + 140 (rating from gear) - float reqDefForMaxHeal = victim->GetMaxSkillValueForLevel() + 140.0f; - float defenseFactor = std::min(1.0f, defenseSkillValue / reqDefForMaxHeal); + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ PAL_SPELL_ARDENT_DEFENDER_HEAL }); + } - CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(victim->CountPctFromMaxHealth(lroundf(_healPct * defenseFactor))); - victim->CastSpell(victim, PAL_SPELL_ARDENT_DEFENDER_HEAL, args); - victim->GetSpellHistory()->AddCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, std::chrono::minutes(2)); - } - else if (remainingHealth < int32(allowedHealth)) - { - // Reduce damage that brings us under 35% (or full damage if we are already under 35%) by x% - uint32 damageToReduce = (victim->GetHealth() < allowedHealth) - ? dmgInfo.GetDamage() - : allowedHealth - remainingHealth; - absorbAmount = CalculatePct(damageToReduce, _absorbPct); - } - } + bool Load() override + { + _absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); + _healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER; + } - void Register() override - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pal_ardent_defender_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); - OnEffectAbsorb += AuraEffectAbsorbFn(spell_pal_ardent_defender_AuraScript::Absorb, EFFECT_0); - } - }; + void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) + { + // Set absorbtion amount to unlimited + amount = -1; + } - AuraScript* GetAuraScript() const override + void Absorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount) + { + Unit* victim = GetTarget(); + int32 remainingHealth = victim->GetHealth() - dmgInfo.GetDamage(); + uint32 allowedHealth = victim->CountPctFromMaxHealth(35); + // If damage kills us + if (remainingHealth <= 0 && !victim->GetSpellHistory()->HasCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL)) + { + // Cast healing spell, completely avoid damage + absorbAmount = dmgInfo.GetDamage(); + + float defenseSkillValue = victim->GetDefenseSkillValue(); + // Max heal when defense skill denies critical hits from raid bosses + // Formula: max defense at level + 140 (rating from gear) + float reqDefForMaxHeal = victim->GetMaxSkillValueForLevel() + 140.0f; + float defenseFactor = std::min(1.0f, defenseSkillValue / reqDefForMaxHeal); + + CastSpellExtraArgs args(aurEff); + args.AddSpellBP0(victim->CountPctFromMaxHealth(lroundf(_healPct * defenseFactor))); + victim->CastSpell(victim, PAL_SPELL_ARDENT_DEFENDER_HEAL, args); + victim->GetSpellHistory()->AddCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, std::chrono::minutes(2)); + } + else if (remainingHealth < int32(allowedHealth)) { - return new spell_pal_ardent_defender_AuraScript(); + // Reduce damage that brings us under 35% (or full damage if we are already under 35%) by x% + uint32 damageToReduce = (victim->GetHealth() < allowedHealth) + ? dmgInfo.GetDamage() + : allowedHealth - remainingHealth; + absorbAmount = CalculatePct(damageToReduce, _absorbPct); } + } + + void Register() override + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pal_ardent_defender::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_pal_ardent_defender::Absorb, EFFECT_0); + } }; // 31821 - Aura Mastery -class spell_pal_aura_mastery : public SpellScriptLoader +class spell_pal_aura_mastery : public AuraScript { - public: - spell_pal_aura_mastery() : SpellScriptLoader("spell_pal_aura_mastery") { } - - class spell_pal_aura_mastery_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_aura_mastery_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PALADIN_AURA_MASTERY_IMMUNE }); - } + PrepareAuraScript(spell_pal_aura_mastery); - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - GetTarget()->CastSpell(GetTarget(), SPELL_PALADIN_AURA_MASTERY_IMMUNE, true); - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_AURA_MASTERY_IMMUNE }); + } - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - GetTarget()->RemoveOwnedAura(SPELL_PALADIN_AURA_MASTERY_IMMUNE, GetCasterGUID()); - } + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->CastSpell(GetTarget(), SPELL_PALADIN_AURA_MASTERY_IMMUNE, true); + } - void Register() override - { - AfterEffectApply += AuraEffectApplyFn(spell_pal_aura_mastery_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_ADD_PCT_MODIFIER, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectRemoveFn(spell_pal_aura_mastery_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_ADD_PCT_MODIFIER, AURA_EFFECT_HANDLE_REAL); - } - }; + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveOwnedAura(SPELL_PALADIN_AURA_MASTERY_IMMUNE, GetCasterGUID()); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_aura_mastery_AuraScript(); - } + void Register() override + { + AfterEffectApply += AuraEffectApplyFn(spell_pal_aura_mastery::HandleEffectApply, EFFECT_0, SPELL_AURA_ADD_PCT_MODIFIER, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_pal_aura_mastery::HandleEffectRemove, EFFECT_0, SPELL_AURA_ADD_PCT_MODIFIER, AURA_EFFECT_HANDLE_REAL); + } }; // 64364 - Aura Mastery Immune -class spell_pal_aura_mastery_immune : public SpellScriptLoader +class spell_pal_aura_mastery_immune : public AuraScript { - public: - spell_pal_aura_mastery_immune() : SpellScriptLoader("spell_pal_aura_mastery_immune") { } + PrepareAuraScript(spell_pal_aura_mastery_immune); - class spell_pal_aura_mastery_immune_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_aura_mastery_immune_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PALADIN_CONCENTRACTION_AURA }); - } - - bool CheckAreaTarget(Unit* target) - { - return target->HasAura(SPELL_PALADIN_CONCENTRACTION_AURA, GetCasterGUID()); - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_CONCENTRACTION_AURA }); + } - void Register() override - { - DoCheckAreaTarget += AuraCheckAreaTargetFn(spell_pal_aura_mastery_immune_AuraScript::CheckAreaTarget); - } - }; + bool CheckAreaTarget(Unit* target) + { + return target->HasAura(SPELL_PALADIN_CONCENTRACTION_AURA, GetCasterGUID()); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_aura_mastery_immune_AuraScript(); - } + void Register() override + { + DoCheckAreaTarget += AuraCheckAreaTargetFn(spell_pal_aura_mastery_immune::CheckAreaTarget); + } }; // 31884 - Avenging Wrath -class spell_pal_avenging_wrath : public SpellScriptLoader +class spell_pal_avenging_wrath : public AuraScript { - public: - spell_pal_avenging_wrath() : SpellScriptLoader("spell_pal_avenging_wrath") { } + PrepareAuraScript(spell_pal_avenging_wrath); - class spell_pal_avenging_wrath_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( { - PrepareAuraScript(spell_pal_avenging_wrath_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - SPELL_PALADIN_SANCTIFIED_WRATH, - SPELL_PALADIN_SANCTIFIED_WRATH_TALENT_R1, - SPELL_PALADIN_AVENGING_WRATH_MARKER, - SPELL_PALADIN_IMMUNE_SHIELD_MARKER - }); - } - - void HandleApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - if (AuraEffect const* sanctifiedWrathAurEff = target->GetAuraEffectOfRankedSpell(SPELL_PALADIN_SANCTIFIED_WRATH_TALENT_R1, EFFECT_2)) - { - CastSpellExtraArgs args(sanctifiedWrathAurEff); - args.AddSpellMod(SPELLVALUE_BASE_POINT0, sanctifiedWrathAurEff->GetAmount()) - .AddSpellMod(SPELLVALUE_BASE_POINT1, sanctifiedWrathAurEff->GetAmount()); - target->CastSpell(target, SPELL_PALADIN_SANCTIFIED_WRATH, args); - } + SPELL_PALADIN_SANCTIFIED_WRATH, + SPELL_PALADIN_SANCTIFIED_WRATH_TALENT_R1, + SPELL_PALADIN_AVENGING_WRATH_MARKER, + SPELL_PALADIN_IMMUNE_SHIELD_MARKER + }); + } - target->CastSpell(nullptr, SPELL_PALADIN_AVENGING_WRATH_MARKER, aurEff); + void HandleApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + if (AuraEffect const* sanctifiedWrathAurEff = target->GetAuraEffectOfRankedSpell(SPELL_PALADIN_SANCTIFIED_WRATH_TALENT_R1, EFFECT_2)) + { + CastSpellExtraArgs args(sanctifiedWrathAurEff); + args.AddSpellMod(SPELLVALUE_BASE_POINT0, sanctifiedWrathAurEff->GetAmount()) + .AddSpellMod(SPELLVALUE_BASE_POINT1, sanctifiedWrathAurEff->GetAmount()); + target->CastSpell(target, SPELL_PALADIN_SANCTIFIED_WRATH, args); + } - // Blizz seems to just apply aura without bothering to cast - target->AddAura(SPELL_PALADIN_IMMUNE_SHIELD_MARKER, target); - } + target->CastSpell(nullptr, SPELL_PALADIN_AVENGING_WRATH_MARKER, aurEff); - void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - GetTarget()->RemoveAurasDueToSpell(SPELL_PALADIN_SANCTIFIED_WRATH); - } + // Blizz seems to just apply aura without bothering to cast + target->AddAura(SPELL_PALADIN_IMMUNE_SHIELD_MARKER, target); + } - void Register() override - { - AfterEffectApply += AuraEffectApplyFn(spell_pal_avenging_wrath_AuraScript::HandleApply, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); - AfterEffectRemove += AuraEffectRemoveFn(spell_pal_avenging_wrath_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, AURA_EFFECT_HANDLE_REAL); - } - }; + void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasDueToSpell(SPELL_PALADIN_SANCTIFIED_WRATH); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_avenging_wrath_AuraScript(); - } + void Register() override + { + AfterEffectApply += AuraEffectApplyFn(spell_pal_avenging_wrath::HandleApply, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + AfterEffectRemove += AuraEffectRemoveFn(spell_pal_avenging_wrath::HandleRemove, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, AURA_EFFECT_HANDLE_REAL); + } }; // 53563 - Beacon of Light @@ -374,153 +330,120 @@ class spell_pal_beacon_of_light : public AuraScript }; // 37877 - Blessing of Faith -class spell_pal_blessing_of_faith : public SpellScriptLoader +class spell_pal_blessing_of_faith : public SpellScript { - public: - spell_pal_blessing_of_faith() : SpellScriptLoader("spell_pal_blessing_of_faith") { } + PrepareSpellScript(spell_pal_blessing_of_faith); - class spell_pal_blessing_of_faith_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( { - PrepareSpellScript(spell_pal_blessing_of_faith_SpellScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - SPELL_PALADIN_BLESSING_OF_LOWER_CITY_DRUID, - SPELL_PALADIN_BLESSING_OF_LOWER_CITY_PALADIN, - SPELL_PALADIN_BLESSING_OF_LOWER_CITY_PRIEST, - SPELL_PALADIN_BLESSING_OF_LOWER_CITY_SHAMAN - }); - } - - void HandleDummy(SpellEffIndex /*effIndex*/) - { - if (Unit* unitTarget = GetHitUnit()) - { - uint32 spell_id = 0; - switch (unitTarget->GetClass()) - { - case CLASS_DRUID: - spell_id = SPELL_PALADIN_BLESSING_OF_LOWER_CITY_DRUID; - break; - case CLASS_PALADIN: - spell_id = SPELL_PALADIN_BLESSING_OF_LOWER_CITY_PALADIN; - break; - case CLASS_PRIEST: - spell_id = SPELL_PALADIN_BLESSING_OF_LOWER_CITY_PRIEST; - break; - case CLASS_SHAMAN: - spell_id = SPELL_PALADIN_BLESSING_OF_LOWER_CITY_SHAMAN; - break; - default: - return; // ignore for non-healing classes - } - Unit* caster = GetCaster(); - caster->CastSpell(caster, spell_id, true); - } - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_pal_blessing_of_faith_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + SPELL_PALADIN_BLESSING_OF_LOWER_CITY_DRUID, + SPELL_PALADIN_BLESSING_OF_LOWER_CITY_PALADIN, + SPELL_PALADIN_BLESSING_OF_LOWER_CITY_PRIEST, + SPELL_PALADIN_BLESSING_OF_LOWER_CITY_SHAMAN + }); + } - SpellScript* GetSpellScript() const override - { - return new spell_pal_blessing_of_faith_SpellScript(); + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Unit* unitTarget = GetHitUnit()) + { + uint32 spell_id = 0; + switch (unitTarget->GetClass()) + { + case CLASS_DRUID: + spell_id = SPELL_PALADIN_BLESSING_OF_LOWER_CITY_DRUID; + break; + case CLASS_PALADIN: + spell_id = SPELL_PALADIN_BLESSING_OF_LOWER_CITY_PALADIN; + break; + case CLASS_PRIEST: + spell_id = SPELL_PALADIN_BLESSING_OF_LOWER_CITY_PRIEST; + break; + case CLASS_SHAMAN: + spell_id = SPELL_PALADIN_BLESSING_OF_LOWER_CITY_SHAMAN; + break; + default: + return; // ignore for non-healing classes + } + Unit* caster = GetCaster(); + caster->CastSpell(caster, spell_id, true); } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_pal_blessing_of_faith::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; // 20911 - Blessing of Sanctuary // 25899 - Greater Blessing of Sanctuary -class spell_pal_blessing_of_sanctuary : public SpellScriptLoader +class spell_pal_blessing_of_sanctuary : public AuraScript { - public: - spell_pal_blessing_of_sanctuary() : SpellScriptLoader("spell_pal_blessing_of_sanctuary") { } + PrepareAuraScript(spell_pal_blessing_of_sanctuary); - class spell_pal_blessing_of_sanctuary_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( { - PrepareAuraScript(spell_pal_blessing_of_sanctuary_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - SPELL_PALADIN_BLESSING_OF_SANCTUARY_BUFF, - SPELL_PALADIN_BLESSING_OF_SANCTUARY_ENERGIZE - }); - } - - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - if (Unit* caster = GetCaster()) - caster->CastSpell(target, SPELL_PALADIN_BLESSING_OF_SANCTUARY_BUFF, true); - } + SPELL_PALADIN_BLESSING_OF_SANCTUARY_BUFF, + SPELL_PALADIN_BLESSING_OF_SANCTUARY_ENERGIZE + }); + } - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - target->RemoveAura(SPELL_PALADIN_BLESSING_OF_SANCTUARY_BUFF, GetCasterGUID()); - } + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + if (Unit* caster = GetCaster()) + caster->CastSpell(target, SPELL_PALADIN_BLESSING_OF_SANCTUARY_BUFF, true); + } - bool CheckProc(ProcEventInfo& /*eventInfo*/) - { - return GetTarget()->GetPowerType() == POWER_MANA; - } + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + target->RemoveAura(SPELL_PALADIN_BLESSING_OF_SANCTUARY_BUFF, GetCasterGUID()); + } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) - { - PreventDefaultAction(); - GetTarget()->CastSpell(GetTarget(), SPELL_PALADIN_BLESSING_OF_SANCTUARY_ENERGIZE, aurEff); - } + bool CheckProc(ProcEventInfo& /*eventInfo*/) + { + return GetTarget()->GetPowerType() == POWER_MANA; + } - void Register() override - { - AfterEffectApply += AuraEffectApplyFn(spell_pal_blessing_of_sanctuary_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); - AfterEffectRemove += AuraEffectRemoveFn(spell_pal_blessing_of_sanctuary_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); - DoCheckProc += AuraCheckProcFn(spell_pal_blessing_of_sanctuary_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_pal_blessing_of_sanctuary_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); + GetTarget()->CastSpell(GetTarget(), SPELL_PALADIN_BLESSING_OF_SANCTUARY_ENERGIZE, aurEff); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_blessing_of_sanctuary_AuraScript(); - } + void Register() override + { + AfterEffectApply += AuraEffectApplyFn(spell_pal_blessing_of_sanctuary::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + AfterEffectRemove += AuraEffectRemoveFn(spell_pal_blessing_of_sanctuary::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + DoCheckProc += AuraCheckProcFn(spell_pal_blessing_of_sanctuary::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_pal_blessing_of_sanctuary::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // -31871 - Divine Purpose -class spell_pal_divine_purpose : public SpellScriptLoader +class spell_pal_divine_purpose : public AuraScript { - public: - spell_pal_divine_purpose() : SpellScriptLoader("spell_pal_divine_purpose") { } + PrepareAuraScript(spell_pal_divine_purpose); - class spell_pal_divine_purpose_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_divine_purpose_AuraScript); - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - if (!roll_chance_i(aurEff->GetAmount())) - return; - - eventInfo.GetProcTarget()->RemoveAurasWithMechanic(1 << MECHANIC_STUN, AURA_REMOVE_BY_ENEMY_SPELL); - } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + if (!roll_chance_i(aurEff->GetAmount())) + return; - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_pal_divine_purpose_AuraScript::HandleProc, EFFECT_2, SPELL_AURA_DUMMY); - } - }; + eventInfo.GetProcTarget()->RemoveAurasWithMechanic(1 << MECHANIC_STUN, AURA_REMOVE_BY_ENEMY_SPELL); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_divine_purpose_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_pal_divine_purpose::HandleProc, EFFECT_2, SPELL_AURA_DUMMY); + } }; // 64205 - Divine Sacrifice @@ -576,325 +499,237 @@ class spell_pal_divine_sacrifice : public AuraScript }; // 53385 - Divine Storm -class spell_pal_divine_storm : public SpellScriptLoader +class spell_pal_divine_storm : public SpellScript { - public: - spell_pal_divine_storm() : SpellScriptLoader("spell_pal_divine_storm") { } - - class spell_pal_divine_storm_SpellScript : public SpellScript - { - PrepareSpellScript(spell_pal_divine_storm_SpellScript); + PrepareSpellScript(spell_pal_divine_storm); - uint32 _healPct = 0; - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PALADIN_DIVINE_STORM_DUMMY }); - } + uint32 _healPct = 0; - bool Load() override - { - _healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster()); - return true; - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_DIVINE_STORM_DUMMY }); + } - void TriggerHeal() - { - Unit* caster = GetCaster(); - CastSpellExtraArgs args(TRIGGERED_FULL_MASK); - args.AddSpellBP0(CalculatePct(GetHitDamage(), _healPct)); - caster->CastSpell(caster, SPELL_PALADIN_DIVINE_STORM_DUMMY, args); - } + bool Load() override + { + _healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster()); + return true; + } - void Register() override - { - AfterHit += SpellHitFn(spell_pal_divine_storm_SpellScript::TriggerHeal); - } - }; + void TriggerHeal() + { + Unit* caster = GetCaster(); + CastSpellExtraArgs args(TRIGGERED_FULL_MASK); + args.AddSpellBP0(CalculatePct(GetHitDamage(), _healPct)); + caster->CastSpell(caster, SPELL_PALADIN_DIVINE_STORM_DUMMY, args); + } - SpellScript* GetSpellScript() const override - { - return new spell_pal_divine_storm_SpellScript(); - } + void Register() override + { + AfterHit += SpellHitFn(spell_pal_divine_storm::TriggerHeal); + } }; // 54171 - Divine Storm (Dummy) -class spell_pal_divine_storm_dummy : public SpellScriptLoader +class spell_pal_divine_storm_dummy : public SpellScript { - public: - spell_pal_divine_storm_dummy() : SpellScriptLoader("spell_pal_divine_storm_dummy") { } - - class spell_pal_divine_storm_dummy_SpellScript : public SpellScript - { - PrepareSpellScript(spell_pal_divine_storm_dummy_SpellScript); + PrepareSpellScript(spell_pal_divine_storm_dummy); - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PALADIN_DIVINE_STORM_HEAL }); - } - - void CountTargets(std::list<WorldObject*>& targetList) - { - _targetCount = targetList.size(); - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_DIVINE_STORM_HEAL }); + } - void HandleDummy(SpellEffIndex /*effIndex*/) - { - if (!_targetCount || ! GetHitUnit()) - return; + void CountTargets(std::list<WorldObject*>& targetList) + { + _targetCount = targetList.size(); + } - CastSpellExtraArgs args(TRIGGERED_FULL_MASK); - args.AddSpellBP0(GetEffectValue() / _targetCount); - GetCaster()->CastSpell(GetHitUnit(), SPELL_PALADIN_DIVINE_STORM_HEAL, args); - } + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (!_targetCount || ! GetHitUnit()) + return; - uint32 _targetCount = 0; + CastSpellExtraArgs args(TRIGGERED_FULL_MASK); + args.AddSpellBP0(GetEffectValue() / _targetCount); + GetCaster()->CastSpell(GetHitUnit(), SPELL_PALADIN_DIVINE_STORM_HEAL, args); + } - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_pal_divine_storm_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pal_divine_storm_dummy_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID); - } - }; + uint32 _targetCount = 0; - SpellScript* GetSpellScript() const override - { - return new spell_pal_divine_storm_dummy_SpellScript(); - } + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_pal_divine_storm_dummy::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pal_divine_storm_dummy::CountTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID); + } }; // 33695 - Exorcism and Holy Wrath Damage -class spell_pal_exorcism_and_holy_wrath_damage : public SpellScriptLoader +class spell_pal_exorcism_and_holy_wrath_damage : public AuraScript { - public: - spell_pal_exorcism_and_holy_wrath_damage() : SpellScriptLoader("spell_pal_exorcism_and_holy_wrath_damage") { } + PrepareAuraScript(spell_pal_exorcism_and_holy_wrath_damage); - class spell_pal_exorcism_and_holy_wrath_damage_AuraScript : public AuraScript + void HandleEffectCalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod) + { + if (!spellMod) { - PrepareAuraScript(spell_pal_exorcism_and_holy_wrath_damage_AuraScript); - - void HandleEffectCalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod) - { - if (!spellMod) - { - spellMod = new SpellModifier(aurEff->GetBase()); - spellMod->op = SPELLMOD_DAMAGE; - spellMod->type = SPELLMOD_FLAT; - spellMod->spellId = GetId(); - spellMod->mask[1] = 0x200002; - } - - spellMod->value = aurEff->GetAmount(); - } + spellMod = new SpellModifier(aurEff->GetBase()); + spellMod->op = SPELLMOD_DAMAGE; + spellMod->type = SPELLMOD_FLAT; + spellMod->spellId = GetId(); + spellMod->mask[1] = 0x200002; + } - void Register() override - { - DoEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_pal_exorcism_and_holy_wrath_damage_AuraScript::HandleEffectCalcSpellMod, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + spellMod->value = aurEff->GetAmount(); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_exorcism_and_holy_wrath_damage_AuraScript(); - } + void Register() override + { + DoEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_pal_exorcism_and_holy_wrath_damage::HandleEffectCalcSpellMod, EFFECT_0, SPELL_AURA_DUMMY); + } }; // -9799 - Eye for an Eye -class spell_pal_eye_for_an_eye : public SpellScriptLoader +class spell_pal_eye_for_an_eye : public AuraScript { - public: - spell_pal_eye_for_an_eye() : SpellScriptLoader("spell_pal_eye_for_an_eye") { } - - class spell_pal_eye_for_an_eye_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_eye_for_an_eye_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PALADIN_EYE_FOR_AN_EYE_DAMAGE }); - } + PrepareAuraScript(spell_pal_eye_for_an_eye); - void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - DamageInfo* damageInfo = eventInfo.GetDamageInfo(); - if (!damageInfo || !damageInfo->GetDamage()) - return; + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_EYE_FOR_AN_EYE_DAMAGE }); + } - // return damage % to attacker but < 50% own total health - int32 damage = std::min(CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()), static_cast<int32>(GetTarget()->GetMaxHealth()) / 2); - CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(damage); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_PALADIN_EYE_FOR_AN_EYE_DAMAGE, args); - } + void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + if (!damageInfo || !damageInfo->GetDamage()) + return; - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_pal_eye_for_an_eye_AuraScript::OnProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + // return damage % to attacker but < 50% own total health + int32 damage = std::min(CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()), static_cast<int32>(GetTarget()->GetMaxHealth()) / 2); + CastSpellExtraArgs args(aurEff); + args.AddSpellBP0(damage); + GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_PALADIN_EYE_FOR_AN_EYE_DAMAGE, args); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_eye_for_an_eye_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_pal_eye_for_an_eye::OnProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // 54939 - Glyph of Divinity -class spell_pal_glyph_of_divinity : public SpellScriptLoader +class spell_pal_glyph_of_divinity : public AuraScript { - public: - spell_pal_glyph_of_divinity() : SpellScriptLoader("spell_pal_glyph_of_divinity") { } + PrepareAuraScript(spell_pal_glyph_of_divinity); - class spell_pal_glyph_of_divinity_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_glyph_of_divinity_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PALADIN_GLYPH_OF_DIVINITY_PROC }); - } - - void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - // Lay on Hands (Rank 1) does not have mana effect - SpellInfo const* spellInfo = eventInfo.GetSpellInfo(); - if (!spellInfo || spellInfo->Effects[EFFECT_1].Effect != SPELL_EFFECT_ENERGIZE) - return; + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_GLYPH_OF_DIVINITY_PROC }); + } - Unit* caster = eventInfo.GetActor(); - if (caster == eventInfo.GetProcTarget()) - return; + void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + // Lay on Hands (Rank 1) does not have mana effect + SpellInfo const* spellInfo = eventInfo.GetSpellInfo(); + if (!spellInfo || spellInfo->Effects[EFFECT_1].Effect != SPELL_EFFECT_ENERGIZE) + return; - CastSpellExtraArgs args(aurEff); - args.AddSpellMod(SPELLVALUE_BASE_POINT1, spellInfo->Effects[EFFECT_1].CalcValue() * 2); - caster->CastSpell(nullptr, SPELL_PALADIN_GLYPH_OF_DIVINITY_PROC, args); - } + Unit* caster = eventInfo.GetActor(); + if (caster == eventInfo.GetProcTarget()) + return; - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_pal_glyph_of_divinity_AuraScript::OnProc, EFFECT_0, SPELL_AURA_ADD_PCT_MODIFIER); - } - }; + CastSpellExtraArgs args(aurEff); + args.AddSpellMod(SPELLVALUE_BASE_POINT1, spellInfo->Effects[EFFECT_1].CalcValue() * 2); + caster->CastSpell(nullptr, SPELL_PALADIN_GLYPH_OF_DIVINITY_PROC, args); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_glyph_of_divinity_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_pal_glyph_of_divinity::OnProc, EFFECT_0, SPELL_AURA_ADD_PCT_MODIFIER); + } }; // 54968 - Glyph of Holy Light -class spell_pal_glyph_of_holy_light : public SpellScriptLoader +class spell_pal_glyph_of_holy_light : public SpellScript { - public: - spell_pal_glyph_of_holy_light() : SpellScriptLoader("spell_pal_glyph_of_holy_light") { } - - class spell_pal_glyph_of_holy_light_SpellScript : public SpellScript - { - PrepareSpellScript(spell_pal_glyph_of_holy_light_SpellScript); - - void FilterTargets(std::list<WorldObject*>& targets) - { - uint32 const maxTargets = GetSpellInfo()->MaxAffectedTargets; + PrepareSpellScript(spell_pal_glyph_of_holy_light); - targets.remove(GetCaster()); - if (targets.size() > maxTargets) - { - targets.sort(Trinity::HealthPctOrderPred()); - targets.resize(maxTargets); - } - } - - void Register() override - { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pal_glyph_of_holy_light_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ALLY); - } - }; + void FilterTargets(std::list<WorldObject*>& targets) + { + uint32 const maxTargets = GetSpellInfo()->MaxAffectedTargets; - SpellScript* GetSpellScript() const override + targets.remove(GetCaster()); + if (targets.size() > maxTargets) { - return new spell_pal_glyph_of_holy_light_SpellScript(); + targets.sort(Trinity::HealthPctOrderPred()); + targets.resize(maxTargets); } + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pal_glyph_of_holy_light::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ALLY); + } }; // 54937 - Glyph of Holy Light (dummy aura) -class spell_pal_glyph_of_holy_light_dummy : public SpellScriptLoader +class spell_pal_glyph_of_holy_light_dummy : public AuraScript { - public: - spell_pal_glyph_of_holy_light_dummy() : SpellScriptLoader("spell_pal_glyph_of_holy_light_dummy") { } + PrepareAuraScript(spell_pal_glyph_of_holy_light_dummy); - class spell_pal_glyph_of_holy_light_dummy_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_glyph_of_holy_light_dummy_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PALADIN_GLYPH_OF_HOLY_LIGHT_HEAL }); - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_GLYPH_OF_HOLY_LIGHT_HEAL }); + } - uint32 basePoints = healInfo->GetSpellInfo()->Effects[EFFECT_0].BasePoints + healInfo->GetSpellInfo()->Effects[EFFECT_0].DieSides; - uint32 healAmount; - if (healInfo->GetEffectiveHeal() >= basePoints) - healAmount = healInfo->GetEffectiveHeal(); - else - healAmount = healInfo->GetHeal(); + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + HealInfo* healInfo = eventInfo.GetHealInfo(); + if (!healInfo || !healInfo->GetHeal()) + return; - CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(CalculatePct(healAmount, aurEff->GetAmount())); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_PALADIN_GLYPH_OF_HOLY_LIGHT_HEAL, args); - } + uint32 basePoints = healInfo->GetSpellInfo()->Effects[EFFECT_0].BasePoints + healInfo->GetSpellInfo()->Effects[EFFECT_0].DieSides; + uint32 healAmount; + if (healInfo->GetEffectiveHeal() >= basePoints) + healAmount = healInfo->GetEffectiveHeal(); + else + healAmount = healInfo->GetHeal(); - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_pal_glyph_of_holy_light_dummy_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + CastSpellExtraArgs args(aurEff); + args.AddSpellBP0(CalculatePct(healAmount, aurEff->GetAmount())); + eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_PALADIN_GLYPH_OF_HOLY_LIGHT_HEAL, args); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_glyph_of_holy_light_dummy_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_pal_glyph_of_holy_light_dummy::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // 63521 - Guarded by The Light -class spell_pal_guarded_by_the_light : public SpellScriptLoader +class spell_pal_guarded_by_the_light : public SpellScript { - public: - spell_pal_guarded_by_the_light() : SpellScriptLoader("spell_pal_guarded_by_the_light") { } + PrepareSpellScript(spell_pal_guarded_by_the_light); - class spell_pal_guarded_by_the_light_SpellScript : public SpellScript - { - PrepareSpellScript(spell_pal_guarded_by_the_light_SpellScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PALADIN_DIVINE_PLEA }); - } - - void HandleScriptEffect(SpellEffIndex /*effIndex*/) - { - // Divine Plea - if (Aura* aura = GetCaster()->GetAura(SPELL_PALADIN_DIVINE_PLEA)) - aura->RefreshDuration(); - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_DIVINE_PLEA }); + } - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_pal_guarded_by_the_light_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + // Divine Plea + if (Aura* aura = GetCaster()->GetAura(SPELL_PALADIN_DIVINE_PLEA)) + aura->RefreshDuration(); + } - SpellScript* GetSpellScript() const override - { - return new spell_pal_guarded_by_the_light_SpellScript(); - } + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_pal_guarded_by_the_light::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } }; // 6940 - Hand of Sacrifice @@ -932,200 +767,156 @@ class spell_pal_hand_of_sacrifice : public AuraScript }; // 1038 - Hand of Salvation -class spell_pal_hand_of_salvation : public SpellScriptLoader +class spell_pal_hand_of_salvation : public AuraScript { - public: - spell_pal_hand_of_salvation() : SpellScriptLoader("spell_pal_hand_of_salvation") { } - - class spell_pal_hand_of_salvation_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_hand_of_salvation_AuraScript); - - void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) - { - if (Unit* caster = GetCaster()) - { - // Glyph of Salvation - if (caster->GetGUID() == GetUnitOwner()->GetGUID()) - if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_PALADIN_GLYPH_OF_SALVATION, EFFECT_0)) - amount -= aurEff->GetAmount(); - } - } - - void Register() override - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pal_hand_of_salvation_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN); - } - }; + PrepareAuraScript(spell_pal_hand_of_salvation); - AuraScript* GetAuraScript() const override + void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* caster = GetCaster()) { - return new spell_pal_hand_of_salvation_AuraScript(); + // Glyph of Salvation + if (caster->GetGUID() == GetUnitOwner()->GetGUID()) + if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_PALADIN_GLYPH_OF_SALVATION, EFFECT_0)) + amount -= aurEff->GetAmount(); } + } + + void Register() override + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pal_hand_of_salvation::CalculateAmount, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN); + } }; // -20335 - Heart of the Crusader -class spell_pal_heart_of_the_crusader : public SpellScriptLoader +class spell_pal_heart_of_the_crusader : public AuraScript { - public: - spell_pal_heart_of_the_crusader() : SpellScriptLoader("spell_pal_heart_of_the_crusader") { } + PrepareAuraScript(spell_pal_heart_of_the_crusader); - class spell_pal_heart_of_the_crusader_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_heart_of_the_crusader_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PALADIN_HEART_OF_THE_CRUSADER_EFF_R1 }); - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_HEART_OF_THE_CRUSADER_EFF_R1 }); + } - uint32 spellId = sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HEART_OF_THE_CRUSADER_EFF_R1, GetSpellInfo()->GetRank()); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), spellId, aurEff); - } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_pal_heart_of_the_crusader_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + uint32 spellId = sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HEART_OF_THE_CRUSADER_EFF_R1, GetSpellInfo()->GetRank()); + eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), spellId, aurEff); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_heart_of_the_crusader_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_pal_heart_of_the_crusader::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // -20473 - Holy Shock -class spell_pal_holy_shock : public SpellScriptLoader +class spell_pal_holy_shock : public SpellScript { - public: - spell_pal_holy_shock() : SpellScriptLoader("spell_pal_holy_shock") { } + PrepareSpellScript(spell_pal_holy_shock); - class spell_pal_holy_shock_SpellScript : public SpellScript - { - PrepareSpellScript(spell_pal_holy_shock_SpellScript); - - bool Validate(SpellInfo const* spellInfo) override - { - SpellInfo const* firstRankSpellInfo = sSpellMgr->GetSpellInfo(SPELL_PALADIN_HOLY_SHOCK_R1); - if (!firstRankSpellInfo) - return false; + bool Validate(SpellInfo const* spellInfo) override + { + SpellInfo const* firstRankSpellInfo = sSpellMgr->GetSpellInfo(SPELL_PALADIN_HOLY_SHOCK_R1); + if (!firstRankSpellInfo) + return false; - // can't use other spell than holy shock due to spell_ranks dependency - if (!spellInfo->IsRankOf(firstRankSpellInfo)) - return false; + // can't use other spell than holy shock due to spell_ranks dependency + if (!spellInfo->IsRankOf(firstRankSpellInfo)) + return false; - uint8 rank = spellInfo->GetRank(); - if (!sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HOLY_SHOCK_R1_DAMAGE, rank, true) || !sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HOLY_SHOCK_R1_HEALING, rank, true)) - return false; + uint8 rank = spellInfo->GetRank(); + if (!sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HOLY_SHOCK_R1_DAMAGE, rank, true) || !sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HOLY_SHOCK_R1_HEALING, rank, true)) + return false; - return true; - } + return true; + } - void HandleDummy(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - if (Unit* unitTarget = GetHitUnit()) - { - uint8 rank = GetSpellInfo()->GetRank(); - if (caster->IsFriendlyTo(unitTarget)) - caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HOLY_SHOCK_R1_HEALING, rank), true); - else - caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HOLY_SHOCK_R1_DAMAGE, rank), true); - } - } + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (Unit* unitTarget = GetHitUnit()) + { + uint8 rank = GetSpellInfo()->GetRank(); + if (caster->IsFriendlyTo(unitTarget)) + caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HOLY_SHOCK_R1_HEALING, rank), true); + else + caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HOLY_SHOCK_R1_DAMAGE, rank), true); + } + } - SpellCastResult CheckCast() + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (Unit* target = GetExplTargetUnit()) + { + if (!caster->IsFriendlyTo(target)) { - Unit* caster = GetCaster(); - if (Unit* target = GetExplTargetUnit()) - { - if (!caster->IsFriendlyTo(target)) - { - if (!caster->IsValidAttackTarget(target)) - return SPELL_FAILED_BAD_TARGETS; - - if (!caster->isInFront(target)) - return SPELL_FAILED_UNIT_NOT_INFRONT; - } - } - else + if (!caster->IsValidAttackTarget(target)) return SPELL_FAILED_BAD_TARGETS; - return SPELL_CAST_OK; - } - void Register() override - { - OnCheckCast += SpellCheckCastFn(spell_pal_holy_shock_SpellScript::CheckCast); - OnEffectHitTarget += SpellEffectFn(spell_pal_holy_shock_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + if (!caster->isInFront(target)) + return SPELL_FAILED_UNIT_NOT_INFRONT; } - }; - - SpellScript* GetSpellScript() const override - { - return new spell_pal_holy_shock_SpellScript(); } + else + return SPELL_FAILED_BAD_TARGETS; + return SPELL_CAST_OK; + } + + void Register() override + { + OnCheckCast += SpellCheckCastFn(spell_pal_holy_shock::CheckCast); + OnEffectHitTarget += SpellEffectFn(spell_pal_holy_shock::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; // -20210 - Illumination -class spell_pal_illumination : public SpellScriptLoader +class spell_pal_illumination : public AuraScript { -public: - spell_pal_illumination() : SpellScriptLoader("spell_pal_illumination") { } + PrepareAuraScript(spell_pal_illumination); - class spell_pal_illumination_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override { - PrepareAuraScript(spell_pal_illumination_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override + return ValidateSpellInfo( { - return ValidateSpellInfo( - { - SPELL_PALADIN_HOLY_SHOCK_R1_HEALING, - SPELL_PALADIN_ILLUMINATION_ENERGIZE, - SPELL_PALADIN_HOLY_SHOCK_R1 - }); - } + SPELL_PALADIN_HOLY_SHOCK_R1_HEALING, + SPELL_PALADIN_ILLUMINATION_ENERGIZE, + SPELL_PALADIN_HOLY_SHOCK_R1 + }); + } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); - // this script is valid only for the Holy Shock procs of illumination - if (eventInfo.GetHealInfo() && eventInfo.GetHealInfo()->GetSpellInfo()) - { - SpellInfo const* originalSpell = nullptr; + // this script is valid only for the Holy Shock procs of illumination + if (eventInfo.GetHealInfo() && eventInfo.GetHealInfo()->GetSpellInfo()) + { + SpellInfo const* originalSpell = nullptr; - // if proc comes from the Holy Shock heal, need to get mana cost of original spell - else it's the original heal itself - if (eventInfo.GetHealInfo()->GetSpellInfo()->SpellFamilyFlags[1] & 0x00010000) - originalSpell = sSpellMgr->GetSpellInfo(sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HOLY_SHOCK_R1, eventInfo.GetHealInfo()->GetSpellInfo()->GetRank())); - else - originalSpell = eventInfo.GetHealInfo()->GetSpellInfo(); + // if proc comes from the Holy Shock heal, need to get mana cost of original spell - else it's the original heal itself + if (eventInfo.GetHealInfo()->GetSpellInfo()->SpellFamilyFlags[1] & 0x00010000) + originalSpell = sSpellMgr->GetSpellInfo(sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HOLY_SHOCK_R1, eventInfo.GetHealInfo()->GetSpellInfo()->GetRank())); + else + originalSpell = eventInfo.GetHealInfo()->GetSpellInfo(); - if (originalSpell && aurEff->GetSpellInfo()) - { - Unit* target = eventInfo.GetActor(); // Paladin is the target of the energize - uint32 bp = CalculatePct(originalSpell->CalcPowerCost(target, originalSpell->GetSchoolMask()), aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); - CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(bp); - target->CastSpell(target, SPELL_PALADIN_ILLUMINATION_ENERGIZE, args); - } + if (originalSpell && aurEff->GetSpellInfo()) + { + Unit* target = eventInfo.GetActor(); // Paladin is the target of the energize + uint32 bp = CalculatePct(originalSpell->CalcPowerCost(target, originalSpell->GetSchoolMask()), aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); + CastSpellExtraArgs args(aurEff); + args.AddSpellBP0(bp); + target->CastSpell(target, SPELL_PALADIN_ILLUMINATION_ENERGIZE, args); } } + } - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_pal_illumination_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); - } - }; - - AuraScript* GetAuraScript() const override + void Register() override { - return new spell_pal_illumination_AuraScript(); + OnEffectProc += AuraEffectProcFn(spell_pal_illumination::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); } }; @@ -1139,11 +930,11 @@ class spell_pal_immunities : public SpellScript bool Validate(SpellInfo const* /*spellInfo*/) override { return ValidateSpellInfo( - { - SPELL_PALADIN_FORBEARANCE, - SPELL_PALADIN_AVENGING_WRATH_MARKER, - SPELL_PALADIN_IMMUNE_SHIELD_MARKER - }); + { + SPELL_PALADIN_FORBEARANCE, + SPELL_PALADIN_AVENGING_WRATH_MARKER, + SPELL_PALADIN_IMMUNE_SHIELD_MARKER + }); } SpellCastResult CheckCast() @@ -1187,634 +978,485 @@ class spell_pal_immunities : public SpellScript // -20138 - Improved Devotion Aura // 31869 - Sanctified Retribution // -53379 - Swift Retribution -class spell_pal_improved_aura : public SpellScriptLoader +class spell_pal_improved_aura : public AuraScript { - public: - spell_pal_improved_aura(char const* name, uint32 spellId) : SpellScriptLoader(name), _spellId(spellId) { } - - class spell_pal_improved_aura_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_improved_aura_AuraScript); - - public: - spell_pal_improved_aura_AuraScript(uint32 spellId) : AuraScript(), _spellId(spellId) { } + PrepareAuraScript(spell_pal_improved_aura); - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - _spellId, - SPELL_PALADIN_SANCTIFIED_RETRIBUTION_R1, - SPELL_PALADIN_SWIFT_RETRIBUTION_R1 - }); - } - - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - GetTarget()->RemoveOwnedAura(_spellId, GetCasterGUID()); // need to remove to reapply spellmods - target->CastSpell(target, _spellId, true); - } +public: + spell_pal_improved_aura(uint32 spellId) : AuraScript(), _spellId(spellId) { } - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - uint32 spellId = GetSpellInfo()->GetFirstRankSpell()->Id; + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( + { + _spellId, + SPELL_PALADIN_SANCTIFIED_RETRIBUTION_R1, + SPELL_PALADIN_SWIFT_RETRIBUTION_R1 + }); + } - if ((spellId == SPELL_PALADIN_SANCTIFIED_RETRIBUTION_R1 && GetTarget()->GetAuraOfRankedSpell(SPELL_PALADIN_SWIFT_RETRIBUTION_R1)) - || (spellId == SPELL_PALADIN_SWIFT_RETRIBUTION_R1 && GetTarget()->GetAuraOfRankedSpell(SPELL_PALADIN_SANCTIFIED_RETRIBUTION_R1))) - return; + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + GetTarget()->RemoveOwnedAura(_spellId, GetCasterGUID()); // need to remove to reapply spellmods + target->CastSpell(target, _spellId, true); + } - GetTarget()->RemoveOwnedAura(_spellId, GetCasterGUID()); - } + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + uint32 spellId = GetSpellInfo()->GetFirstRankSpell()->Id; - void Register() override - { - AfterEffectApply += AuraEffectApplyFn(spell_pal_improved_aura_AuraScript::HandleEffectApply, EFFECT_FIRST_FOUND, SPELL_AURA_ADD_FLAT_MODIFIER, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectRemoveFn(spell_pal_improved_aura_AuraScript::HandleEffectRemove, EFFECT_FIRST_FOUND, SPELL_AURA_ADD_FLAT_MODIFIER, AURA_EFFECT_HANDLE_REAL); - } + if ((spellId == SPELL_PALADIN_SANCTIFIED_RETRIBUTION_R1 && GetTarget()->GetAuraOfRankedSpell(SPELL_PALADIN_SWIFT_RETRIBUTION_R1)) + || (spellId == SPELL_PALADIN_SWIFT_RETRIBUTION_R1 && GetTarget()->GetAuraOfRankedSpell(SPELL_PALADIN_SANCTIFIED_RETRIBUTION_R1))) + return; - private: - uint32 _spellId; - }; + GetTarget()->RemoveOwnedAura(_spellId, GetCasterGUID()); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_improved_aura_AuraScript(_spellId); - } + void Register() override + { + AfterEffectApply += AuraEffectApplyFn(spell_pal_improved_aura::HandleEffectApply, EFFECT_FIRST_FOUND, SPELL_AURA_ADD_FLAT_MODIFIER, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_pal_improved_aura::HandleEffectRemove, EFFECT_FIRST_FOUND, SPELL_AURA_ADD_FLAT_MODIFIER, AURA_EFFECT_HANDLE_REAL); + } - private: - uint32 _spellId; +private: + uint32 _spellId; }; // -20234 - Improved Lay on Hands -class spell_pal_improved_lay_of_hands : public SpellScriptLoader +class spell_pal_improved_lay_of_hands : public AuraScript { - public: - spell_pal_improved_lay_of_hands() : SpellScriptLoader("spell_pal_improved_lay_of_hands") { } + PrepareAuraScript(spell_pal_improved_lay_of_hands); - class spell_pal_improved_lay_of_hands_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_improved_lay_of_hands_AuraScript); - - bool Validate(SpellInfo const* spellInfo) override - { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - eventInfo.GetActionTarget()->CastSpell(eventInfo.GetActionTarget(), GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, { aurEff, GetTarget()->GetGUID() }); - } + bool Validate(SpellInfo const* spellInfo) override + { + return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + } - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_pal_improved_lay_of_hands_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); - } - }; + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + eventInfo.GetActionTarget()->CastSpell(eventInfo.GetActionTarget(), GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, { aurEff, GetTarget()->GetGUID() }); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_improved_lay_of_hands_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_pal_improved_lay_of_hands::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } }; // -53569 - Infusion of Light -class spell_pal_infusion_of_light : public SpellScriptLoader +class spell_pal_infusion_of_light : public AuraScript { - public: - spell_pal_infusion_of_light() : SpellScriptLoader("spell_pal_infusion_of_light") { } + PrepareAuraScript(spell_pal_infusion_of_light); - class spell_pal_infusion_of_light_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( { - PrepareAuraScript(spell_pal_infusion_of_light_AuraScript); + SPELL_PALADIN_SACRED_SHIELD, + SPELL_PALADIN_T9_HOLY_4P_BONUS, + SPELL_PALADIN_FLASH_OF_LIGHT_PROC + }); + } - bool Validate(SpellInfo const* /*spellInfo*/) override + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo()) + { + // Flash of Light HoT on Flash of Light when Sacred Shield active + if (spellInfo->SpellFamilyFlags[0] & 0x40000000 && spellInfo->SpellIconID == 242) { - return ValidateSpellInfo( - { - SPELL_PALADIN_SACRED_SHIELD, - SPELL_PALADIN_T9_HOLY_4P_BONUS, - SPELL_PALADIN_FLASH_OF_LIGHT_PROC - }); - } + PreventDefaultAction(); - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo()) + HealInfo* healInfo = eventInfo.GetHealInfo(); + if (!healInfo || !healInfo->GetHeal()) + return; + + Unit* procTarget = eventInfo.GetActionTarget(); + if (procTarget && procTarget->HasAura(SPELL_PALADIN_SACRED_SHIELD)) { - // Flash of Light HoT on Flash of Light when Sacred Shield active - if (spellInfo->SpellFamilyFlags[0] & 0x40000000 && spellInfo->SpellIconID == 242) - { - PreventDefaultAction(); - - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; - - Unit* procTarget = eventInfo.GetActionTarget(); - if (procTarget && procTarget->HasAura(SPELL_PALADIN_SACRED_SHIELD)) - { - Unit* target = GetTarget(); - int32 duration = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_FLASH_OF_LIGHT_PROC)->GetMaxDuration() / 1000; - int32 pct = GetSpellInfo()->Effects[EFFECT_2].CalcValue(); - ASSERT(duration > 0); - - int32 bp0 = CalculatePct(healInfo->GetHeal() / duration, pct); - - // Item - Paladin T9 Holy 4P Bonus - if (AuraEffect const* bonus = target->GetAuraEffect(SPELL_PALADIN_T9_HOLY_4P_BONUS, 0)) - AddPct(bp0, bonus->GetAmount()); - - CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(bp0); - target->CastSpell(procTarget, SPELL_PALADIN_FLASH_OF_LIGHT_PROC, args); - } - } - // but should not proc on non-critical Holy Shocks - else if ((spellInfo->SpellFamilyFlags[0] & 0x200000 || spellInfo->SpellFamilyFlags[1] & 0x10000) && !(eventInfo.GetHitMask() & PROC_HIT_CRITICAL)) - PreventDefaultAction(); - } - } + Unit* target = GetTarget(); + int32 duration = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_FLASH_OF_LIGHT_PROC)->GetMaxDuration() / 1000; + int32 pct = GetSpellInfo()->Effects[EFFECT_2].CalcValue(); + ASSERT(duration > 0); - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_pal_infusion_of_light_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); - } - }; + int32 bp0 = CalculatePct(healInfo->GetHeal() / duration, pct); - AuraScript* GetAuraScript() const override - { - return new spell_pal_infusion_of_light_AuraScript(); + // Item - Paladin T9 Holy 4P Bonus + if (AuraEffect const* bonus = target->GetAuraEffect(SPELL_PALADIN_T9_HOLY_4P_BONUS, 0)) + AddPct(bp0, bonus->GetAmount()); + + CastSpellExtraArgs args(aurEff); + args.AddSpellBP0(bp0); + target->CastSpell(procTarget, SPELL_PALADIN_FLASH_OF_LIGHT_PROC, args); + } + } + // but should not proc on non-critical Holy Shocks + else if ((spellInfo->SpellFamilyFlags[0] & 0x200000 || spellInfo->SpellFamilyFlags[1] & 0x10000) && !(eventInfo.GetHitMask() & PROC_HIT_CRITICAL)) + PreventDefaultAction(); } + } + + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_pal_infusion_of_light::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } }; // 37705 - Healing Discount -class spell_pal_item_healing_discount : public SpellScriptLoader +class spell_pal_item_healing_discount : public AuraScript { - public: - spell_pal_item_healing_discount() : SpellScriptLoader("spell_pal_item_healing_discount") { } - - class spell_pal_item_healing_discount_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_item_healing_discount_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PALADIN_ITEM_HEALING_TRANCE }); - } + PrepareAuraScript(spell_pal_item_healing_discount); - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) - { - PreventDefaultAction(); - GetTarget()->CastSpell(GetTarget(), SPELL_PALADIN_ITEM_HEALING_TRANCE, aurEff); - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_ITEM_HEALING_TRANCE }); + } - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_pal_item_healing_discount_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); - } - }; + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); + GetTarget()->CastSpell(GetTarget(), SPELL_PALADIN_ITEM_HEALING_TRANCE, aurEff); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_item_healing_discount_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_pal_item_healing_discount::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } }; // 40470 - Paladin Tier 6 Trinket -class spell_pal_item_t6_trinket : public SpellScriptLoader +class spell_pal_item_t6_trinket : public AuraScript { - public: - spell_pal_item_t6_trinket() : SpellScriptLoader("spell_pal_item_t6_trinket") { } + PrepareAuraScript(spell_pal_item_t6_trinket); - class spell_pal_item_t6_trinket_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( { - PrepareAuraScript(spell_pal_item_t6_trinket_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - SPELL_PALADIN_ENDURING_LIGHT, - SPELL_PALADIN_ENDURING_JUDGEMENT - }); - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - SpellInfo const* spellInfo = eventInfo.GetSpellInfo(); - if (!spellInfo) - return; - - uint32 spellId; - int32 chance; - - // Holy Light & Flash of Light - if (spellInfo->SpellFamilyFlags[0] & 0xC0000000) - { - spellId = SPELL_PALADIN_ENDURING_LIGHT; - chance = 15; - } - // Judgements - else if (spellInfo->SpellFamilyFlags[0] & 0x00800000) - { - spellId = SPELL_PALADIN_ENDURING_JUDGEMENT; - chance = 50; - } - else - return; + SPELL_PALADIN_ENDURING_LIGHT, + SPELL_PALADIN_ENDURING_JUDGEMENT + }); + } - if (roll_chance_i(chance)) - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), spellId, aurEff); - } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + SpellInfo const* spellInfo = eventInfo.GetSpellInfo(); + if (!spellInfo) + return; - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_pal_item_t6_trinket_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + uint32 spellId; + int32 chance; - AuraScript* GetAuraScript() const override + // Holy Light & Flash of Light + if (spellInfo->SpellFamilyFlags[0] & 0xC0000000) + { + spellId = SPELL_PALADIN_ENDURING_LIGHT; + chance = 15; + } + // Judgements + else if (spellInfo->SpellFamilyFlags[0] & 0x00800000) { - return new spell_pal_item_t6_trinket_AuraScript(); + spellId = SPELL_PALADIN_ENDURING_JUDGEMENT; + chance = 50; } + else + return; + + if (roll_chance_i(chance)) + eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), spellId, aurEff); + } + + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_pal_item_t6_trinket::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // 53407 - Judgement of Justice // 20271 - Judgement of Light // 53408 - Judgement of Wisdom -class spell_pal_judgement : public SpellScriptLoader +class spell_pal_judgement : public SpellScript { - public: - spell_pal_judgement(char const* scriptName, uint32 spellId) : SpellScriptLoader(scriptName), _spellId(spellId) { } + PrepareSpellScript(spell_pal_judgement); - class spell_pal_judgement_SpellScript : public SpellScript - { - PrepareSpellScript(spell_pal_judgement_SpellScript); +public: + spell_pal_judgement(uint32 spellId) : SpellScript(), _spellId(spellId) { } - public: - spell_pal_judgement_SpellScript(uint32 spellId) : SpellScript(), _spellId(spellId) { } +private: + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( + { + SPELL_PALADIN_JUDGEMENT_DAMAGE, + _spellId + }); + } - private: - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - SPELL_PALADIN_JUDGEMENT_DAMAGE, - _spellId - }); - } + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + uint32 spellId2 = SPELL_PALADIN_JUDGEMENT_DAMAGE; - void HandleScriptEffect(SpellEffIndex /*effIndex*/) + // some seals have SPELL_AURA_DUMMY in EFFECT_2 + Unit::AuraEffectList const& auras = GetCaster()->GetAuraEffectsByType(SPELL_AURA_DUMMY); + for (Unit::AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i) + { + if ((*i)->GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_SEAL && (*i)->GetEffIndex() == EFFECT_2) { - uint32 spellId2 = SPELL_PALADIN_JUDGEMENT_DAMAGE; - - // some seals have SPELL_AURA_DUMMY in EFFECT_2 - Unit::AuraEffectList const& auras = GetCaster()->GetAuraEffectsByType(SPELL_AURA_DUMMY); - for (Unit::AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i) + if (sSpellMgr->GetSpellInfo((*i)->GetAmount())) { - if ((*i)->GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_SEAL && (*i)->GetEffIndex() == EFFECT_2) - { - if (sSpellMgr->GetSpellInfo((*i)->GetAmount())) - { - spellId2 = (*i)->GetAmount(); - break; - } - } + spellId2 = (*i)->GetAmount(); + break; } - - GetCaster()->CastSpell(GetHitUnit(), _spellId, true); - GetCaster()->CastSpell(GetHitUnit(), spellId2, true); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_pal_judgement_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } + } - uint32 const _spellId; - }; + GetCaster()->CastSpell(GetHitUnit(), _spellId, true); + GetCaster()->CastSpell(GetHitUnit(), spellId2, true); + } - SpellScript* GetSpellScript() const override - { - return new spell_pal_judgement_SpellScript(_spellId); - } + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_pal_judgement::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } - private: - uint32 const _spellId; + uint32 const _spellId; }; // 20425 - Judgement of Command -class spell_pal_judgement_of_command : public SpellScriptLoader +class spell_pal_judgement_of_command : public SpellScript { - public: - spell_pal_judgement_of_command() : SpellScriptLoader("spell_pal_judgement_of_command") { } - - class spell_pal_judgement_of_command_SpellScript : public SpellScript - { - PrepareSpellScript(spell_pal_judgement_of_command_SpellScript); + PrepareSpellScript(spell_pal_judgement_of_command); - void HandleDummy(SpellEffIndex /*effIndex*/) - { - if (Unit* unitTarget = GetHitUnit()) - GetCaster()->CastSpell(unitTarget, GetEffectValue(), true); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_pal_judgement_of_command_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Unit* unitTarget = GetHitUnit()) + GetCaster()->CastSpell(unitTarget, GetEffectValue(), true); + } - SpellScript* GetSpellScript() const override - { - return new spell_pal_judgement_of_command_SpellScript(); - } + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_pal_judgement_of_command::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } }; // 20185 - Judgement of Light -class spell_pal_judgement_of_light_heal : public SpellScriptLoader +class spell_pal_judgement_of_light_heal : public AuraScript { - public: - spell_pal_judgement_of_light_heal() : SpellScriptLoader("spell_pal_judgement_of_light_heal") { } - - class spell_pal_judgement_of_light_heal_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_judgement_of_light_heal_AuraScript); + PrepareAuraScript(spell_pal_judgement_of_light_heal); - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PALADIN_JUDGEMENT_OF_LIGHT_HEAL }); - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_JUDGEMENT_OF_LIGHT_HEAL }); + } - Unit* caster = eventInfo.GetProcTarget(); + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); - CastSpellExtraArgs args(aurEff); - args.OriginalCaster = GetCasterGUID(); - args.AddSpellBP0(caster->CountPctFromMaxHealth(aurEff->GetAmount())); - caster->CastSpell(nullptr, SPELL_PALADIN_JUDGEMENT_OF_LIGHT_HEAL, args); - } + Unit* caster = eventInfo.GetProcTarget(); - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_pal_judgement_of_light_heal_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + CastSpellExtraArgs args(aurEff); + args.OriginalCaster = GetCasterGUID(); + args.AddSpellBP0(caster->CountPctFromMaxHealth(aurEff->GetAmount())); + caster->CastSpell(nullptr, SPELL_PALADIN_JUDGEMENT_OF_LIGHT_HEAL, args); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_judgement_of_light_heal_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_pal_judgement_of_light_heal::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // 20186 - Judgement of Wisdom -class spell_pal_judgement_of_wisdom_mana : public SpellScriptLoader +class spell_pal_judgement_of_wisdom_mana : public AuraScript { - public: - spell_pal_judgement_of_wisdom_mana() : SpellScriptLoader("spell_pal_judgement_of_wisdom_mana") { } + PrepareAuraScript(spell_pal_judgement_of_wisdom_mana); - class spell_pal_judgement_of_wisdom_mana_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_judgement_of_wisdom_mana_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PALADIN_JUDGEMENT_OF_WISDOM_MANA }); - } - - bool CheckProc(ProcEventInfo& eventInfo) - { - return eventInfo.GetProcTarget()->GetPowerType() == POWER_MANA; - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_JUDGEMENT_OF_WISDOM_MANA }); + } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); + bool CheckProc(ProcEventInfo& eventInfo) + { + return eventInfo.GetProcTarget()->GetPowerType() == POWER_MANA; + } - SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_JUDGEMENT_OF_WISDOM_MANA); + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); - Unit* caster = eventInfo.GetProcTarget(); - int32 const amount = CalculatePct(static_cast<int32>(caster->GetCreateMana()), spellInfo->Effects[EFFECT_0].CalcValue()); - CastSpellExtraArgs args(aurEff); - args.OriginalCaster = GetCasterGUID(); - args.AddSpellBP0(amount); - caster->CastSpell(nullptr, spellInfo->Id, args); - } + SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_JUDGEMENT_OF_WISDOM_MANA); - void Register() override - { - DoCheckProc += AuraCheckProcFn(spell_pal_judgement_of_wisdom_mana_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_pal_judgement_of_wisdom_mana_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + Unit* caster = eventInfo.GetProcTarget(); + int32 const amount = CalculatePct(static_cast<int32>(caster->GetCreateMana()), spellInfo->Effects[EFFECT_0].CalcValue()); + CastSpellExtraArgs args(aurEff); + args.OriginalCaster = GetCasterGUID(); + args.AddSpellBP0(amount); + caster->CastSpell(nullptr, spellInfo->Id, args); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_judgement_of_wisdom_mana_AuraScript(); - } + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_pal_judgement_of_wisdom_mana::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_pal_judgement_of_wisdom_mana::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // -53695 - Judgements of the Just -class spell_pal_judgements_of_the_just : public SpellScriptLoader +class spell_pal_judgements_of_the_just : public AuraScript { - public: - spell_pal_judgements_of_the_just() : SpellScriptLoader("spell_pal_judgements_of_the_just") { } - - class spell_pal_judgements_of_the_just_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_judgements_of_the_just_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PALADIN_JUDGEMENTS_OF_THE_JUST_PROC }); - } + PrepareAuraScript(spell_pal_judgements_of_the_just); - void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - GetTarget()->CastSpell(eventInfo.GetActionTarget(), SPELL_PALADIN_JUDGEMENTS_OF_THE_JUST_PROC, aurEff); - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_JUDGEMENTS_OF_THE_JUST_PROC }); + } - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_pal_judgements_of_the_just_AuraScript::OnProc, EFFECT_0, SPELL_AURA_ADD_FLAT_MODIFIER); - } - }; + void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + GetTarget()->CastSpell(eventInfo.GetActionTarget(), SPELL_PALADIN_JUDGEMENTS_OF_THE_JUST_PROC, aurEff); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_judgements_of_the_just_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_pal_judgements_of_the_just::OnProc, EFFECT_0, SPELL_AURA_ADD_FLAT_MODIFIER); + } }; // -31876 - Judgements of the Wise -class spell_pal_judgements_of_the_wise : public SpellScriptLoader +class spell_pal_judgements_of_the_wise : public AuraScript { - public: - spell_pal_judgements_of_the_wise() : SpellScriptLoader("spell_pal_judgements_of_the_wise") { } + PrepareAuraScript(spell_pal_judgements_of_the_wise); - class spell_pal_judgements_of_the_wise_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( { - PrepareAuraScript(spell_pal_judgements_of_the_wise_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - SPELL_REPLENISHMENT, - SPELL_PALADIN_JUDGEMENTS_OF_THE_WISE_MANA - }); - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); + SPELL_REPLENISHMENT, + SPELL_PALADIN_JUDGEMENTS_OF_THE_WISE_MANA + }); + } - Unit* caster = eventInfo.GetActor(); - caster->CastSpell(nullptr, SPELL_PALADIN_JUDGEMENTS_OF_THE_WISE_MANA, aurEff); - caster->CastSpell(nullptr, SPELL_REPLENISHMENT, aurEff); - } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_pal_judgements_of_the_wise_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + Unit* caster = eventInfo.GetActor(); + caster->CastSpell(nullptr, SPELL_PALADIN_JUDGEMENTS_OF_THE_WISE_MANA, aurEff); + caster->CastSpell(nullptr, SPELL_REPLENISHMENT, aurEff); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_judgements_of_the_wise_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_pal_judgements_of_the_wise::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // -633 - Lay on Hands -class spell_pal_lay_on_hands : public SpellScriptLoader +class spell_pal_lay_on_hands : public SpellScript { - public: - spell_pal_lay_on_hands() : SpellScriptLoader("spell_pal_lay_on_hands") { } + PrepareSpellScript(spell_pal_lay_on_hands); - class spell_pal_lay_on_hands_SpellScript : public SpellScript + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo( { - PrepareSpellScript(spell_pal_lay_on_hands_SpellScript); - - bool Validate(SpellInfo const* /*spell*/) override - { - return ValidateSpellInfo( - { - SPELL_PALADIN_FORBEARANCE, - SPELL_PALADIN_AVENGING_WRATH_MARKER, - SPELL_PALADIN_IMMUNE_SHIELD_MARKER - }); - } - - SpellCastResult CheckCast() - { - Unit* caster = GetCaster(); - if (Unit* target = GetExplTargetUnit()) - if (caster == target) - if (target->HasAura(SPELL_PALADIN_FORBEARANCE) || target->HasAura(SPELL_PALADIN_AVENGING_WRATH_MARKER) || target->HasAura(SPELL_PALADIN_IMMUNE_SHIELD_MARKER)) - return SPELL_FAILED_TARGET_AURASTATE; - - return SPELL_CAST_OK; - } + SPELL_PALADIN_FORBEARANCE, + SPELL_PALADIN_AVENGING_WRATH_MARKER, + SPELL_PALADIN_IMMUNE_SHIELD_MARKER + }); + } - void HandleScript() - { - Unit* caster = GetCaster(); - if (caster == GetHitUnit()) - { - caster->CastSpell(caster, SPELL_PALADIN_FORBEARANCE, true); - caster->CastSpell(caster, SPELL_PALADIN_AVENGING_WRATH_MARKER, true); - caster->CastSpell(caster, SPELL_PALADIN_IMMUNE_SHIELD_MARKER, true); - } - } + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (Unit* target = GetExplTargetUnit()) + if (caster == target) + if (target->HasAura(SPELL_PALADIN_FORBEARANCE) || target->HasAura(SPELL_PALADIN_AVENGING_WRATH_MARKER) || target->HasAura(SPELL_PALADIN_IMMUNE_SHIELD_MARKER)) + return SPELL_FAILED_TARGET_AURASTATE; - void Register() override - { - OnCheckCast += SpellCheckCastFn(spell_pal_lay_on_hands_SpellScript::CheckCast); - AfterHit += SpellHitFn(spell_pal_lay_on_hands_SpellScript::HandleScript); - } - }; + return SPELL_CAST_OK; + } - SpellScript* GetSpellScript() const override + void HandleScript() + { + Unit* caster = GetCaster(); + if (caster == GetHitUnit()) { - return new spell_pal_lay_on_hands_SpellScript(); + caster->CastSpell(caster, SPELL_PALADIN_FORBEARANCE, true); + caster->CastSpell(caster, SPELL_PALADIN_AVENGING_WRATH_MARKER, true); + caster->CastSpell(caster, SPELL_PALADIN_IMMUNE_SHIELD_MARKER, true); } + } + + void Register() override + { + OnCheckCast += SpellCheckCastFn(spell_pal_lay_on_hands::CheckCast); + AfterHit += SpellHitFn(spell_pal_lay_on_hands::HandleScript); + } }; // 53651 - Light's Beacon - Beacon of Light -class spell_pal_light_s_beacon : public SpellScriptLoader +class spell_pal_light_s_beacon : public AuraScript { - public: - spell_pal_light_s_beacon() : SpellScriptLoader("spell_pal_light_s_beacon") { } + PrepareAuraScript(spell_pal_light_s_beacon); - class spell_pal_light_s_beacon_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( { - PrepareAuraScript(spell_pal_light_s_beacon_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - SPELL_PALADIN_BEACON_OF_LIGHT, - SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_1, - SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_2, - SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_3, - SPELL_PALADIN_HOLY_LIGHT - }); - } + SPELL_PALADIN_BEACON_OF_LIGHT, + SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_1, + SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_2, + SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_3, + SPELL_PALADIN_HOLY_LIGHT + }); + } - bool CheckProc(ProcEventInfo& eventInfo) - { - if (GetTarget()->HasAura(SPELL_PALADIN_BEACON_OF_LIGHT, eventInfo.GetActor()->GetGUID())) - return false; - return true; - } + bool CheckProc(ProcEventInfo& eventInfo) + { + if (GetTarget()->HasAura(SPELL_PALADIN_BEACON_OF_LIGHT, eventInfo.GetActor()->GetGUID())) + return false; + return true; + } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); - SpellInfo const* procSpell = eventInfo.GetSpellInfo(); - if (!procSpell) - return; + SpellInfo const* procSpell = eventInfo.GetSpellInfo(); + if (!procSpell) + return; - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; + HealInfo* healInfo = eventInfo.GetHealInfo(); + if (!healInfo || !healInfo->GetHeal()) + return; - uint32 healSpellId = procSpell->IsRankOf(sSpellMgr->AssertSpellInfo(SPELL_PALADIN_HOLY_LIGHT)) ? SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_1 : SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_3; - uint32 heal = CalculatePct(healInfo->GetHeal(), aurEff->GetAmount()); + uint32 healSpellId = procSpell->IsRankOf(sSpellMgr->AssertSpellInfo(SPELL_PALADIN_HOLY_LIGHT)) ? SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_1 : SPELL_PALADIN_BEACON_OF_LIGHT_HEAL_3; + uint32 heal = CalculatePct(healInfo->GetHeal(), aurEff->GetAmount()); - Unit* beaconTarget = GetCaster(); - if (!beaconTarget || !beaconTarget->HasAura(SPELL_PALADIN_BEACON_OF_LIGHT, eventInfo.GetActor()->GetGUID())) - return; - - /// @todo: caster must be the healed unit to perform distance checks correctly - /// but that will break animation on clientside - /// caster in spell packets must be the healing unit - CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(heal); - eventInfo.GetActor()->CastSpell(beaconTarget, healSpellId, args); - } + Unit* beaconTarget = GetCaster(); + if (!beaconTarget || !beaconTarget->HasAura(SPELL_PALADIN_BEACON_OF_LIGHT, eventInfo.GetActor()->GetGUID())) + return; - void Register() override - { - DoCheckProc += AuraCheckProcFn(spell_pal_light_s_beacon_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_pal_light_s_beacon_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + /// @todo: caster must be the healed unit to perform distance checks correctly + /// but that will break animation on clientside + /// caster in spell packets must be the healing unit + CastSpellExtraArgs args(aurEff); + args.AddSpellBP0(heal); + eventInfo.GetActor()->CastSpell(beaconTarget, healSpellId, args); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_light_s_beacon_AuraScript(); - } + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_pal_light_s_beacon::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_pal_light_s_beacon::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // 31789 - Righteous Defense @@ -1866,210 +1508,166 @@ class spell_pal_righteous_defense : public SpellScript }; // -53380 - Righteous Vengeance -class spell_pal_righteous_vengeance : public SpellScriptLoader +class spell_pal_righteous_vengeance : public AuraScript { - public: - spell_pal_righteous_vengeance() : SpellScriptLoader("spell_pal_righteous_vengeance") { } - - class spell_pal_righteous_vengeance_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_righteous_vengeance_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PALADIN_RIGHTEOUS_VENGEANCE_DAMAGE }); - } + PrepareAuraScript(spell_pal_righteous_vengeance); - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_RIGHTEOUS_VENGEANCE_DAMAGE }); + } - DamageInfo* damageInfo = eventInfo.GetDamageInfo(); - if (!damageInfo || !damageInfo->GetDamage()) - return; + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); - Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + if (!damageInfo || !damageInfo->GetDamage()) + return; - SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_RIGHTEOUS_VENGEANCE_DAMAGE); - int32 amount = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()); + Unit* caster = eventInfo.GetActor(); + Unit* target = eventInfo.GetProcTarget(); - ASSERT(spellInfo->GetMaxTicks() > 0); - amount /= spellInfo->GetMaxTicks(); + SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_RIGHTEOUS_VENGEANCE_DAMAGE); + int32 amount = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()); - CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(amount); - caster->CastSpell(target, SPELL_PALADIN_RIGHTEOUS_VENGEANCE_DAMAGE, args); - } + ASSERT(spellInfo->GetMaxTicks() > 0); + amount /= spellInfo->GetMaxTicks(); - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_pal_righteous_vengeance_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + CastSpellExtraArgs args(aurEff); + args.AddSpellBP0(amount); + caster->CastSpell(target, SPELL_PALADIN_RIGHTEOUS_VENGEANCE_DAMAGE, args); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_righteous_vengeance_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_pal_righteous_vengeance::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // 58597 - Sacred Shield -class spell_pal_sacred_shield : public SpellScriptLoader +class spell_pal_sacred_shield : public AuraScript { - public: - spell_pal_sacred_shield() : SpellScriptLoader("spell_pal_sacred_shield") { } + PrepareAuraScript(spell_pal_sacred_shield); - class spell_pal_sacred_shield_AuraScript : public AuraScript + void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) + { + if (Unit* caster = GetCaster()) { - PrepareAuraScript(spell_pal_sacred_shield_AuraScript); + // +75.00% from sp bonus + float bonus = CalculatePct(caster->SpellBaseHealingBonusDone(GetSpellInfo()->GetSchoolMask()), 75.0f); - void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) - { - if (Unit* caster = GetCaster()) - { - // +75.00% from sp bonus - float bonus = CalculatePct(caster->SpellBaseHealingBonusDone(GetSpellInfo()->GetSchoolMask()), 75.0f); - - // Divine Guardian is only applied at the spell healing bonus because it was already applied to the base value in CalculateSpellDamage - bonus = caster->ApplyEffectModifiers(GetSpellInfo(), aurEff->GetEffIndex(), bonus); - bonus *= caster->CalculateSpellpowerCoefficientLevelPenalty(GetSpellInfo()); - - amount += int32(bonus); - - // Arena - Dampening - if (AuraEffect const* auraEffArenaDampening = caster->GetAuraEffect(SPELL_GENERIC_ARENA_DAMPENING, EFFECT_0)) - AddPct(amount, auraEffArenaDampening->GetAmount()); - // Battleground - Dampening - else if (AuraEffect const* auraEffBattlegroudDampening = caster->GetAuraEffect(SPELL_GENERIC_BATTLEGROUND_DAMPENING, EFFECT_0)) - AddPct(amount, auraEffBattlegroudDampening->GetAmount()); - - // ICC buff - if (AuraEffect const* auraStrengthOfWrynn = caster->GetAuraEffect(SPELL_AURA_MOD_HEALING_DONE_PERCENT, SPELLFAMILY_GENERIC, SPELL_ICON_ID_STRENGTH_OF_WRYNN, EFFECT_2)) - AddPct(amount, auraStrengthOfWrynn->GetAmount()); - else if (AuraEffect const* auraHellscreamsWarsong = caster->GetAuraEffect(SPELL_AURA_MOD_HEALING_DONE_PERCENT, SPELLFAMILY_GENERIC, SPELL_ICON_ID_HELLSCREAM_WARSONG, EFFECT_2)) - AddPct(amount, auraHellscreamsWarsong->GetAmount()); - } - } + // Divine Guardian is only applied at the spell healing bonus because it was already applied to the base value in CalculateSpellDamage + bonus = caster->ApplyEffectModifiers(GetSpellInfo(), aurEff->GetEffIndex(), bonus); + bonus *= caster->CalculateSpellpowerCoefficientLevelPenalty(GetSpellInfo()); - void Register() override - { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pal_sacred_shield_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); - } - }; + amount += int32(bonus); - AuraScript* GetAuraScript() const override - { - return new spell_pal_sacred_shield_AuraScript(); + // Arena - Dampening + if (AuraEffect const* auraEffArenaDampening = caster->GetAuraEffect(SPELL_GENERIC_ARENA_DAMPENING, EFFECT_0)) + AddPct(amount, auraEffArenaDampening->GetAmount()); + // Battleground - Dampening + else if (AuraEffect const* auraEffBattlegroudDampening = caster->GetAuraEffect(SPELL_GENERIC_BATTLEGROUND_DAMPENING, EFFECT_0)) + AddPct(amount, auraEffBattlegroudDampening->GetAmount()); + + // ICC buff + if (AuraEffect const* auraStrengthOfWrynn = caster->GetAuraEffect(SPELL_AURA_MOD_HEALING_DONE_PERCENT, SPELLFAMILY_GENERIC, SPELL_ICON_ID_STRENGTH_OF_WRYNN, EFFECT_2)) + AddPct(amount, auraStrengthOfWrynn->GetAmount()); + else if (AuraEffect const* auraHellscreamsWarsong = caster->GetAuraEffect(SPELL_AURA_MOD_HEALING_DONE_PERCENT, SPELLFAMILY_GENERIC, SPELL_ICON_ID_HELLSCREAM_WARSONG, EFFECT_2)) + AddPct(amount, auraHellscreamsWarsong->GetAmount()); } + } + + void Register() override + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pal_sacred_shield::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); + } }; // 53601 - Sacred Shield (dummy) -class spell_pal_sacred_shield_dummy : public SpellScriptLoader +class spell_pal_sacred_shield_dummy : public AuraScript { - public: - spell_pal_sacred_shield_dummy() : SpellScriptLoader("spell_pal_sacred_shield_dummy") { } + PrepareAuraScript(spell_pal_sacred_shield_dummy); - class spell_pal_sacred_shield_dummy_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( { - PrepareAuraScript(spell_pal_sacred_shield_dummy_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - SPELL_PALADIN_SACRED_SHIELD_TRIGGER, - SPELL_PALADIN_T8_HOLY_4P_BONUS - }); - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); + SPELL_PALADIN_SACRED_SHIELD_TRIGGER, + SPELL_PALADIN_T8_HOLY_4P_BONUS + }); + } - Unit* caster = GetCaster(); - if (!caster) - return; + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); - TimePoint now = GameTime::Now(); - if (_cooldownEnd > now) - return; + Unit* caster = GetCaster(); + if (!caster) + return; - Seconds cooldown(aurEff->GetAmount()); - if (AuraEffect const* bonus = caster->GetAuraEffect(SPELL_PALADIN_T8_HOLY_4P_BONUS, EFFECT_0, caster->GetGUID())) - cooldown = Seconds(bonus->GetAmount()); + TimePoint now = GameTime::Now(); + if (_cooldownEnd > now) + return; - _cooldownEnd = now + cooldown; - caster->CastSpell(eventInfo.GetActionTarget(), SPELL_PALADIN_SACRED_SHIELD_TRIGGER, aurEff); - } + Seconds cooldown(aurEff->GetAmount()); + if (AuraEffect const* bonus = caster->GetAuraEffect(SPELL_PALADIN_T8_HOLY_4P_BONUS, EFFECT_0, caster->GetGUID())) + cooldown = Seconds(bonus->GetAmount()); - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_pal_sacred_shield_dummy_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } + _cooldownEnd = now + cooldown; + caster->CastSpell(eventInfo.GetActionTarget(), SPELL_PALADIN_SACRED_SHIELD_TRIGGER, aurEff); + } - // Cooldown tracking can't be done in DB because of T8 bonus - TimePoint _cooldownEnd = std::chrono::steady_clock::time_point::min(); - }; + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_pal_sacred_shield_dummy::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_sacred_shield_dummy_AuraScript(); - } + // Cooldown tracking can't be done in DB because of T8 bonus + TimePoint _cooldownEnd = std::chrono::steady_clock::time_point::min(); }; // 20154, 21084 - Seal of Righteousness - melee proc dummy (addition ${$MWS*(0.022*$AP+0.044*$SPH)} damage) -class spell_pal_seal_of_righteousness : public SpellScriptLoader +class spell_pal_seal_of_righteousness : public AuraScript { - public: - spell_pal_seal_of_righteousness() : SpellScriptLoader("spell_pal_seal_of_righteousness") { } - - class spell_pal_seal_of_righteousness_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_seal_of_righteousness_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PALADIN_SEAL_OF_RIGHTEOUSNESS }); - } + PrepareAuraScript(spell_pal_seal_of_righteousness); - bool CheckProc(ProcEventInfo& eventInfo) - { - return eventInfo.GetProcTarget() != nullptr; - } + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_SEAL_OF_RIGHTEOUSNESS }); + } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); + bool CheckProc(ProcEventInfo& eventInfo) + { + return eventInfo.GetProcTarget() != nullptr; + } - Unit* victim = eventInfo.GetProcTarget(); + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); - float ap = GetTarget()->GetTotalAttackPowerValue(BASE_ATTACK); - ap += victim->GetTotalAuraModifier(SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS); + Unit* victim = eventInfo.GetProcTarget(); - int32 sph = GetTarget()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_HOLY); - sph += victim->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_DAMAGE_TAKEN, SPELL_SCHOOL_MASK_HOLY); + float ap = GetTarget()->GetTotalAttackPowerValue(BASE_ATTACK); + ap += victim->GetTotalAuraModifier(SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS); - float mws = GetTarget()->GetAttackTime(BASE_ATTACK); - mws /= 1000.0f; + int32 sph = GetTarget()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_HOLY); + sph += victim->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_DAMAGE_TAKEN, SPELL_SCHOOL_MASK_HOLY); - int32 bp = std::lroundf(mws * (0.022f * ap + 0.044f * sph)); - CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(bp); - GetTarget()->CastSpell(victim, SPELL_PALADIN_SEAL_OF_RIGHTEOUSNESS, args); - } + float mws = GetTarget()->GetAttackTime(BASE_ATTACK); + mws /= 1000.0f; - void Register() override - { - DoCheckProc += AuraCheckProcFn(spell_pal_seal_of_righteousness_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_pal_seal_of_righteousness_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + int32 bp = std::lroundf(mws * (0.022f * ap + 0.044f * sph)); + CastSpellExtraArgs args(aurEff); + args.AddSpellBP0(bp); + GetTarget()->CastSpell(victim, SPELL_PALADIN_SEAL_OF_RIGHTEOUSNESS, args); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_seal_of_righteousness_AuraScript(); - } + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_pal_seal_of_righteousness::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_pal_seal_of_righteousness::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // 31801 - Seal of Vengeance @@ -2177,299 +1775,244 @@ class spell_pal_seal_of_vengeance : public SpellScriptLoader // 41459 - Seal of Blood // 53720 - Seal of the Martyr // 53736 - Seal of Corruption -class spell_pal_seals : public SpellScriptLoader +class spell_pal_seals : public AuraScript { - public: - spell_pal_seals() : SpellScriptLoader("spell_pal_seals") { } - - class spell_pal_seals_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_seals_AuraScript); + PrepareAuraScript(spell_pal_seals); - // Effect 2 is used by Judgement code, we prevent the proc to avoid console logging of unknown spell trigger - bool CheckDummyProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/) - { - return false; - } - - void Register() override - { - DoCheckEffectProc += AuraCheckEffectProcFn(spell_pal_seals_AuraScript::CheckDummyProc, EFFECT_2, SPELL_AURA_DUMMY); - } - }; + // Effect 2 is used by Judgement code, we prevent the proc to avoid console logging of unknown spell trigger + bool CheckDummyProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/) + { + return false; + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_seals_AuraScript(); - } + void Register() override + { + DoCheckEffectProc += AuraCheckEffectProcFn(spell_pal_seals::CheckDummyProc, EFFECT_2, SPELL_AURA_DUMMY); + } }; // -31785 - Spiritual Attunement -class spell_pal_spiritual_attunement : public SpellScriptLoader +class spell_pal_spiritual_attunement : public AuraScript { - public: - spell_pal_spiritual_attunement() : SpellScriptLoader("spell_pal_spiritual_attunement") { } - - class spell_pal_spiritual_attunement_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_spiritual_attunement_AuraScript); + PrepareAuraScript(spell_pal_spiritual_attunement); - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PALADIN_SPIRITUAL_ATTUNEMENT_MANA }); - } - - bool CheckProc(ProcEventInfo& eventInfo) - { - // "when healed by other friendly targets' spells" - if (eventInfo.GetProcTarget() == eventInfo.GetActionTarget()) - return false; + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_SPIRITUAL_ATTUNEMENT_MANA }); + } - return eventInfo.GetHealInfo() && eventInfo.GetHealInfo()->GetEffectiveHeal(); - } + bool CheckProc(ProcEventInfo& eventInfo) + { + // "when healed by other friendly targets' spells" + if (eventInfo.GetProcTarget() == eventInfo.GetActionTarget()) + return false; - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - HealInfo* healInfo = eventInfo.GetHealInfo(); - int32 amount = CalculatePct(static_cast<int32>(healInfo->GetEffectiveHeal()), aurEff->GetAmount()); + return eventInfo.GetHealInfo() && eventInfo.GetHealInfo()->GetEffectiveHeal(); + } - CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(amount); - eventInfo.GetActionTarget()->CastSpell(nullptr, SPELL_PALADIN_SPIRITUAL_ATTUNEMENT_MANA, args); - } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + HealInfo* healInfo = eventInfo.GetHealInfo(); + int32 amount = CalculatePct(static_cast<int32>(healInfo->GetEffectiveHeal()), aurEff->GetAmount()); - void Register() override - { - DoCheckProc += AuraCheckProcFn(spell_pal_spiritual_attunement_AuraScript::CheckProc); - OnEffectProc += AuraEffectProcFn(spell_pal_spiritual_attunement_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + CastSpellExtraArgs args(aurEff); + args.AddSpellBP0(amount); + eventInfo.GetActionTarget()->CastSpell(nullptr, SPELL_PALADIN_SPIRITUAL_ATTUNEMENT_MANA, args); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_spiritual_attunement_AuraScript(); - } + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_pal_spiritual_attunement::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_pal_spiritual_attunement::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // -53501 - Sheath of Light -class spell_pal_sheath_of_light : public SpellScriptLoader +class spell_pal_sheath_of_light : public AuraScript { - public: - spell_pal_sheath_of_light() : SpellScriptLoader("spell_pal_sheath_of_light") { } + PrepareAuraScript(spell_pal_sheath_of_light); - class spell_pal_sheath_of_light_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_sheath_of_light_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PALADIN_SHEATH_OF_LIGHT_HEAL }); - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_SHEATH_OF_LIGHT_HEAL }); + } - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); - Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + HealInfo* healInfo = eventInfo.GetHealInfo(); + if (!healInfo || !healInfo->GetHeal()) + return; - SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_SHEATH_OF_LIGHT_HEAL); - int32 amount = CalculatePct(static_cast<int32>(healInfo->GetEffectiveHeal()), aurEff->GetAmount()); + Unit* caster = eventInfo.GetActor(); + Unit* target = eventInfo.GetProcTarget(); - ASSERT(spellInfo->GetMaxTicks() > 0); - amount /= spellInfo->GetMaxTicks(); + SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_SHEATH_OF_LIGHT_HEAL); + int32 amount = CalculatePct(static_cast<int32>(healInfo->GetEffectiveHeal()), aurEff->GetAmount()); - CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(amount); - caster->CastSpell(target, SPELL_PALADIN_SHEATH_OF_LIGHT_HEAL, args); - } + ASSERT(spellInfo->GetMaxTicks() > 0); + amount /= spellInfo->GetMaxTicks(); - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_pal_sheath_of_light_AuraScript::HandleProc, EFFECT_1, SPELL_AURA_DUMMY); - } - }; + CastSpellExtraArgs args(aurEff); + args.AddSpellBP0(amount); + caster->CastSpell(target, SPELL_PALADIN_SHEATH_OF_LIGHT_HEAL, args); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_sheath_of_light_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_pal_sheath_of_light::HandleProc, EFFECT_1, SPELL_AURA_DUMMY); + } }; // 28789 - Holy Power -class spell_pal_t3_6p_bonus : public SpellScriptLoader +class spell_pal_t3_6p_bonus : public AuraScript { - public: - spell_pal_t3_6p_bonus() : SpellScriptLoader("spell_pal_t3_6p_bonus") { } + PrepareAuraScript(spell_pal_t3_6p_bonus); - class spell_pal_t3_6p_bonus_AuraScript : public AuraScript + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( { - PrepareAuraScript(spell_pal_t3_6p_bonus_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo( - { - SPELL_PALADIN_HOLY_POWER_ARMOR, - SPELL_PALADIN_HOLY_POWER_ATTACK_POWER, - SPELL_PALADIN_HOLY_POWER_SPELL_POWER, - SPELL_PALADIN_HOLY_POWER_MP5 - }); - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - - uint32 spellId; - Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + SPELL_PALADIN_HOLY_POWER_ARMOR, + SPELL_PALADIN_HOLY_POWER_ATTACK_POWER, + SPELL_PALADIN_HOLY_POWER_SPELL_POWER, + SPELL_PALADIN_HOLY_POWER_MP5 + }); + } - switch (target->GetClass()) - { - case CLASS_PALADIN: - case CLASS_PRIEST: - case CLASS_SHAMAN: - case CLASS_DRUID: - spellId = SPELL_PALADIN_HOLY_POWER_MP5; - break; - case CLASS_MAGE: - case CLASS_WARLOCK: - spellId = SPELL_PALADIN_HOLY_POWER_SPELL_POWER; - break; - case CLASS_HUNTER: - case CLASS_ROGUE: - spellId = SPELL_PALADIN_HOLY_POWER_ATTACK_POWER; - break; - case CLASS_WARRIOR: - spellId = SPELL_PALADIN_HOLY_POWER_ARMOR; - break; - default: - return; - } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); - caster->CastSpell(target, spellId, aurEff); - } + uint32 spellId; + Unit* caster = eventInfo.GetActor(); + Unit* target = eventInfo.GetProcTarget(); + + switch (target->GetClass()) + { + case CLASS_PALADIN: + case CLASS_PRIEST: + case CLASS_SHAMAN: + case CLASS_DRUID: + spellId = SPELL_PALADIN_HOLY_POWER_MP5; + break; + case CLASS_MAGE: + case CLASS_WARLOCK: + spellId = SPELL_PALADIN_HOLY_POWER_SPELL_POWER; + break; + case CLASS_HUNTER: + case CLASS_ROGUE: + spellId = SPELL_PALADIN_HOLY_POWER_ATTACK_POWER; + break; + case CLASS_WARRIOR: + spellId = SPELL_PALADIN_HOLY_POWER_ARMOR; + break; + default: + return; + } - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_pal_t3_6p_bonus_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + caster->CastSpell(target, spellId, aurEff); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_t3_6p_bonus_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_pal_t3_6p_bonus::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; // 64890 - Item - Paladin T8 Holy 2P Bonus -class spell_pal_t8_2p_bonus : public SpellScriptLoader +class spell_pal_t8_2p_bonus : public AuraScript { - public: - spell_pal_t8_2p_bonus() : SpellScriptLoader("spell_pal_t8_2p_bonus") { } + PrepareAuraScript(spell_pal_t8_2p_bonus); - class spell_pal_t8_2p_bonus_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_t8_2p_bonus_AuraScript); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PALADIN_HOLY_MENDING }); - } - - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) - { - PreventDefaultAction(); + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_PALADIN_HOLY_MENDING }); + } - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); - Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + HealInfo* healInfo = eventInfo.GetHealInfo(); + if (!healInfo || !healInfo->GetHeal()) + return; - SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_HOLY_MENDING); - int32 amount = CalculatePct(static_cast<int32>(healInfo->GetHeal()), aurEff->GetAmount()); + Unit* caster = eventInfo.GetActor(); + Unit* target = eventInfo.GetProcTarget(); - ASSERT(spellInfo->GetMaxTicks() > 0); - amount /= spellInfo->GetMaxTicks(); + SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_HOLY_MENDING); + int32 amount = CalculatePct(static_cast<int32>(healInfo->GetHeal()), aurEff->GetAmount()); - CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(amount); - caster->CastSpell(target, SPELL_PALADIN_HOLY_MENDING, args); - } + ASSERT(spellInfo->GetMaxTicks() > 0); + amount /= spellInfo->GetMaxTicks(); - void Register() override - { - OnEffectProc += AuraEffectProcFn(spell_pal_t8_2p_bonus_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); - } - }; + CastSpellExtraArgs args(aurEff); + args.AddSpellBP0(amount); + caster->CastSpell(target, SPELL_PALADIN_HOLY_MENDING, args); + } - AuraScript* GetAuraScript() const override - { - return new spell_pal_t8_2p_bonus_AuraScript(); - } + void Register() override + { + OnEffectProc += AuraEffectProcFn(spell_pal_t8_2p_bonus::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } }; void AddSC_paladin_spell_scripts() { - new spell_pal_ardent_defender(); - new spell_pal_aura_mastery(); - new spell_pal_aura_mastery_immune(); - new spell_pal_avenging_wrath(); + RegisterSpellScript(spell_pal_ardent_defender); + RegisterSpellScript(spell_pal_aura_mastery); + RegisterSpellScript(spell_pal_aura_mastery_immune); + RegisterSpellScript(spell_pal_avenging_wrath); RegisterSpellScript(spell_pal_beacon_of_light); - new spell_pal_blessing_of_faith(); - new spell_pal_blessing_of_sanctuary(); - new spell_pal_divine_purpose(); + RegisterSpellScript(spell_pal_blessing_of_faith); + RegisterSpellScript(spell_pal_blessing_of_sanctuary); + RegisterSpellScript(spell_pal_divine_purpose); RegisterSpellScript(spell_pal_divine_sacrifice); - new spell_pal_divine_storm(); - new spell_pal_divine_storm_dummy(); - new spell_pal_exorcism_and_holy_wrath_damage(); - new spell_pal_eye_for_an_eye(); - new spell_pal_glyph_of_divinity(); - new spell_pal_glyph_of_holy_light(); - new spell_pal_glyph_of_holy_light_dummy(); - new spell_pal_guarded_by_the_light(); + RegisterSpellScript(spell_pal_divine_storm); + RegisterSpellScript(spell_pal_divine_storm_dummy); + RegisterSpellScript(spell_pal_exorcism_and_holy_wrath_damage); + RegisterSpellScript(spell_pal_eye_for_an_eye); + RegisterSpellScript(spell_pal_glyph_of_divinity); + RegisterSpellScript(spell_pal_glyph_of_holy_light); + RegisterSpellScript(spell_pal_glyph_of_holy_light_dummy); + RegisterSpellScript(spell_pal_guarded_by_the_light); RegisterSpellScript(spell_pal_hand_of_sacrifice); - new spell_pal_hand_of_salvation(); - new spell_pal_heart_of_the_crusader(); - new spell_pal_holy_shock(); - new spell_pal_illumination(); + RegisterSpellScript(spell_pal_hand_of_salvation); + RegisterSpellScript(spell_pal_heart_of_the_crusader); + RegisterSpellScript(spell_pal_holy_shock); + RegisterSpellScript(spell_pal_illumination); RegisterSpellScript(spell_pal_immunities); - new spell_pal_improved_aura("spell_pal_improved_concentraction_aura", SPELL_PALADIN_IMPROVED_CONCENTRACTION_AURA); - new spell_pal_improved_aura("spell_pal_improved_devotion_aura", SPELL_PALADIN_IMPROVED_DEVOTION_AURA); - new spell_pal_improved_aura("spell_pal_sanctified_retribution", SPELL_PALADIN_SANCTIFIED_RETRIBUTION_AURA); - new spell_pal_improved_aura("spell_pal_swift_retribution", SPELL_PALADIN_SANCTIFIED_RETRIBUTION_AURA); - new spell_pal_improved_lay_of_hands(); - new spell_pal_infusion_of_light(); - new spell_pal_item_healing_discount(); - new spell_pal_item_t6_trinket(); - new spell_pal_judgement("spell_pal_judgement_of_justice", SPELL_PALADIN_JUDGEMENT_OF_JUSTICE); - new spell_pal_judgement("spell_pal_judgement_of_light", SPELL_PALADIN_JUDGEMENT_OF_LIGHT); - new spell_pal_judgement("spell_pal_judgement_of_wisdom", SPELL_PALADIN_JUDGEMENT_OF_WISDOM); - new spell_pal_judgement_of_command(); - new spell_pal_judgement_of_light_heal(); - new spell_pal_judgement_of_wisdom_mana(); - new spell_pal_judgements_of_the_just(); - new spell_pal_judgements_of_the_wise(); - new spell_pal_lay_on_hands(); - new spell_pal_light_s_beacon(); + RegisterSpellScriptWithArgs(spell_pal_improved_aura, "spell_pal_improved_concentraction_aura", SPELL_PALADIN_IMPROVED_CONCENTRACTION_AURA); + RegisterSpellScriptWithArgs(spell_pal_improved_aura, "spell_pal_improved_devotion_aura", SPELL_PALADIN_IMPROVED_DEVOTION_AURA); + RegisterSpellScriptWithArgs(spell_pal_improved_aura, "spell_pal_sanctified_retribution", SPELL_PALADIN_SANCTIFIED_RETRIBUTION_AURA); + RegisterSpellScriptWithArgs(spell_pal_improved_aura, "spell_pal_swift_retribution", SPELL_PALADIN_SANCTIFIED_RETRIBUTION_AURA); + RegisterSpellScript(spell_pal_improved_lay_of_hands); + RegisterSpellScript(spell_pal_infusion_of_light); + RegisterSpellScript(spell_pal_item_healing_discount); + RegisterSpellScript(spell_pal_item_t6_trinket); + RegisterSpellScriptWithArgs(spell_pal_judgement, "spell_pal_judgement_of_justice", SPELL_PALADIN_JUDGEMENT_OF_JUSTICE); + RegisterSpellScriptWithArgs(spell_pal_judgement, "spell_pal_judgement_of_light", SPELL_PALADIN_JUDGEMENT_OF_LIGHT); + RegisterSpellScriptWithArgs(spell_pal_judgement, "spell_pal_judgement_of_wisdom", SPELL_PALADIN_JUDGEMENT_OF_WISDOM); + RegisterSpellScript(spell_pal_judgement_of_command); + RegisterSpellScript(spell_pal_judgement_of_light_heal); + RegisterSpellScript(spell_pal_judgement_of_wisdom_mana); + RegisterSpellScript(spell_pal_judgements_of_the_just); + RegisterSpellScript(spell_pal_judgements_of_the_wise); + RegisterSpellScript(spell_pal_lay_on_hands); + RegisterSpellScript(spell_pal_light_s_beacon); RegisterSpellScript(spell_pal_righteous_defense); - new spell_pal_righteous_vengeance(); - new spell_pal_sacred_shield(); - new spell_pal_sacred_shield_dummy(); - new spell_pal_seal_of_righteousness(); + RegisterSpellScript(spell_pal_righteous_vengeance); + RegisterSpellScript(spell_pal_sacred_shield); + RegisterSpellScript(spell_pal_sacred_shield_dummy); + RegisterSpellScript(spell_pal_seal_of_righteousness); new spell_pal_seal_of_vengeance<SPELL_PALADIN_HOLY_VENGEANCE, SPELL_PALADIN_SEAL_OF_VENGEANCE_DAMAGE>("spell_pal_seal_of_vengeance"); new spell_pal_seal_of_vengeance<SPELL_PALADIN_BLOOD_CORRUPTION, SPELL_PALADIN_SEAL_OF_CORRUPTION_DAMAGE>("spell_pal_seal_of_corruption"); - new spell_pal_seals(); - new spell_pal_spiritual_attunement(); - new spell_pal_sheath_of_light(); - new spell_pal_t3_6p_bonus(); - new spell_pal_t8_2p_bonus(); + RegisterSpellScript(spell_pal_seals); + RegisterSpellScript(spell_pal_spiritual_attunement); + RegisterSpellScript(spell_pal_sheath_of_light); + RegisterSpellScript(spell_pal_t3_6p_bonus); + RegisterSpellScript(spell_pal_t8_2p_bonus); } |