From 45f81d7b7888e928fd0c43e4f838a2cd569aa14f Mon Sep 17 00:00:00 2001 From: hondacrx Date: Tue, 23 May 2023 06:58:50 -0400 Subject: [PATCH] Scripts/Warrior: Implemented Fueled by Violence Port From (https://github.com/TrinityCore/TrinityCore/commit/d64f7c332e1c6b9d15240979f3f95db4131ff17c) --- Source/Scripts/Spells/Warrior.cs | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Source/Scripts/Spells/Warrior.cs b/Source/Scripts/Spells/Warrior.cs index da9169d8c..11945473a 100644 --- a/Source/Scripts/Spells/Warrior.cs +++ b/Source/Scripts/Spells/Warrior.cs @@ -25,6 +25,7 @@ namespace Scripts.Spells.Warrior public const uint ColossusSmash = 167105; public const uint ColossusSmashEffect = 208086; public const uint Execute = 20647; + public const uint FueledByViolenceHeal = 383104; public const uint GlyphOfTheBlazingTrail = 123779; public const uint GlyphOfHeroicLeap = 159708; public const uint GlyphOfHeroicLeapBuff = 133278; @@ -162,6 +163,43 @@ namespace Scripts.Spells.Warrior } } + [Script] // 383103 - Fueled by Violence + class spell_warr_fueled_by_violence : AuraScript + { + int _nextHealAmount; + + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.FueledByViolenceHeal); + } + + void HandleProc(ProcEventInfo eventInfo) + { + PreventDefaultAction(); + + _nextHealAmount += (int)MathFunctions.CalculatePct(eventInfo.GetDamageInfo().GetDamage(), GetEffectInfo(0).CalcValue(GetTarget())); + } + + void HandlePeriodic(AuraEffect aurEff) + { + if (_nextHealAmount == 0) + return; + + Unit target = GetTarget(); + CastSpellExtraArgs args = new(TriggerCastFlags.FullMask); + args.AddSpellMod(SpellValueMod.BasePoint0, _nextHealAmount); + + target.CastSpell(target, SpellIds.FueledByViolenceHeal, args); + _nextHealAmount = 0; + } + + public override void Register() + { + OnProc.Add(new AuraProcHandler(HandleProc)); + OnEffectPeriodic.Add(new EffectPeriodicHandler(HandlePeriodic, 0, AuraType.PeriodicDummy)); + } + } + [Script] // 6544 Heroic leap class spell_warr_heroic_leap : SpellScript {