From 336967b324ae7c8b25f50fa391069604479a24fb Mon Sep 17 00:00:00 2001 From: TheDdraig <62179779+TheDdraig@users.noreply.github.com> Date: Wed, 9 Feb 2022 18:56:24 +0000 Subject: [PATCH] Fix (Core/Scripts): Warrior T3 8P Bonus Fix (#10561) * Fix (Core/Scripts): Warrior T3 8P Bonus Fix * Update spell_warrior.cpp * Update spell_warrior.cpp --- .../rev_1644160153962444055.sql | 4 +++ src/server/scripts/Spells/spell_warrior.cpp | 33 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1644160153962444055.sql diff --git a/data/sql/updates/pending_db_world/rev_1644160153962444055.sql b/data/sql/updates/pending_db_world/rev_1644160153962444055.sql new file mode 100644 index 000000000..99e65ca85 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1644160153962444055.sql @@ -0,0 +1,4 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1644160153962444055'); +DELETE FROM `spell_script_names` WHERE `spell_id`=28845; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(28845, 'spell_warr_t3_prot_8p_bonus'); diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index aa45f27b2..9e71e41f5 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -795,6 +795,38 @@ class spell_warr_glyph_of_sunder_armor : public AuraScript } }; +// Spell 28845 - Cheat Death + +enum CheatDeath +{ + SPELL_CHEAT_DEATH_TRIGGER = 28846 +}; + +class spell_warr_t3_prot_8p_bonus : public AuraScript +{ + PrepareAuraScript(spell_warr_t3_prot_8p_bonus); + + bool CheckProc(ProcEventInfo& eventInfo) + { + return eventInfo.GetActionTarget() && eventInfo.GetActionTarget()->GetHealthPct() <= 20.0f; + } + + void HandleEffectProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + if (Unit* target = eventInfo.GetActionTarget()) + { + target->CastSpell(target, SPELL_CHEAT_DEATH_TRIGGER, true); + } + } + + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_warr_t3_prot_8p_bonus::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_warr_t3_prot_8p_bonus::HandleEffectProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } +}; + // 20230 - Retaliation class spell_warr_retaliation : public AuraScript { @@ -854,4 +886,5 @@ void AddSC_warrior_spell_scripts() RegisterSpellScript(spell_warr_sweeping_strikes); RegisterSpellScript(spell_warr_vigilance); RegisterSpellScript(spell_warr_vigilance_trigger); + RegisterSpellScript(spell_warr_t3_prot_8p_bonus); }