From efb691841df9a7986c03f43d135941440983015f Mon Sep 17 00:00:00 2001 From: hondacrx Date: Mon, 30 Jan 2023 08:30:12 -0500 Subject: [PATCH] Scripts/Evoker: Implement Living Flame and Energizing Flame Port From (https://github.com/TrinityCore/TrinityCore/commit/35775b0dfb2048775ef36e51700221ba19cbf9b4) --- Source/Scripts/Spells/Evoker.cs | 46 ++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/Source/Scripts/Spells/Evoker.cs b/Source/Scripts/Spells/Evoker.cs index d92cb9ab5..e04e01865 100644 --- a/Source/Scripts/Spells/Evoker.cs +++ b/Source/Scripts/Spells/Evoker.cs @@ -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)); + } + } }