Scripts/Evoker: Implement Living Flame and Energizing Flame
Port From (https://github.com/TrinityCore/TrinityCore/commit/35775b0dfb2048775ef36e51700221ba19cbf9b4)
This commit is contained in:
@@ -12,8 +12,12 @@ namespace Scripts.Spells.Evoker
|
||||
{
|
||||
struct SpellIds
|
||||
{
|
||||
public const uint EnergizingFlame = 400006;
|
||||
public const uint GlideKnockback = 358736;
|
||||
public const uint Hover = 358267;
|
||||
public const uint LivingFlame = 361469;
|
||||
public const uint LivingFlameDamage = 361500;
|
||||
public const uint LivingFlameHeal = 361509;
|
||||
public const uint SoarRacial = 369536;
|
||||
}
|
||||
|
||||
@@ -32,7 +36,7 @@ namespace Scripts.Spells.Evoker
|
||||
OnObjectAreaTargetSelect.Add(new ObjectAreaTargetSelectHandler(FilterTargets, 1, Targets.UnitDestAreaEnemy));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Script] // 358733 - Glide (Racial)
|
||||
class spell_evo_glide : SpellScript
|
||||
{
|
||||
@@ -69,4 +73,44 @@ namespace Scripts.Spells.Evoker
|
||||
OnCast.Add(new CastHandler(HandleCast));
|
||||
}
|
||||
}
|
||||
|
||||
[Script] // 361469 - Living Flame (Red)
|
||||
class spell_evo_living_flame : SpellScript
|
||||
{
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.LivingFlameDamage, SpellIds.LivingFlameHeal, SpellIds.EnergizingFlame);
|
||||
}
|
||||
|
||||
void HandleHitTarget(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
Unit hitUnit = GetHitUnit();
|
||||
if (caster.IsFriendlyTo(hitUnit))
|
||||
caster.CastSpell(hitUnit, SpellIds.LivingFlameHeal, true);
|
||||
else
|
||||
caster.CastSpell(hitUnit, SpellIds.LivingFlameDamage, true);
|
||||
}
|
||||
|
||||
void HandleLaunchTarget(uint effIndex)
|
||||
{
|
||||
Unit caster = GetCaster();
|
||||
if (caster.IsFriendlyTo(GetHitUnit()))
|
||||
return;
|
||||
|
||||
AuraEffect auraEffect = caster.GetAuraEffect(SpellIds.EnergizingFlame, 0);
|
||||
if (auraEffect != null)
|
||||
{
|
||||
int manaCost = GetSpell().GetPowerTypeCostAmount(PowerType.Mana).GetValueOrDefault(0);
|
||||
if (manaCost != 0)
|
||||
GetCaster().ModifyPower(PowerType.Mana, MathFunctions.CalculatePct(manaCost, auraEffect.GetAmount()));
|
||||
}
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
OnEffectHitTarget.Add(new EffectHandler(HandleHitTarget, 0, SpellEffectName.Dummy));
|
||||
OnEffectLaunchTarget.Add(new EffectHandler(HandleLaunchTarget, 0, SpellEffectName.Dummy));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user