Core/Spells: Fix periodic rolling adding bonuses twice
Port From (https://github.com/TrinityCore/TrinityCore/commit/9fa95b4b57c1d843392d0c321cdabbc3a21e1d69)
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user