From 431085e7d17364c9dc96720893fb2a4e5b781024 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 21 Apr 2021 22:19:12 -0400 Subject: [PATCH] Core/Spells: Added spell value duration to modify aura duration of a specific spell cast Port From (https://github.com/TrinityCore/TrinityCore/commit/2e2dc1afc94b5d6864cf7dc8ca5799c349bdca4d) --- Source/Framework/Constants/UnitConst.cs | 3 ++- Source/Game/Spells/Spell.cs | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Source/Framework/Constants/UnitConst.cs b/Source/Framework/Constants/UnitConst.cs index ca0250af8..126cd7762 100644 --- a/Source/Framework/Constants/UnitConst.cs +++ b/Source/Framework/Constants/UnitConst.cs @@ -394,7 +394,8 @@ namespace Framework.Constants End, RadiusMod, MaxTargets, - AuraStack + AuraStack, + DurationPct } public enum CombatRating diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index 40605a580..f1e749fa4 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -2202,6 +2202,8 @@ namespace Game.Spells duration = m_originalCaster.ModSpellDuration(m_spellInfo, unit, duration, positive, effectMask); if (duration > 0) { + duration = (int)(duration * m_spellValue.DurationMul); + // Haste modifies duration of channeled spells if (m_spellInfo.IsChanneled()) m_originalCaster.ModSpellDurationTime(m_spellInfo, ref duration, this); @@ -2964,6 +2966,9 @@ namespace Game.Spells Player modOwner = m_caster.GetSpellModOwner(); if (modOwner != null) modOwner.ApplySpellMod(m_spellInfo, SpellModOp.Duration, ref duration); + + duration = (int)(duration * m_spellValue.DurationMul); + // Apply haste mods m_caster.ModSpellDurationTime(m_spellInfo, ref duration, this); @@ -6955,6 +6960,9 @@ namespace Game.Spells case SpellValueMod.AuraStack: m_spellValue.AuraStackAmount = value; break; + case SpellValueMod.DurationPct: + m_spellValue.DurationMul = (float)value / 100.0f; + break; } } @@ -7760,6 +7768,7 @@ namespace Game.Spells MaxAffectedTargets = proto.MaxAffectedTargets; RadiusMod = 1.0f; AuraStackAmount = 1; + DurationMul = 1; } public int[] EffectBasePoints = new int[SpellConst.MaxEffects]; @@ -7767,6 +7776,7 @@ namespace Game.Spells public uint MaxAffectedTargets; public float RadiusMod; public int AuraStackAmount; + public float DurationMul; } // Spell modifier (used for modify other spells)