b686c3939d
Port From (https://github.com/TrinityCore/TrinityCore/commit/eebacbc86e989bba8068dc07fc76ff3c64da3309)
73 lines
2.3 KiB
C#
73 lines
2.3 KiB
C#
// Copyright (c) CypherCore <http://github.com/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<WorldObject> 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));
|
|
}
|
|
}
|
|
}
|