Core/Spells: Fix periodic rolling adding bonuses twice
Port From (https://github.com/TrinityCore/TrinityCore/commit/9fa95b4b57c1d843392d0c321cdabbc3a21e1d69)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace Game.Spells
|
||||
targetList.Add(app.GetTarget());
|
||||
}
|
||||
}
|
||||
|
||||
void GetApplicationList(out List<AuraApplication> applicationList)
|
||||
{
|
||||
applicationList = new List<AuraApplication>();
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user