diff options
author | offl <11556157+offl@users.noreply.github.com> | 2022-07-03 23:23:43 +0300 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-09-05 19:48:43 +0200 |
commit | efae1a28ef5b82dce9dbb39dcb75ea932a293e1a (patch) | |
tree | 99cc94ed823500d4ae8d96108c12187a2943a5ce /src | |
parent | 39c07d43bf20f063d2fced6a61a92b7b061cef7a (diff) |
Scripts/Spells: Hex of Jammal'an (#28083)
(cherry picked from commit b801528e9db77ed10edf88ab2881dd7e33fa9127)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
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); } |