diff options
author | ariel- <ariel-@users.noreply.github.com> | 2017-12-28 11:11:19 -0300 |
---|---|---|
committer | ariel- <ariel-@users.noreply.github.com> | 2017-12-28 12:16:39 -0300 |
commit | f4629d83c6e19991bf00ea2eefc7bf03569870ff (patch) | |
tree | 20b3b7bce620feaf0d32fd8d078eb904e1a67bd0 /src | |
parent | d13999c8d6a390914907d1d8343d72c06195bf10 (diff) |
Core/Scripts: prevent applying Aspect of the Beast on pet load if owner has switched aspects
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Spells/spell_hunter.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 051e7d9c7c9..eaee7a93fd9 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -32,6 +32,7 @@ enum HunterSpells { + SPELL_HUNTER_ASPECT_OF_THE_BEAST = 13161, SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET = 61669, SPELL_HUNTER_ASPECT_OF_THE_VIPER = 34074, SPELL_HUNTER_ASPECT_OF_THE_VIPER_ENERGIZE = 34075, @@ -119,6 +120,34 @@ class spell_hun_aspect_of_the_beast : public SpellScriptLoader } }; +// 61669 - Aspect of the Beast +class spell_hun_aspect_of_the_beast_pet : public AuraScript +{ + PrepareAuraScript(spell_hun_aspect_of_the_beast_pet); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_HUNTER_ASPECT_OF_THE_BEAST }); + } + + bool Load() override + { + return GetUnitOwner()->GetSpellModOwner(); + } + + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Player* owner = GetUnitOwner()->GetSpellModOwner(); + if (!owner->HasAura(SPELL_HUNTER_ASPECT_OF_THE_BEAST)) + Remove(); + } + + void Register() override + { + OnEffectApply += AuraEffectApplyFn(spell_hun_aspect_of_the_beast_pet::OnApply, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL); + } +}; + // 34074 - Aspect of the Viper class spell_hun_ascpect_of_the_viper : public SpellScriptLoader { @@ -1593,6 +1622,7 @@ class spell_hun_viper_attack_speed : public SpellScriptLoader void AddSC_hunter_spell_scripts() { new spell_hun_aspect_of_the_beast(); + RegisterAuraScript(spell_hun_aspect_of_the_beast_pet); new spell_hun_ascpect_of_the_viper(); new spell_hun_chimera_shot(); new spell_hun_cobra_strikes(); |