From e7af2898f25a7823d9e9ac7a87945b9b0c155a54 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Mon, 21 Aug 2023 08:00:12 -0400 Subject: [PATCH] Scripts/Warlock: Implemented Burning Rush Port From (https://github.com/TrinityCore/TrinityCore/commit/9ad227f0756aa91f9b772ecf13b40c1f38863e68) --- Source/Game/Spells/SpellManager.cs | 6 ++++ Source/Scripts/Spells/Warlock.cs | 44 ++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/Source/Game/Spells/SpellManager.cs b/Source/Game/Spells/SpellManager.cs index 2659aa8f4..c411e95b1 100644 --- a/Source/Game/Spells/SpellManager.cs +++ b/Source/Game/Spells/SpellManager.cs @@ -4382,6 +4382,12 @@ namespace Game.Entities spellInfo.AttributesEx &= ~SpellAttr1.IsChannelled; }); + // Burning Rush + ApplySpellFix(new[] {111400 }, spellInfo => + { + spellInfo.AttributesEx4 |= SpellAttr4.AuraIsBuff; + }); + foreach (var spellInfo in mSpellInfoMap.Values) { // Fix range for trajectory triggered spell diff --git a/Source/Scripts/Spells/Warlock.cs b/Source/Scripts/Spells/Warlock.cs index b376598c6..6df3ee84a 100644 --- a/Source/Scripts/Spells/Warlock.cs +++ b/Source/Scripts/Spells/Warlock.cs @@ -76,6 +76,50 @@ namespace Scripts.Spells.Warlock } } + [Script] // 111400 - Burning Rush + class spell_warl_burning_rush : SpellScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellEffect((spellInfo.Id, 1)); + } + + SpellCastResult CheckApplyAura() + { + Unit caster = GetCaster(); + if (caster.GetHealthPct() <= GetEffectInfo(1).CalcValue(caster)) + { + SetCustomCastResultMessage(SpellCustomErrors.YouDontHaveEnoughHealth); + return SpellCastResult.CustomError; + } + + return SpellCastResult.SpellCastOk; + } + + public override void Register() + { + OnCheckCast.Add(new CheckCastHandler(CheckApplyAura)); + } + } + + [Script] // 111400 - Burning Rush + class spell_warl_burning_rush_aura : AuraScript + { + void PeriodicTick(AuraEffect aurEff) + { + if (GetTarget().GetHealthPct() <= aurEff.GetAmount()) + { + PreventDefaultAction(); + Remove(); + } + } + + public override void Register() + { + OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 1, AuraType.PeriodicDamagePercent)); + } + } + [Script] // 116858 - Chaos Bolt class spell_warl_chaos_bolt : SpellScript {