From c738f0d67c4ee5b0464975db7cbc70e98e22d7bf Mon Sep 17 00:00:00 2001 From: Jelle Meeus Date: Sat, 20 Apr 2024 03:20:24 +0200 Subject: [PATCH] fix(Scripts/Hyjal): Cannibalize should heal more than 1 (#18766) * init * include SpellScript.h --- .../rev_1713549415418061715.sql | 3 +++ .../BattleForMountHyjal/hyjal.cpp | 23 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1713549415418061715.sql diff --git a/data/sql/updates/pending_db_world/rev_1713549415418061715.sql b/data/sql/updates/pending_db_world/rev_1713549415418061715.sql new file mode 100644 index 000000000..251091315 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1713549415418061715.sql @@ -0,0 +1,3 @@ +-- +DELETE FROM `spell_script_names` WHERE `spell_id` = 31538; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (31538, 'spell_cannibalize_heal'); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp index 49d5b34cd..a5c7c4e0b 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp @@ -19,6 +19,8 @@ #include "Player.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" +#include "SpellScript.h" +#include "SpellScriptLoader.h" #include "hyjal.h" enum Spells @@ -327,6 +329,26 @@ public: }; +// 31538 - Cannibalize (Heal) +class spell_cannibalize_heal : public SpellScript +{ + PrepareSpellScript(spell_cannibalize_heal); + + void HandleHeal(SpellEffIndex /*effIndex*/) + { + if (Unit* caster = GetCaster()) + { + uint32 heal = caster->CountPctFromMaxHealth(7); + SetHitHeal(heal); + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_cannibalize_heal::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL); + } +}; + struct npc_hyjal_ground_trash : public ScriptedAI { npc_hyjal_ground_trash(Creature* creature) : ScriptedAI(creature) @@ -704,4 +726,5 @@ void AddSC_hyjal() RegisterHyjalAI(npc_hyjal_ground_trash); RegisterHyjalAI(npc_hyjal_gargoyle); RegisterHyjalAI(npc_hyjal_frost_wyrm); + RegisterSpellScript(spell_cannibalize_heal); }