diff --git a/data/sql/updates/pending_db_world/rev_1716833230281927300.sql b/data/sql/updates/pending_db_world/rev_1716833230281927300.sql new file mode 100644 index 00000000000000..411fa534bd2d41 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1716833230281927300.sql @@ -0,0 +1,4 @@ +-- +DELETE FROM `spell_script_names` WHERE `ScriptName` = 'spell_azgalor_doom' AND `spell_id` = 31347; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(31347, 'spell_azgalor_doom'); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp index 6a7562869819d6..95cdfdffb611ac 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp @@ -17,6 +17,8 @@ #include "CreatureScript.h" #include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellScriptLoader.h" #include "hyjal.h" enum Spells @@ -117,7 +119,27 @@ struct boss_azgalor : public BossAI }; +class spell_azgalor_doom : public AuraScript +{ + PrepareAuraScript(spell_azgalor_doom); + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH) + { + target->CastSpell(target, GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, true); + } + } + + void Register() override + { + OnEffectRemove += AuraEffectRemoveFn(spell_azgalor_doom::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); + } +}; + void AddSC_boss_azgalor() { RegisterHyjalAI(boss_azgalor); + RegisterSpellScript(spell_azgalor_doom); }