// Copyright (c) CypherCore All rights reserved. // Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information. using Framework.Constants; using Game.Entities; using Game.Scripting; using Game.Spells; using System; using System.Collections.Generic; namespace Scripts.Spells.Evoker { struct SpellIds { public const uint GlideKnockback = 358736; public const uint Hover = 358267; public const uint SoarRacial = 369536; } [Script] // 362969 - Azure Strike (blue) class spell_evo_azure_strike : SpellScript { void FilterTargets(List targets) { targets.Remove(GetExplTargetUnit()); targets.RandomResize((uint)GetEffectInfo(0).CalcValue(GetCaster()) - 1); targets.Add(GetExplTargetUnit()); } public override void Register() { OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 1, Targets.UnitDestAreaEnemy)); } } [Script] // 358733 - Glide (Racial) class spell_evo_glide : SpellScript { public override bool Validate(SpellInfo spellInfo) { return ValidateSpellInfo(SpellIds.GlideKnockback, SpellIds.Hover, SpellIds.SoarRacial); } SpellCastResult CheckCast() { Unit caster = GetCaster(); if (!caster.IsFalling()) return SpellCastResult.NotOnGround; return SpellCastResult.SpellCastOk; } void HandleCast() { Player caster = GetCaster().ToPlayer(); if (caster == null) return; caster.CastSpell(caster, SpellIds.GlideKnockback, true); caster.GetSpellHistory().StartCooldown(Global.SpellMgr.GetSpellInfo(SpellIds.Hover, GetCastDifficulty()), 0, null, false, TimeSpan.FromMilliseconds(250)); caster.GetSpellHistory().StartCooldown(Global.SpellMgr.GetSpellInfo(SpellIds.SoarRacial, GetCastDifficulty()), 0, null, false, TimeSpan.FromMilliseconds(250)); } public override void Register() { OnCheckCast.Add(new CheckCastHandler(CheckCast)); OnCast.Add(new CastHandler(HandleCast)); } } }