diff --git a/Source/Framework/Constants/Spells/SpellConst.cs b/Source/Framework/Constants/Spells/SpellConst.cs index fd2a1dcb8..694420199 100644 --- a/Source/Framework/Constants/Spells/SpellConst.cs +++ b/Source/Framework/Constants/Spells/SpellConst.cs @@ -1894,8 +1894,8 @@ namespace Framework.Constants Unk10 = 0x400, // 10 HerbGatheringMining = 0x800, // 11 UseSpellBaseLevelForScaling = 0x1000, // 12 - ResetColldownOnEncounterEnd = 0x2000, // 13 - Unk14 = 0x4000, // 14 + ResetCooldownOnEncounterEnd = 0x2000, // 13 + RollingPeriodic = 0x4000, // 14 Unk15 = 0x8000, // 15 Unk16 = 0x10000, // 16 CanDodgeParryWhileCasting = 0x20000, // 17 @@ -2067,6 +2067,7 @@ namespace Framework.Constants DirectDamage = 0x100, Charge = 0x200, PickPocket = 0x400, + DeprecatedRollingPeriodic = 0x800, // DO NOT REUSE DeprecatedNegativeEff0 = 0x1000, // DO NOT REUSE DeprecatedNegativeEff1 = 0x2000, // DO NOT REUSE DeprecatedNegativeEff2 = 0x4000, // DO NOT REUSE diff --git a/Source/Game/Entities/Unit/Unit.Spells.cs b/Source/Game/Entities/Unit/Unit.Spells.cs index 40076dfed..9ab56ab1c 100644 --- a/Source/Game/Entities/Unit/Unit.Spells.cs +++ b/Source/Game/Entities/Unit/Unit.Spells.cs @@ -2370,22 +2370,6 @@ namespace Game.Entities m_Diminishing[i].Clear(); } - public uint GetRemainingPeriodicAmount(ObjectGuid caster, uint spellId, AuraType auraType, int effectIndex = 0) - { - uint amount = 0; - var periodicAuras = GetAuraEffectsByType(auraType); - foreach (var aurEff in periodicAuras) - { - if (aurEff.GetCasterGUID() != caster || aurEff.GetId() != spellId || aurEff.GetEffIndex() != effectIndex || aurEff.GetTotalTicks() == 0) - continue; - - amount += (uint)((aurEff.GetAmount() * aurEff.GetRemainingTicks()) / aurEff.GetTotalTicks()); - break; - } - - return amount; - } - // Interrupts public void InterruptNonMeleeSpells(bool withDelayed, uint spell_id = 0, bool withInstant = true) { diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index f92bea320..f5b667a52 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -58,6 +58,7 @@ namespace Game.Spells targetList.Add(app.GetTarget()); } } + void GetApplicationList(out List applicationList) { applicationList = new List(); @@ -120,6 +121,17 @@ namespace Game.Spells break; } + if (GetSpellInfo().HasAttribute(SpellAttr10.RollingPeriodic)) + { + var periodicAuras = GetBase().GetUnitOwner().GetAuraEffectsByType(GetAuraType()); + amount = periodicAuras.Aggregate(0, (val, aurEff) => + { + if (aurEff.GetCasterGUID() == GetCasterGUID() && aurEff.GetId() == GetId() && aurEff.GetEffIndex() == GetEffIndex() && aurEff.GetTotalTicks() > 0) + val += aurEff.GetAmount() * (int)aurEff.GetRemainingTicks() / (int)aurEff.GetTotalTicks(); + return val; + }); + } + GetBase().CallScriptEffectCalcAmountHandlers(this, ref amount, ref m_canBeRecalculated); if (!GetSpellEffectInfo().EffectAttributes.HasFlag(SpellEffectAttributes.NoScaleWithStack)) amount *= GetBase().GetStackAmount(); diff --git a/Source/Scripts/Spells/Druid.cs b/Source/Scripts/Spells/Druid.cs index 1a694c555..2ed2e5076 100644 --- a/Source/Scripts/Spells/Druid.cs +++ b/Source/Scripts/Spells/Druid.cs @@ -1233,8 +1233,6 @@ namespace Scripts.Spells.Druid SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.Languish, GetCastDifficulty()); int amount = (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount()); amount /= (int)spellInfo.GetMaxTicks(); - // Add remaining ticks to damage done - amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.Languish, AuraType.PeriodicDamage); CastSpellExtraArgs args = new(aurEff); args.AddSpellMod(SpellValueMod.BasePoint0, amount); diff --git a/Source/Scripts/Spells/Mage.cs b/Source/Scripts/Spells/Mage.cs index d1fc33ea5..84e7f3754 100644 --- a/Source/Scripts/Spells/Mage.cs +++ b/Source/Scripts/Spells/Mage.cs @@ -586,7 +586,6 @@ namespace Scripts.Spells.Mage int pct = aurEff.GetAmount(); int amount = (int)(MathFunctions.CalculatePct(eventInfo.GetDamageInfo().GetDamage(), pct) / igniteDot.GetMaxTicks()); - amount += (int)eventInfo.GetProcTarget().GetRemainingPeriodicAmount(eventInfo.GetActor().GetGUID(), SpellIds.Ignite, AuraType.PeriodicDamage); CastSpellExtraArgs args = new(aurEff); args.AddSpellMod(SpellValueMod.BasePoint0, amount); diff --git a/Source/Scripts/Spells/Paladin.cs b/Source/Scripts/Spells/Paladin.cs index 6a5462486..00f48614a 100644 --- a/Source/Scripts/Spells/Paladin.cs +++ b/Source/Scripts/Spells/Paladin.cs @@ -819,8 +819,6 @@ namespace Scripts.Spells.Paladin SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.HolyMending, GetCastDifficulty()); int amount = (int)MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount()); amount /= (int)spellInfo.GetMaxTicks(); - // Add remaining ticks to damage done - amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.HolyMending, AuraType.PeriodicHeal); CastSpellExtraArgs args = new(aurEff); args.AddSpellMod(SpellValueMod.BasePoint0, amount); diff --git a/Source/Scripts/Spells/Priest.cs b/Source/Scripts/Spells/Priest.cs index 729c6f8d5..190c967b2 100644 --- a/Source/Scripts/Spells/Priest.cs +++ b/Source/Scripts/Spells/Priest.cs @@ -868,10 +868,8 @@ namespace Scripts.Spells.Priest int amount = (int)MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount()); amount /= (int)spellInfo.GetMaxTicks(); - // Add remaining ticks to healing done Unit caster = eventInfo.GetActor(); Unit target = eventInfo.GetProcTarget(); - amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.BlessedHealing, AuraType.PeriodicHeal); CastSpellExtraArgs args = new(aurEff); args.AddSpellMod(SpellValueMod.BasePoint0, amount); diff --git a/Source/Scripts/Spells/Shaman.cs b/Source/Scripts/Spells/Shaman.cs index 689d06dbe..2a94da6ec 100644 --- a/Source/Scripts/Spells/Shaman.cs +++ b/Source/Scripts/Spells/Shaman.cs @@ -904,10 +904,8 @@ namespace Scripts.Spells.Shaman int amount = (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount()); amount /= (int)spellInfo.GetMaxTicks(); - // Add remaining ticks to damage done Unit caster = eventInfo.GetActor(); Unit target = eventInfo.GetProcTarget(); - amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.Electrified, AuraType.PeriodicDamage); CastSpellExtraArgs args = new(aurEff); args.AddSpellMod(SpellValueMod.BasePoint0, amount); @@ -940,10 +938,8 @@ namespace Scripts.Spells.Shaman int amount = (int)MathFunctions.CalculatePct(damageInfo.GetDamage(), aurEff.GetAmount()); amount /= (int)spellInfo.GetMaxTicks(); - // Add remaining ticks to damage done Unit caster = eventInfo.GetActor(); Unit target = eventInfo.GetProcTarget(); - amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.LavaBurstBonusDamage, AuraType.PeriodicDamage); CastSpellExtraArgs args = new(aurEff); args.AddSpellMod(SpellValueMod.BasePoint0, amount); @@ -1008,10 +1004,8 @@ namespace Scripts.Spells.Shaman int amount = (int)MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount()); amount /= (int)spellInfo.GetMaxTicks(); - // Add remaining ticks to healing done Unit caster = eventInfo.GetActor(); Unit target = eventInfo.GetProcTarget(); - amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.ChainedHeal, AuraType.PeriodicHeal); CastSpellExtraArgs args = new(aurEff); args.AddSpellMod(SpellValueMod.BasePoint0, amount); diff --git a/Source/Scripts/Spells/Warrior.cs b/Source/Scripts/Spells/Warrior.cs index 4cac3c2be..d56c26e5f 100644 --- a/Source/Scripts/Spells/Warrior.cs +++ b/Source/Scripts/Spells/Warrior.cs @@ -506,10 +506,8 @@ namespace Scripts.Spells.Warrior void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo) { Unit target = eventInfo.GetActionTarget(); - //Get the Remaining Damage from the aura (if exist) - int remainingDamage = (int)target.GetRemainingPeriodicAmount(target.GetGUID(), SpellIds.TraumaEffect, AuraType.PeriodicDamage); //Get 25% of damage from the spell casted (Slam & Whirlwind) plus Remaining Damage from Aura - int damage = (int)(MathFunctions.CalculatePct(eventInfo.GetDamageInfo().GetDamage(), aurEff.GetAmount()) / Global.SpellMgr.GetSpellInfo(SpellIds.TraumaEffect, GetCastDifficulty()).GetMaxTicks()) + remainingDamage; + int damage = (int)(MathFunctions.CalculatePct(eventInfo.GetDamageInfo().GetDamage(), aurEff.GetAmount()) / Global.SpellMgr.GetSpellInfo(SpellIds.TraumaEffect, GetCastDifficulty()).GetMaxTicks()); CastSpellExtraArgs args = new(TriggerCastFlags.FullMask); args.AddSpellMod(SpellValueMod.BasePoint0, damage); GetCaster().CastSpell(target, SpellIds.TraumaEffect, args);