Core/Spells: Extended mechanic mask to uint64
Port From (https://github.com/TrinityCore/TrinityCore/commit/de7c03c8385780f05530c2b3cf952a712d5f8f00)
This commit is contained in:
@@ -2067,20 +2067,20 @@ namespace Game.Entities
|
||||
if (GetOwnerGUID().IsPlayer() && IsHunterPet())
|
||||
return;
|
||||
|
||||
uint mask = GetCreatureTemplate().MechanicImmuneMask;
|
||||
if (mask != 0)
|
||||
ulong mechanicMask = GetCreatureTemplate().MechanicImmuneMask;
|
||||
if (mechanicMask != 0)
|
||||
{
|
||||
for (uint i = 0 + 1; i < (int)Mechanics.Max; ++i)
|
||||
{
|
||||
if ((mask & (1u << ((int)i - 1))) != 0)
|
||||
if ((mechanicMask & (1ul << ((int)i - 1))) != 0)
|
||||
ApplySpellImmune(placeholderSpellId, SpellImmunity.Mechanic, i, true);
|
||||
}
|
||||
}
|
||||
|
||||
mask = GetCreatureTemplate().SpellSchoolImmuneMask;
|
||||
if (mask != 0)
|
||||
uint schoolMask = GetCreatureTemplate().SpellSchoolImmuneMask;
|
||||
if (schoolMask != 0)
|
||||
for (var i = (int)SpellSchools.Normal; i <= (int)SpellSchools.Max; ++i)
|
||||
if ((mask & (1 << i)) != 0)
|
||||
if ((schoolMask & (1 << i)) != 0)
|
||||
ApplySpellImmune(placeholderSpellId, SpellImmunity.School, 1u << i, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace Game.Entities
|
||||
public int WidgetSetID;
|
||||
public int WidgetSetUnitConditionID;
|
||||
public bool RegenHealth;
|
||||
public uint MechanicImmuneMask;
|
||||
public ulong MechanicImmuneMask;
|
||||
public uint SpellSchoolImmuneMask;
|
||||
public CreatureFlagsExtra FlagsExtra;
|
||||
public uint ScriptID;
|
||||
|
||||
@@ -1855,10 +1855,10 @@ namespace Game.Entities
|
||||
|
||||
if (!positive)
|
||||
{
|
||||
uint mechanicMask = spellInfo.GetSpellMechanicMaskByEffectMask(effectMask);
|
||||
ulong mechanicMask = spellInfo.GetSpellMechanicMaskByEffectMask(effectMask);
|
||||
bool mechanicCheck(AuraEffect aurEff)
|
||||
{
|
||||
if ((mechanicMask & (1 << aurEff.GetMiscValue())) != 0)
|
||||
if ((mechanicMask & (1ul << aurEff.GetMiscValue())) != 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -542,7 +542,7 @@ namespace Game.Entities
|
||||
Creature creature1 = ToCreature();
|
||||
if (creature1)
|
||||
{
|
||||
uint immuneMask = creature1.GetCreatureTemplate().MechanicImmuneMask;
|
||||
ulong immuneMask = creature1.GetCreatureTemplate().MechanicImmuneMask;
|
||||
if (Convert.ToBoolean(immuneMask & (1 << ((int)Mechanics.Snare - 1))) || Convert.ToBoolean(immuneMask & (1 << ((int)Mechanics.Daze - 1))))
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -257,12 +257,12 @@ namespace Game.Entities
|
||||
float TakenTotalMod = 1.0f;
|
||||
|
||||
// Mod damage from spell mechanic
|
||||
uint mechanicMask = spellProto.GetAllEffectsMechanicMask();
|
||||
ulong mechanicMask = spellProto.GetAllEffectsMechanicMask();
|
||||
if (mechanicMask != 0)
|
||||
{
|
||||
TakenTotalMod *= GetTotalAuraMultiplier(AuraType.ModMechanicDamageTakenPercent, aurEff =>
|
||||
{
|
||||
if ((mechanicMask & (1 << aurEff.GetMiscValue())) != 0)
|
||||
if ((mechanicMask & (1ul << aurEff.GetMiscValue())) != 0)
|
||||
return true;
|
||||
return false;
|
||||
});
|
||||
@@ -1331,12 +1331,12 @@ namespace Game.Entities
|
||||
return mask;
|
||||
}
|
||||
|
||||
public uint GetMechanicImmunityMask()
|
||||
public ulong GetMechanicImmunityMask()
|
||||
{
|
||||
uint mask = 0;
|
||||
ulong mask = 0;
|
||||
var mechanicList = m_spellImmune[(int)SpellImmunity.Mechanic];
|
||||
foreach (var pair in mechanicList)
|
||||
mask |= (1u << (int)pair.Value);
|
||||
mask |= (1ul << (int)pair.Value);
|
||||
|
||||
return mask;
|
||||
}
|
||||
@@ -2648,17 +2648,18 @@ namespace Game.Entities
|
||||
|
||||
return false;
|
||||
}
|
||||
public bool HasAuraWithMechanic(uint mechanicMask)
|
||||
|
||||
public bool HasAuraWithMechanic(ulong mechanicMask)
|
||||
{
|
||||
foreach (var pair in GetAppliedAuras())
|
||||
{
|
||||
SpellInfo spellInfo = pair.Value.GetBase().GetSpellInfo();
|
||||
if (spellInfo.Mechanic != 0 && Convert.ToBoolean(mechanicMask & (1 << (int)spellInfo.Mechanic)))
|
||||
if (spellInfo.Mechanic != 0 && Convert.ToBoolean(mechanicMask & (1ul << (int)spellInfo.Mechanic)))
|
||||
return true;
|
||||
|
||||
foreach (var spellEffectInfo in spellInfo.GetEffects())
|
||||
if (spellEffectInfo != null && pair.Value.HasEffect(spellEffectInfo.EffectIndex) && spellEffectInfo.IsEffect() && spellEffectInfo.Mechanic != 0)
|
||||
if ((mechanicMask & (1 << (int)spellEffectInfo.Mechanic)) != 0)
|
||||
if ((mechanicMask & (1ul << (int)spellEffectInfo.Mechanic)) != 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2669,6 +2670,7 @@ namespace Game.Entities
|
||||
{
|
||||
return !m_modAuras.LookupByKey(auraType).Empty();
|
||||
}
|
||||
|
||||
public bool HasAuraTypeWithCaster(AuraType auraType, ObjectGuid caster)
|
||||
{
|
||||
foreach (var auraEffect in GetAuraEffectsByType(auraType))
|
||||
@@ -2677,6 +2679,7 @@ namespace Game.Entities
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool HasAuraTypeWithMiscvalue(AuraType auraType, int miscvalue)
|
||||
{
|
||||
foreach (var auraEffect in GetAuraEffectsByType(auraType))
|
||||
@@ -2685,6 +2688,7 @@ namespace Game.Entities
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool HasAuraTypeWithAffectMask(AuraType auraType, SpellInfo affectedSpell)
|
||||
{
|
||||
foreach (var auraEffect in GetAuraEffectsByType(auraType))
|
||||
@@ -2693,6 +2697,7 @@ namespace Game.Entities
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool HasAuraTypeWithValue(AuraType auraType, int value)
|
||||
{
|
||||
foreach (var auraEffect in GetAuraEffectsByType(auraType))
|
||||
@@ -2930,7 +2935,7 @@ namespace Game.Entities
|
||||
UpdateInterruptMask();
|
||||
}
|
||||
|
||||
public void RemoveAurasWithMechanic(uint mechanicMaskToRemove, AuraRemoveMode removeMode = AuraRemoveMode.Default, uint exceptSpellId = 0, bool withEffectMechanics = false)
|
||||
public void RemoveAurasWithMechanic(ulong mechanicMaskToRemove, AuraRemoveMode removeMode = AuraRemoveMode.Default, uint exceptSpellId = 0, bool withEffectMechanics = false)
|
||||
{
|
||||
RemoveAppliedAuras(aurApp =>
|
||||
{
|
||||
@@ -2938,12 +2943,12 @@ namespace Game.Entities
|
||||
if (exceptSpellId != 0 && aura.GetId() == exceptSpellId)
|
||||
return false;
|
||||
|
||||
uint appliedMechanicMask = aura.GetSpellInfo().GetSpellMechanicMaskByEffectMask(aurApp.GetEffectMask());
|
||||
ulong appliedMechanicMask = aura.GetSpellInfo().GetSpellMechanicMaskByEffectMask(aurApp.GetEffectMask());
|
||||
if ((appliedMechanicMask & mechanicMaskToRemove) == 0)
|
||||
return false;
|
||||
|
||||
// spell mechanic matches required mask for removal
|
||||
if (((1 << (int)aura.GetSpellInfo().Mechanic) & mechanicMaskToRemove) != 0 || withEffectMechanics)
|
||||
if (((1ul << (int)aura.GetSpellInfo().Mechanic) & mechanicMaskToRemove) != 0 || withEffectMechanics)
|
||||
return true;
|
||||
|
||||
// effect mechanic matches required mask for removal - don't remove, only update targets
|
||||
@@ -3356,7 +3361,7 @@ namespace Game.Entities
|
||||
|
||||
public void RemoveAurasByShapeShift()
|
||||
{
|
||||
uint mechanic_mask = (1 << (int)Mechanics.Snare) | (1 << (int)Mechanics.Root);
|
||||
ulong mechanic_mask = (1 << (int)Mechanics.Snare) | (1 << (int)Mechanics.Root);
|
||||
foreach (var pair in GetAppliedAuras())
|
||||
{
|
||||
Aura aura = pair.Value.GetBase();
|
||||
|
||||
@@ -3897,7 +3897,7 @@ namespace Game.Entities
|
||||
});
|
||||
|
||||
// Mod damage from spell mechanic
|
||||
uint mechanicMask = spellProto.GetAllEffectsMechanicMask();
|
||||
ulong mechanicMask = spellProto.GetAllEffectsMechanicMask();
|
||||
|
||||
// Shred, Maul - "Effects which increase Bleed damage also increase Shred damage"
|
||||
if (spellProto.SpellFamilyName == SpellFamilyNames.Druid && spellProto.SpellFamilyFlags[0].HasAnyFlag(0x00008800u))
|
||||
@@ -3907,7 +3907,7 @@ namespace Game.Entities
|
||||
{
|
||||
TakenTotalMod *= GetTotalAuraMultiplier(AuraType.ModMechanicDamageTakenPercent, aurEff =>
|
||||
{
|
||||
if ((mechanicMask & (1 << (aurEff.GetMiscValue()))) != 0)
|
||||
if ((mechanicMask & (1ul << (aurEff.GetMiscValue()))) != 0)
|
||||
return true;
|
||||
return false;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user