From c245757abfb7e4dac3b9df2a410f9999241b45c8 Mon Sep 17 00:00:00 2001 From: killerwife Date: Fri, 12 Jan 2024 11:48:14 +0100 Subject: [PATCH] Paladin: Implement missing and migrate existing paladin glyph scripts --- sql/scriptdev2/spell.sql | 7 +- .../Scripting/ClassScripts/Paladin.cpp | 74 ++++++++++++++++++- src/game/Spells/SpellAuras.cpp | 9 --- src/game/Spells/SpellEffects.cpp | 1 - src/game/Spells/UnitAuraProcHandler.cpp | 26 ------- 5 files changed, 79 insertions(+), 38 deletions(-) diff --git a/sql/scriptdev2/spell.sql b/sql/scriptdev2/spell.sql index 604f8d839f7..32e6a88ecac 100644 --- a/sql/scriptdev2/spell.sql +++ b/sql/scriptdev2/spell.sql @@ -1267,7 +1267,12 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES (25899,'spell_blessing_of_sanctuary'), (31850,'spell_ardent_defender'), (31851,'spell_ardent_defender'), -(31852,'spell_ardent_defender'); +(31852,'spell_ardent_defender'), +(1038,'spell_hand_of_salvation'), +(54925,'spell_glyph_of_seal_of_command'), +(68082,'spell_glyph_of_seal_of_command_mana'), +(54939,'spell_glyph_of_divinity'), +(54937,'spell_glyph_of_holy_light'); -- Warlock INSERT INTO spell_scripts(Id, ScriptName) VALUES diff --git a/src/game/Spells/Scripts/Scripting/ClassScripts/Paladin.cpp b/src/game/Spells/Scripts/Scripting/ClassScripts/Paladin.cpp index a7aa3bf7149..f2790a6ab65 100644 --- a/src/game/Spells/Scripts/Scripting/ClassScripts/Paladin.cpp +++ b/src/game/Spells/Scripts/Scripting/ClassScripts/Paladin.cpp @@ -170,6 +170,7 @@ struct RighteousDefense : public SpellScript } }; +// 53385 - Divine Storm struct DivineStorm : public SpellScript { void OnInit(Spell* spell) const override @@ -189,6 +190,7 @@ struct DivineStorm : public SpellScript } }; +// 54171 - Divine Storm struct DivineStormHeal : public SpellScript { void OnInit(Spell* spell) const override @@ -204,6 +206,7 @@ struct DivineStormHeal : public SpellScript } }; +// 70769 - Divine Storm! struct DivineStormCooldown : public SpellScript { void OnEffectExecute(Spell* spell, SpellEffectIndex /*effIdx*/) const override @@ -213,6 +216,7 @@ struct DivineStormCooldown : public SpellScript } }; +// 31876, 31877, 31878 struct JudgementsOfTheWise : public AuraScript { bool OnCheckProc(Aura* /*aura*/, ProcExecutionData& data) const override @@ -234,6 +238,7 @@ struct JudgementsOfTheWise : public AuraScript } }; +// 31930 - Judgements of the Wise struct JudgementsOfTheWiseEnergize : public SpellScript { void OnEffectExecute(Spell* spell, SpellEffectIndex /*effIdx*/) const override @@ -242,6 +247,7 @@ struct JudgementsOfTheWiseEnergize : public SpellScript } }; +// 31850, 31851, 31852 - Ardent Defender struct ArdentDefender : public AuraScript { void OnAbsorb(Aura* aura, int32& currentAbsorb, int32& remainingDamage, uint32& /*reflectedSpellId*/, int32& /*reflectDamage*/, bool& preventedDeath, bool& /*dropCharge*/, DamageEffectType /*damageType*/) const override @@ -317,6 +323,67 @@ struct BlessingOfSanctuary : public AuraScript } }; +// 1038 - Hand of Salvation +struct HandOfSalvation : public AuraScript +{ + int32 OnAuraValueCalculate(AuraCalcData& data, int32 value) const override + { + if (data.caster && data.effIdx == EFFECT_INDEX_1) + if (data.caster->GetObjectGuid() == data.target->GetObjectGuid()) + if (Aura* aur = data.target->GetAura(63225, EFFECT_INDEX_0)) + return value - aur->GetModifier()->m_amount; + return value; + } +}; + +// 54925 - Glyph of Seal of Command +struct GlyphOfSealOfCommand : public AuraScript +{ + bool OnCheckProc(Aura* aura, ProcExecutionData& /*data*/) const override + { + return aura->GetTarget()->HasAura(20375); // must have seal of command active + } +}; + +// 68082 - Glyph of Seal of Command +struct GlyphOfSealOfCommandMana : public SpellScript +{ + void OnEffectExecute(Spell* spell, SpellEffectIndex /*effIdx*/) const override + { + if (!spell->GetUnitTarget()) + return; + spell->SetDamage(spell->GetDamage() * spell->GetUnitTarget()->GetCreateMana() / 100); + } +}; + +// 54939 - Glyph of Divinity +struct GlyphOfDivinity : public AuraScript +{ + SpellAuraProcResult OnProc(Aura* /*aura*/, ProcExecutionData& procData) const override + { + if (procData.spell) + { + procData.basepoints[EFFECT_INDEX_1] = procData.spell->GetDamageForEffect(EFFECT_INDEX_1); + procData.triggeredSpellId = 54986; + procData.triggerTarget = nullptr; + } + + return SPELL_AURA_PROC_OK; + } +}; + +// 54937 - Glyph of Holy Light +struct GlyphOfHolyLight : public AuraScript +{ + SpellAuraProcResult OnProc(Aura* aura, ProcExecutionData& procData) const override + { + procData.triggeredSpellId = 54968; + procData.basepoints[0] = aura->GetAmount() * procData.damage / 100; + + return SPELL_AURA_PROC_OK; + } +}; + void LoadPaladinScripts() { RegisterSpellScript("spell_increased_holy_light_healing"); @@ -329,7 +396,12 @@ void LoadPaladinScripts() RegisterSpellScript("spell_judgements_of_the_wise"); RegisterSpellScript("spell_judgements_of_the_wise_energize"); RegisterSpellScript("spell_ardent_defender"); - RegisterSpellScript("spell_sacred_shield_crit"); + RegisterSpellScript("spell_sacred_shield_crit"); RegisterSpellScript("spell_exorcism_paladin"); RegisterSpellScript("spell_blessing_of_sanctuary"); + RegisterSpellScript("spell_hand_of_salvation"); + RegisterSpellScript("spell_glyph_of_seal_of_command"); + RegisterSpellScript("spell_glyph_of_seal_of_command_mana"); + RegisterSpellScript("spell_glyph_of_divinity"); + RegisterSpellScript("spell_glyph_of_holy_light"); } \ No newline at end of file diff --git a/src/game/Spells/SpellAuras.cpp b/src/game/Spells/SpellAuras.cpp index b7b0e84b309..b35ed7980f3 100755 --- a/src/game/Spells/SpellAuras.cpp +++ b/src/game/Spells/SpellAuras.cpp @@ -6165,15 +6165,6 @@ void Aura::HandleDamagePercentTaken(bool apply, bool Real) { if (loading) return; - - // Hand of Salvation (only it have this aura and mask) - if (GetSpellProto()->IsFitToFamily(SPELLFAMILY_PALADIN, uint64(0x0000000000000100))) - { - // Glyph of Salvation - if (target->GetObjectGuid() == GetCasterGuid()) - if (Aura* aur = target->GetAura(63225, EFFECT_INDEX_0)) - m_modifier.m_amount -= aur->GetModifier()->m_amount; - } } else if (GetSpellProto()->Id == 43421) // Malacrass - Lifebloom diff --git a/src/game/Spells/SpellEffects.cpp b/src/game/Spells/SpellEffects.cpp index 7e365d3126d..0e8cbeedc8b 100644 --- a/src/game/Spells/SpellEffects.cpp +++ b/src/game/Spells/SpellEffects.cpp @@ -5551,7 +5551,6 @@ void Spell::EffectEnergize(SpellEffectIndex eff_idx) break; case 48542: // Revitalize (mana restore case) case 63375: // Improved Stormstrike - case 68082: // Glyph of Seal of Command damage = damage * unitTarget->GetCreateMana() / 100; break; case 67487: // Mana Potion Injector diff --git a/src/game/Spells/UnitAuraProcHandler.cpp b/src/game/Spells/UnitAuraProcHandler.cpp index 88af530a049..3d5afacd3b4 100644 --- a/src/game/Spells/UnitAuraProcHandler.cpp +++ b/src/game/Spells/UnitAuraProcHandler.cpp @@ -2375,13 +2375,6 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(ProcExecutionData& data) CastSpell(target, 53739, TRIGGERED_OLD_TRIGGERED, nullptr, triggeredByAura); break; } - // Glyph of Holy Light - case 54937: - { - triggered_spell_id = 54968; - basepoints[0] = triggerAmount * damage / 100; - break; - } // Sacred Shield (buff) case 58597: { @@ -4288,25 +4281,6 @@ SpellAuraProcResult Unit::HandleAddPctModifierAuraProc(ProcExecutionData& data) } break; } - case SPELLFAMILY_PALADIN: - { - // Glyph of Divinity - if (spellProto->Id == 54939) - { - // Lookup base amount mana restore - for (int i = 0; i < MAX_EFFECT_INDEX; ++i) - { - if (spellProto->Effect[i] == SPELL_EFFECT_ENERGIZE) - { - int32 mana = spellProto->CalculateSimpleValue(SpellEffectIndex(i)); - CastCustomSpell(this, 54986, nullptr, &mana, nullptr, TRIGGERED_OLD_TRIGGERED, castItem, triggeredByAura); - break; - } - } - return SPELL_AURA_PROC_OK; - } - break; - } } return SPELL_AURA_PROC_OK; }