From dc3cd40d151355825b0e29954cc247533b23fe7c Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 6 Jan 2022 00:06:21 -0500 Subject: [PATCH] Scripts/Spells: fix Turkey Timer duration Port From (https://github.com/TrinityCore/TrinityCore/commit/cd72ecce78b3152b8db62c96e90cb9d14ea5e565) --- Source/Scripts/Spells/Generic.cs | 41 ++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/Source/Scripts/Spells/Generic.cs b/Source/Scripts/Spells/Generic.cs index 3a9cc1f46..131ca5f85 100644 --- a/Source/Scripts/Spells/Generic.cs +++ b/Source/Scripts/Spells/Generic.cs @@ -290,6 +290,10 @@ namespace Scripts.Spells.Generic // SiegeTankControl public const uint SiegeTankControl = 47963; + // CannonBlast + public const uint CannonBlast = 42578; + public const uint CannonBlastDamage = 42576; + // FreezingCircleMisc public const uint FreezingCirclePitOfSaronNormal = 69574; public const uint FreezingCirclePitOfSaronHeroic = 70276; @@ -3124,12 +3128,17 @@ namespace Scripts.Spells.Generic void OnPeriodic(AuraEffect aurEff) { - if (_applyTimes.Empty()) - return; + int removeCount = 0; - // pop stack if it expired for us - if (_applyTimes.First() + GetMaxDuration() < GameTime.GetGameTimeMS()) - ModStackAmount(-1, AuraRemoveMode.Expire); + // pop expired times off of the stack + while (!_applyTimes.Empty() && _applyTimes.FirstOrDefault() + GetMaxDuration() < GameTime.GetGameTimeMS()) + { + _applyTimes.RemoveAt(0); + removeCount++; + } + + if (removeCount != 0) + ModStackAmount(-removeCount, AuraRemoveMode.Expire); } public override void Register() @@ -3924,6 +3933,28 @@ namespace Scripts.Spells.Generic } } + [Script] + class spell_gen_cannon_blast : SpellScript + { + public override bool Validate(SpellInfo spellInfo) + { + return ValidateSpellInfo(SpellIds.CannonBlast); + } + void HandleScript(uint effIndex) + { + int bp = GetEffectValue(); + Unit target = GetHitUnit(); + CastSpellExtraArgs args = new(TriggerCastFlags.FullMask); + args.AddSpellMod(SpellValueMod.BasePoint0, bp); + target.CastSpell(target, SpellIds.CannonBlastDamage, args); + } + + public override void Register() + { + OnEffectHitTarget.Add(new EffectHandler(HandleScript, 0, SpellEffectName.ScriptEffect)); + } + } + [Script] // 169869 - Transformation Sickness class spell_gen_decimatus_transformation_sickness : SpellScript {