From ba289e6158c42d72e1c28f18a00c0f4cf5baf62d Mon Sep 17 00:00:00 2001 From: insuna Date: Sat, 28 Oct 2023 12:53:19 +0200 Subject: [PATCH] Item: Implement Val'anyr effect (#471) * Item: Implement Val'anyr effect * Item: Adjust Val'anyr proc * Item: Move Blessing proc out of UnitAuraProcHandler --- sql/scriptdev2/spell.sql | 2 + .../scripts/world/item_scripts_wotlk.cpp | 52 +++++++++++++++++++ src/game/Spells/UnitAuraProcHandler.cpp | 18 ------- 3 files changed, 54 insertions(+), 18 deletions(-) diff --git a/sql/scriptdev2/spell.sql b/sql/scriptdev2/spell.sql index aae5dc74133..3bbe50131ab 100644 --- a/sql/scriptdev2/spell.sql +++ b/sql/scriptdev2/spell.sql @@ -910,6 +910,8 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES (62138,'spell_teleport_inside_violet_hold'), (63482,'spell_lightning_whirl_heroic'), (63845,'spell_create_lance'), +(64411,'spell_blessing_of_ancient_kings'), +(64415,'spell_valanyr_equip_effect'), (64568,'spell_blood_reserve_enchant'), (65869,'spell_disengage'), (65932,'spell_retaliation_dummy_creature'), diff --git a/src/game/AI/ScriptDevAI/scripts/world/item_scripts_wotlk.cpp b/src/game/AI/ScriptDevAI/scripts/world/item_scripts_wotlk.cpp index 6e7c64a7bc3..9a5070420a3 100644 --- a/src/game/AI/ScriptDevAI/scripts/world/item_scripts_wotlk.cpp +++ b/src/game/AI/ScriptDevAI/scripts/world/item_scripts_wotlk.cpp @@ -140,10 +140,62 @@ struct Icecrown25MeleeTrinket : public AuraScript } }; + +// 64415 Val'anyr Hammer of Ancient Kings - Equip Effect +struct ValanyrEquipEffect : public AuraScript +{ + bool OnCheckProc(Aura* /*aura*/, ProcExecutionData& procData) const override + { + if (procData.healthGain == 0) + return false; + return true; + } + + SpellAuraProcResult OnProc(Aura* aura, ProcExecutionData& procData) const override + { + if (!IsPositiveSpell(procData.spellInfo->Id)) + return SPELL_AURA_PROC_FAILED; + procData.cooldown = 45; + return SPELL_AURA_PROC_OK; + } +}; + +enum +{ + SPELL_PROTECTION_OF_ANCIENT_KINGS = 64413, +}; + +// 64411 Blessing of Ancient Kings +struct BlessingOfAncientKings : public AuraScript +{ + SpellAuraProcResult OnProc(Aura* aura, ProcExecutionData& procData) const override + { + if (!IsPositiveSpell(procData.spellInfo->Id)) + return SPELL_AURA_PROC_FAILED; + + procData.triggeredSpellId = SPELL_PROTECTION_OF_ANCIENT_KINGS; + procData.basepoints[0] = procData.damage * 15 / 100; + procData.triggerTarget = procData.target; + if (procData.target->HasAura(SPELL_PROTECTION_OF_ANCIENT_KINGS)) + { + Unit* target = procData.target; + Aura* triggeredAura = target->GetAura(SPELL_PROTECTION_OF_ANCIENT_KINGS, EFFECT_INDEX_0); + if (!triggeredAura) + return SPELL_AURA_PROC_OK; + triggeredAura->GetHolder()->RefreshHolder(); + triggeredAura->GetModifier()->m_amount = std::min(triggeredAura->GetModifier()->m_amount + procData.basepoints[0], 20000); + return SPELL_AURA_PROC_CANT_TRIGGER; + } + return SPELL_AURA_PROC_OK; + } +}; + void AddSC_item_scripts_wotlk() { RegisterSpellScript("spell_swift_hand_of_justice"); RegisterSpellScript("spell_discerning_eye_of_the_beast"); RegisterSpellScript("spell_proc_only_below_35_percent"); RegisterSpellScript("spell_icecrown_25_melee_trinket"); + RegisterSpellScript("spell_valanyr_equip_effect"); + RegisterSpellScript("spell_blessing_of_ancient_kings"); } \ No newline at end of file diff --git a/src/game/Spells/UnitAuraProcHandler.cpp b/src/game/Spells/UnitAuraProcHandler.cpp index a1777cb1c86..467ce606d87 100644 --- a/src/game/Spells/UnitAuraProcHandler.cpp +++ b/src/game/Spells/UnitAuraProcHandler.cpp @@ -1608,17 +1608,6 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(ProcExecutionData& data) pVictim->RemoveSpellsCausingAura(SPELL_AURA_PERIODIC_DAMAGE_PERCENT); return SPELL_AURA_PROC_OK; } - // Blessing of Ancient Kings - case 64411: - { - // for DOT procs - if (!IsPositiveSpell(spellInfo->Id)) - return SPELL_AURA_PROC_FAILED; - - triggered_spell_id = 64413; - basepoints[0] = damage * 15 / 100; - break; - } } break; } @@ -3237,13 +3226,6 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(ProcExecutionData& data caster->InterruptNonMeleeSpells(false); return SPELL_AURA_PROC_OK; } - case 64415: // // Val'anyr Hammer of Ancient Kings - Equip Effect - { - // for DOT procs - if (!IsPositiveSpell(spellInfo->Id)) - return SPELL_AURA_PROC_FAILED; - break; - } case 64440: // Blade Warding { trigger_spell_id = 64442;