From efae1a28ef5b82dce9dbb39dcb75ea932a293e1a Mon Sep 17 00:00:00 2001 From: offl <11556157+offl@users.noreply.github.com> Date: Sun, 3 Jul 2022 23:23:43 +0300 Subject: Scripts/Spells: Hex of Jammal'an (#28083) (cherry picked from commit b801528e9db77ed10edf88ab2881dd7e33fa9127) --- .../EasternKingdoms/SunkenTemple/sunken_temple.cpp | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp index 5bb5f1431e9..18e62d1d88f 100644 --- a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp +++ b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp @@ -31,6 +31,8 @@ EndContentData */ #include "GameObjectAI.h" #include "InstanceScript.h" #include "Player.h" +#include "SpellAuraEffects.h" +#include "SpellScript.h" #include "sunken_temple.h" /*##### @@ -86,8 +88,68 @@ class go_atalai_statue : public GameObjectScript } }; +enum HexOfJammalan +{ + SPELL_HEX_OF_JAMMALAN_TRANSFORM = 12480, + SPELL_HEX_OF_JAMMALAN_CHARM = 12483 +}; + +// 12479 - Hex of Jammal'an +class spell_sunken_temple_hex_of_jammalan : public AuraScript +{ + PrepareAuraScript(spell_sunken_temple_hex_of_jammalan); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_HEX_OF_JAMMALAN_TRANSFORM, SPELL_HEX_OF_JAMMALAN_CHARM }); + } + + void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) + return; + + Unit* target = GetTarget(); + Unit* caster = GetCaster(); + + if (!caster || !caster->IsAlive()) + return; + + caster->CastSpell(target, SPELL_HEX_OF_JAMMALAN_TRANSFORM, true); + caster->CastSpell(target, SPELL_HEX_OF_JAMMALAN_CHARM, true); + } + + void Register() override + { + AfterEffectRemove += AuraEffectRemoveFn(spell_sunken_temple_hex_of_jammalan::AfterRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } +}; + +// 12480 - Hex of Jammal'an +class spell_sunken_temple_hex_of_jammalan_transform : public AuraScript +{ + PrepareAuraScript(spell_sunken_temple_hex_of_jammalan_transform); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_HEX_OF_JAMMALAN_CHARM }); + } + + void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasDueToSpell(SPELL_HEX_OF_JAMMALAN_CHARM); + } + + void Register() override + { + AfterEffectRemove += AuraEffectRemoveFn(spell_sunken_temple_hex_of_jammalan_transform::AfterRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); + } +}; + void AddSC_sunken_temple() { new at_malfurion_stormrage(); new go_atalai_statue(); + RegisterSpellScript(spell_sunken_temple_hex_of_jammalan); + RegisterSpellScript(spell_sunken_temple_hex_of_jammalan_transform); } -- cgit v1.2.3