From b413849c4d05b8094e6b977e4620e3bb6405c7d4 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sun, 28 Feb 2021 00:25:48 -0500 Subject: [PATCH] Fixed missing effect index being a uint and not a byte anymore, caused spells with more then 8 effects to not trigger them. --- Source/Game/Spells/Auras/Aura.cs | 10 +++++----- Source/Game/Spells/Spell.cs | 10 +++++----- Source/Game/Spells/SpellInfo.cs | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Source/Game/Spells/Auras/Aura.cs b/Source/Game/Spells/Auras/Aura.cs index 280207ed9..a15a42820 100644 --- a/Source/Game/Spells/Auras/Aura.cs +++ b/Source/Game/Spells/Auras/Aura.cs @@ -495,7 +495,7 @@ namespace Game.Spells for (byte effIndex = 0; effIndex < SpellConst.MaxEffects; ++effIndex) { if (unit.IsImmunedToSpellEffect(GetSpellInfo(), effIndex, caster)) - value &= (byte)~(1 << effIndex); + value &= ~(1u << effIndex); } if (value == 0 || unit.IsImmunedToSpell(GetSpellInfo(), caster) || !CanBeAppliedOn(unit)) @@ -2660,9 +2660,9 @@ namespace Game.Spells foreach (var unit in targetList) { if (targets.ContainsKey(unit)) - targets[unit] |= (byte)(1 << (int)effect.EffectIndex); + targets[unit] |= (1u << (int)effect.EffectIndex); else - targets[unit] = (byte)(1 << (int)effect.EffectIndex); + targets[unit] = (1u << (int)effect.EffectIndex); } } } @@ -2722,9 +2722,9 @@ namespace Game.Spells foreach (var unit in targetList) { if (targets.ContainsKey(unit)) - targets[unit] |= (byte)(1 << (int)effect.EffectIndex); + targets[unit] |= (1u << (int)effect.EffectIndex); else - targets[unit] = (byte)(1 << (int)effect.EffectIndex); + targets[unit] = (1u << (int)effect.EffectIndex); } } } diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index d2e2578dc..bab561b2f 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -1097,7 +1097,7 @@ namespace Game.Spells foreach (SpellEffectInfo eff in m_spellInfo.GetEffects()) if (eff != null && Convert.ToBoolean(effMask & (1 << (int)eff.EffectIndex))) m_damageMultipliers[eff.EffectIndex] = 1.0f; - m_applyMultiplierMask |= (byte)effMask; + m_applyMultiplierMask |= effMask; List targets = new List(); SearchChainTargets(targets, (uint)maxTargets - 1, target, targetType.GetObjectType(), targetType.GetCheckType(), effect.ImplicitTargetConditions, targetType.GetTarget() == Targets.UnitChainhealAlly); @@ -2156,7 +2156,7 @@ namespace Game.Spells bool refresh = false; bool resetPeriodicTimer = !_triggeredCastFlags.HasAnyFlag(TriggerCastFlags.DontResetPeriodicTimer); - m_spellAura = Aura.TryRefreshStackOrCreate(m_spellInfo, m_castId, (byte)effectMask, unit, + m_spellAura = Aura.TryRefreshStackOrCreate(m_spellInfo, m_castId, effectMask, unit, m_originalCaster, GetCastDifficulty(), out refresh, basePoints, m_CastItem, ObjectGuid.Empty, resetPeriodicTimer, ObjectGuid.Empty, m_castItemEntry, m_castItemLevel); if (m_spellAura != null) { @@ -2400,7 +2400,7 @@ namespace Game.Spells continue; } - channelTargetEffectMask &= (byte)~ihit.effectMask; // remove from need alive mask effect that have alive target + channelTargetEffectMask &= ~ihit.effectMask; // remove from need alive mask effect that have alive target } } } @@ -5517,7 +5517,7 @@ namespace Game.Spells // Check whether the cast should be prevented by any state you might have. SpellCastResult result = SpellCastResult.SpellCastOk; // Get unit state - UnitFlags unitflag = (UnitFlags)(byte)m_caster.m_unitData.Flags; + UnitFlags unitflag = (UnitFlags)(uint)m_caster.m_unitData.Flags; // this check should only be done when player does cast directly // (ie not when it's called from a script) Breaks for example PlayerAI when charmed @@ -6908,7 +6908,7 @@ namespace Game.Spells m_spellValue.MaxAffectedTargets = (uint)value; break; case SpellValueMod.AuraStack: - m_spellValue.AuraStackAmount = (byte)value; + m_spellValue.AuraStackAmount = value; break; } } diff --git a/Source/Game/Spells/SpellInfo.cs b/Source/Game/Spells/SpellInfo.cs index bbc072aba..de1e40d02 100644 --- a/Source/Game/Spells/SpellInfo.cs +++ b/Source/Game/Spells/SpellInfo.cs @@ -1272,11 +1272,11 @@ namespace Game.Spells return mask; } - public uint GetEffectMechanicMask(byte effIndex) + public uint GetEffectMechanicMask(uint effIndex) { uint mask = 0; if (Mechanic != 0) - mask |= (uint)(1 << (int)Mechanic); + mask |= 1u << (int)Mechanic; var effect = _effects[effIndex]; if (effect != null && effect.IsEffect() && effect.Mechanic != 0)