From 3a30fe3d71954626932598ba0b021ec125775d9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A1udio=20Costa?= <54484196+claudiodfc@users.noreply.github.com> Date: Fri, 18 Jun 2021 16:07:33 +0100 Subject: [PATCH] fix(Scripts): Victory rush killing blow (#6349) --- .../rev_1623660631649831200.sql | 4 +++ src/server/scripts/Spells/spell_warrior.cpp | 36 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1623660631649831200.sql diff --git a/data/sql/updates/pending_db_world/rev_1623660631649831200.sql b/data/sql/updates/pending_db_world/rev_1623660631649831200.sql new file mode 100644 index 000000000..dc57fa124 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1623660631649831200.sql @@ -0,0 +1,4 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1623660631649831200'); + +DELETE FROM `spell_script_names` WHERE `spell_id` = 34428; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (34428, 'spell_warr_victory_rush'); diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index af838fd4b..60a6280db 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -93,6 +93,41 @@ public: } }; +class spell_warr_victory_rush : public SpellScriptLoader +{ +public: + spell_warr_victory_rush() : SpellScriptLoader("spell_warr_victory_rush") { } + + class spell_warr_victory_rush_SpellScript : public SpellScript + { + PrepareSpellScript(spell_warr_victory_rush_SpellScript); + + void VictoryRushHit() + { + if (Unit* player = GetCaster()) + { + if (Unit* victim = GetHitUnit()) + { + if (victim->isDead()) + { + player->ModifyAuraState(AURA_STATE_WARRIOR_VICTORY_RUSH, true); + } + } + } + } + + void Register() override + { + AfterHit += SpellHitFn(spell_warr_victory_rush_SpellScript::VictoryRushHit); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_warr_victory_rush_SpellScript(); + } +}; + class spell_warr_intervene : public SpellScriptLoader { public: @@ -963,6 +998,7 @@ void AddSC_warrior_spell_scripts() new spell_warr_intervene(); new spell_warr_improved_spell_reflection(); new spell_warr_improved_spell_reflection_trigger(); + new spell_warr_victory_rush(); // Theirs new spell_warr_bloodthirst();