Fixed missing effect index being a uint and not a byte anymore, caused spells with more then 8 effects to not trigger them.

This commit is contained in:
hondacrx
2021-02-28 00:25:48 -05:00
parent 2bf56cfb1b
commit b413849c4d
3 changed files with 12 additions and 12 deletions
+5 -5
View File
@@ -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);
}
}
}
+5 -5
View File
@@ -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<WorldObject> targets = new List<WorldObject>();
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;
}
}
+2 -2
View File
@@ -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)