diff options
author | Ovahlord <dreadkiller@gmx.de> | 2025-01-26 10:55:38 +0100 |
---|---|---|
committer | Ovahlord <dreadkiller@gmx.de> | 2025-01-26 10:55:38 +0100 |
commit | 42740ba740735b242e4389228b3ee7addd493625 (patch) | |
tree | 89ac98a23e3eb921358141c6e59d79dcfa711d86 | |
parent | 55992fe247da419d66abaf2fe4bc84c80b796f75 (diff) |
Scripts/Spells: fixed Judgement
-rw-r--r-- | sql/updates/world/cata_classic/2025_01_26_00_world.sql | 4 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_paladin.cpp | 62 |
2 files changed, 65 insertions, 1 deletions
diff --git a/sql/updates/world/cata_classic/2025_01_26_00_world.sql b/sql/updates/world/cata_classic/2025_01_26_00_world.sql new file mode 100644 index 00000000000..8964ca3602f --- /dev/null +++ b/sql/updates/world/cata_classic/2025_01_26_00_world.sql @@ -0,0 +1,4 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_pal_judgement', 'spell_pal_judgement_of_righteousness'); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(20271, 'spell_pal_judgement'), +(20187, 'spell_pal_judgement_of_righteousness'); diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 2fc950bcd1d..e8448e5de46 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -22,7 +22,9 @@ */ #include "ScriptMgr.h" +#include "SpellAuraEffects.h" #include "SpellDefines.h" +#include "SpellMgr.h" #include "SpellScript.h" #include "Unit.h" @@ -30,7 +32,8 @@ namespace Scripts::Spells::Paladin { enum PaladinSpells { - SPELL_PAL_SEAL_OF_RIGHTEOUSNESS_DAMAGE = 25742 + SPELL_PAL_SEAL_OF_RIGHTEOUSNESS_DAMAGE = 25742, + SPELL_PAL_JUDGEMENT_DAMAGE = 54158 }; // 20154 - Seal of Righteousness @@ -68,10 +71,67 @@ namespace Scripts::Spells::Paladin private: int32 _procBasePoints = 0; }; + + // 20271 - Judgement + class spell_pal_judgement : public SpellScript + { + bool Validate(SpellInfo const* /*spellInfo*/) + { + return ValidateSpellInfo({ SPELL_PAL_JUDGEMENT_DAMAGE }); + } + + void HandleJudgementEffect(SpellEffIndex /*effIndex*/) + { + GetCaster()->CastSpell(GetHitUnit(), getJudgementDamageSpellId(GetCaster()), CastSpellExtraArgsInit{ .TriggeringSpell = GetSpell()}); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_pal_judgement::HandleJudgementEffect, EFFECT_0, SPELL_EFFECT_DUMMY); + } + + private: + // Some of the Seals store their triggered Judgement spell within a dummy aura effect. We will identify them with this method + uint32 getJudgementDamageSpellId(Unit* caster) + { + // Some of the Seals store their triggered Judgement spell within their dummy aura effects at EffIndex EFFECT_2. Try to find them. + for (AuraEffect const* aurEff : caster->GetAuraEffectsByType(SPELL_AURA_DUMMY)) + { + if (aurEff->GetSpellInfo()->SpellFamilyName != SPELLFAMILY_PALADIN || aurEff->GetSpellInfo()->GetSpellSpecific() != SPELL_SPECIFIC_SEAL) + continue; + + // Seal of Righteousness and Seal of Truth store their Judgement damage spell in EFFECT_2 + if (aurEff->GetEffIndex() != EFFECT_2 || !aurEff->GetSpellInfo()->SpellFamilyFlags.HasFlag(0, 0x800 | 0x20000000)) + continue; + + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(aurEff->GetAmount(), DIFFICULTY_NONE)) + return spellInfo->Id; + } + + // For the other seals, we just fall back to the default damage spell + return SPELL_PAL_JUDGEMENT_DAMAGE; + } + }; + + // 20187 - Judgement of Righteousness + class spell_pal_judgement_of_righteousness : public SpellScript + { + void CalculateDamage(SpellEffectInfo const& /*spellEffectInfo*/, Unit* /*victim*/, int32& damage, int32& /*flatMod*/, float& /*pctMod*/) + { + damage += GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f; + } + + void Register() override + { + CalcDamage += SpellCalcDamageFn(spell_pal_judgement_of_righteousness::CalculateDamage); + } + }; } void AddSC_paladin_spell_scripts() { using namespace Scripts::Spells::Paladin; + RegisterSpellScript(spell_pal_judgement); + RegisterSpellScript(spell_pal_judgement_of_righteousness); RegisterSpellScript(spell_pal_seal_of_righteousness); } |