Scripts/Spells: Hex of Jammal'an (#28083)

This commit is contained in:
offl
2022-07-03 23:23:43 +03:00
committed by GitHub
parent fca49f428b
commit b801528e9d
2 changed files with 68 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
--
DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (-12480,12479,12480);
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_sunken_temple_hex_of_jammalan','spell_sunken_temple_hex_of_jammalan_transform');
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(12479,'spell_sunken_temple_hex_of_jammalan'),
(12480,'spell_sunken_temple_hex_of_jammalan_transform');

View File

@@ -33,6 +33,8 @@ EndContentData */
#include "Map.h"
#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
#include "sunken_temple.h"
/*#####
@@ -88,8 +90,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);
}