feat(Scripts/Spell): Teleporting to Script

Co-authored-by: Nefertumm <nefertum.dev@protonmail.com>
This commit is contained in:
IntelligentQuantum
2022-04-01 14:33:22 +04:30
committed by GitHub
parent b680ea3dae
commit 7a294787d3
3 changed files with 38 additions and 20 deletions

View File

@@ -1828,6 +1828,38 @@ class spell_gen_creature_permanent_feign_death : public AuraScript
}
};
enum Teleporting
{
AREA_VIOLET_CITADEL_SPIRE = 4637,
SPELL_TELEPORT_SPIRE_DOWN = 59316,
SPELL_TELEPORT_SPIRE_UP = 59314
};
class spell_gen_teleporting : public SpellScript
{
PrepareSpellScript(spell_gen_teleporting);
void HandleScript(SpellEffIndex /* effIndex */)
{
Unit* target = GetHitUnit();
if (target->GetTypeId() != TYPEID_PLAYER)
return;
// return from top
if (target->ToPlayer()->GetAreaId() == AREA_VIOLET_CITADEL_SPIRE)
target->CastSpell(target, SPELL_TELEPORT_SPIRE_DOWN, true);
// teleport atop
else
target->CastSpell(target, SPELL_TELEPORT_SPIRE_UP, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_gen_teleporting::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
enum PvPTrinketTriggeredSpells
{
SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER = 72752,
@@ -4452,6 +4484,7 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_throw_shield);
RegisterSpellScript(spell_gen_on_tournament_mount);
RegisterSpellScript(spell_gen_tournament_pennant);
RegisterSpellScript(spell_gen_teleporting);
RegisterSpellScript(spell_gen_ds_flush_knockback);
RegisterSpellScriptWithArgs(spell_gen_count_pct_from_max_hp, "spell_gen_default_count_pct_from_max_hp");
RegisterSpellScriptWithArgs(spell_gen_count_pct_from_max_hp, "spell_gen_50pct_count_pct_from_max_hp", 50);