Core/Spells: Replace MAX_SPELL_EFFECTS loop limits with correct upper bound depending on how many effects the spell has
Port From (https://github.com/TrinityCore/TrinityCore/commit/561b122364525deaee815ad900a78f1323c37776)
This commit is contained in:
@@ -826,12 +826,9 @@ namespace Game.Spells
|
||||
m_timeCla = 1 * Time.InMilliseconds;
|
||||
|
||||
// also reset periodic counters
|
||||
for (byte i = 0; i < SpellConst.MaxEffects; ++i)
|
||||
{
|
||||
AuraEffect aurEff = GetEffect(i);
|
||||
foreach (AuraEffect aurEff in GetAuraEffects())
|
||||
if (aurEff != null)
|
||||
aurEff.ResetTicks();
|
||||
}
|
||||
}
|
||||
|
||||
void RefreshTimers(bool resetPeriodicTimer)
|
||||
@@ -851,12 +848,8 @@ namespace Game.Spells
|
||||
RefreshDuration();
|
||||
|
||||
Unit caster = GetCaster();
|
||||
for (byte i = 0; i < SpellConst.MaxEffects; ++i)
|
||||
{
|
||||
AuraEffect aurEff = GetEffect(i);
|
||||
if (aurEff != null)
|
||||
aurEff.CalculatePeriodic(caster, resetPeriodicTimer, false);
|
||||
}
|
||||
foreach (AuraEffect aurEff in GetAuraEffects())
|
||||
aurEff.CalculatePeriodic(caster, resetPeriodicTimer, false);
|
||||
}
|
||||
|
||||
public void SetCharges(int charges)
|
||||
@@ -1807,10 +1800,10 @@ namespace Game.Spells
|
||||
|
||||
// At least one effect has to pass checks to proc aura
|
||||
uint procEffectMask = aurApp.GetEffectMask();
|
||||
for (byte i = 0; i < SpellConst.MaxEffects; ++i)
|
||||
if ((procEffectMask & (1u << i)) != 0)
|
||||
if ((procEntry.DisableEffectsMask & (1u << i)) != 0 || !GetEffect(i).CheckEffectProc(aurApp, eventInfo))
|
||||
procEffectMask &= ~(1u << i);
|
||||
foreach (AuraEffect aurEff in GetAuraEffects())
|
||||
if ((procEffectMask & (1u << (int)aurEff.GetEffIndex())) != 0)
|
||||
if ((procEntry.DisableEffectsMask & (1u << (int)aurEff.GetEffIndex())) != 0 || !GetEffect(aurEff.GetEffIndex()).CheckEffectProc(aurApp, eventInfo))
|
||||
procEffectMask &= ~(1u << (int)aurEff.GetEffIndex());
|
||||
|
||||
if (procEffectMask == 0)
|
||||
return 0;
|
||||
|
||||
@@ -5167,7 +5167,7 @@ namespace Game.Spells
|
||||
{
|
||||
CastSpellExtraArgs args = new(this);
|
||||
args.SetTriggerFlags(TriggerCastFlags.FullMask & ~(TriggerCastFlags.IgnorePowerCost | TriggerCastFlags.IgnoreReagentCost));
|
||||
for (int i = 0; i < SpellConst.MaxEffects; ++i)
|
||||
for (int i = 0; i < triggeredSpellInfo.GetEffects().Count; ++i)
|
||||
args.AddSpellMod(SpellValueMod.BasePoint0 + i, GetAmount());
|
||||
|
||||
triggerCaster.CastSpell(target, triggerSpellId, args);
|
||||
|
||||
Reference in New Issue
Block a user