Core/Spells: Extended mechanic mask to uint64

Port From (https://github.com/TrinityCore/TrinityCore/commit/de7c03c8385780f05530c2b3cf952a712d5f8f00)
This commit is contained in:
hondacrx
2022-12-17 17:37:07 -05:00
parent 3f3ea5bb89
commit 2dc12dbb69
16 changed files with 83 additions and 74 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ namespace Framework.Constants
PetType = 45, // mask 0 0 true if player has a pet of given type(s) PetType = 45, // mask 0 0 true if player has a pet of given type(s)
Taxi = 46, // 0 0 0 true if player is on taxi Taxi = 46, // 0 0 0 true if player is on taxi
Queststate = 47, // quest_id state_mask 0 true if player is in any of the provided quest states for the quest (1 = not taken, 2 = completed, 8 = in progress, 32 = failed, 64 = rewarded) Queststate = 47, // quest_id state_mask 0 true if player is in any of the provided quest states for the quest (1 = not taken, 2 = completed, 8 = in progress, 32 = failed, 64 = rewarded)
ObjectiveProgress = 48, // ID 0 0 true if player has ID objective complete, but quest not yet rewarded ObjectiveProgress = 48, // ID 0 progressValue true if player has ID objective progress equal to ConditionValue3 (and quest is in quest log)
DifficultyId = 49, // Difficulty 0 0 true is map has difficulty id DifficultyId = 49, // Difficulty 0 0 true is map has difficulty id
Gamemaster = 50, // canBeGM 0 0 true if player is gamemaster (or can be gamemaster) Gamemaster = 50, // canBeGM 0 0 true if player is gamemaster (or can be gamemaster)
ObjectEntryGuid = 51, // TypeID entry guid true if object is type TypeID and the entry is 0 or matches entry of the object or matches guid of the object ObjectEntryGuid = 51, // TypeID entry guid true if object is type TypeID and the entry is 0 or matches entry of the object or matches guid of the object
@@ -337,7 +337,11 @@ namespace Framework.Constants
Sapped = 30, Sapped = 30,
Enraged = 31, Enraged = 31,
Wounded = 32, Wounded = 32,
Max = 33, Infected2 = 33,
Infected3 = 34,
Infected4 = 35,
Taunted = 36,
Max = 37,
ImmuneToMovementImpairmentAndLossControlMask = ((1 << Charm) | (1 << Disoriented) | ImmuneToMovementImpairmentAndLossControlMask = ((1 << Charm) | (1 << Disoriented) |
(1 << Fear) | (1 << Root) | (1 << Sleep) | (1 << Snare) | (1 << Stun) | (1 << Fear) | (1 << Root) | (1 << Sleep) | (1 << Snare) | (1 << Stun) |
+2 -2
View File
@@ -97,7 +97,7 @@ namespace Game.Chat
uint faction = target.GetFaction(); uint faction = target.GetFaction();
ulong npcflags = (ulong)target.m_unitData.NpcFlags[1] << 32 | target.m_unitData.NpcFlags[0]; ulong npcflags = (ulong)target.m_unitData.NpcFlags[1] << 32 | target.m_unitData.NpcFlags[0];
uint mechanicImmuneMask = cInfo.MechanicImmuneMask; ulong mechanicImmuneMask = cInfo.MechanicImmuneMask;
uint displayid = target.GetDisplayId(); uint displayid = target.GetDisplayId();
uint nativeid = target.GetNativeDisplayId(); uint nativeid = target.GetNativeDisplayId();
uint entry = target.GetEntry(); uint entry = target.GetEntry();
@@ -166,7 +166,7 @@ namespace Game.Chat
handler.SendSysMessage(CypherStrings.NpcinfoMechanicImmune, mechanicImmuneMask); handler.SendSysMessage(CypherStrings.NpcinfoMechanicImmune, mechanicImmuneMask);
foreach (int value in Enum.GetValues(typeof(Mechanics))) foreach (int value in Enum.GetValues(typeof(Mechanics)))
if (Convert.ToBoolean(mechanicImmuneMask & (1 << (value - 1)))) if (Convert.ToBoolean(mechanicImmuneMask & (1ul << (value - 1))))
handler.SendSysMessage("{0} (0x{1:X})", (Mechanics)value, value); handler.SendSysMessage("{0} (0x{1:X})", (Mechanics)value, value);
return true; return true;
+2 -2
View File
@@ -2530,13 +2530,13 @@ namespace Game
case UnitConditionVariable.HasHelpfulAuraDispelType: case UnitConditionVariable.HasHelpfulAuraDispelType:
return unit.GetAuraApplication(aurApp => !aurApp.GetFlags().HasFlag(AuraFlags.Negative) && (int)aurApp.GetBase().GetSpellInfo().Dispel == value) != null ? value : 0; return unit.GetAuraApplication(aurApp => !aurApp.GetFlags().HasFlag(AuraFlags.Negative) && (int)aurApp.GetBase().GetSpellInfo().Dispel == value) != null ? value : 0;
case UnitConditionVariable.HasHelpfulAuraMechanic: case UnitConditionVariable.HasHelpfulAuraMechanic:
return unit.GetAuraApplication(aurApp => !aurApp.GetFlags().HasFlag(AuraFlags.Negative) && (aurApp.GetBase().GetSpellInfo().GetSpellMechanicMaskByEffectMask(aurApp.GetEffectMask()) & (1 << value)) != 0) != null ? value : 0; return unit.GetAuraApplication(aurApp => !aurApp.GetFlags().HasFlag(AuraFlags.Negative) && (aurApp.GetBase().GetSpellInfo().GetSpellMechanicMaskByEffectMask(aurApp.GetEffectMask()) & (1ul << value)) != 0) != null ? value : 0;
case UnitConditionVariable.HasHarmfulAuraSpell: case UnitConditionVariable.HasHarmfulAuraSpell:
return unit.GetAuraApplication((uint)value, aurApp => aurApp.GetFlags().HasFlag(AuraFlags.Negative)) != null ? value : 0; return unit.GetAuraApplication((uint)value, aurApp => aurApp.GetFlags().HasFlag(AuraFlags.Negative)) != null ? value : 0;
case UnitConditionVariable.HasHarmfulAuraDispelType: case UnitConditionVariable.HasHarmfulAuraDispelType:
return unit.GetAuraApplication(aurApp => aurApp.GetFlags().HasFlag(AuraFlags.Negative) && (int)aurApp.GetBase().GetSpellInfo().Dispel == value) != null ? value : 0; return unit.GetAuraApplication(aurApp => aurApp.GetFlags().HasFlag(AuraFlags.Negative) && (int)aurApp.GetBase().GetSpellInfo().Dispel == value) != null ? value : 0;
case UnitConditionVariable.HasHarmfulAuraMechanic: case UnitConditionVariable.HasHarmfulAuraMechanic:
return unit.GetAuraApplication(aurApp => aurApp.GetFlags().HasFlag(AuraFlags.Negative) && (aurApp.GetBase().GetSpellInfo().GetSpellMechanicMaskByEffectMask(aurApp.GetEffectMask()) & (1 << value)) != 0) != null ? value : 0; return unit.GetAuraApplication(aurApp => aurApp.GetFlags().HasFlag(AuraFlags.Negative) && (aurApp.GetBase().GetSpellInfo().GetSpellMechanicMaskByEffectMask(aurApp.GetEffectMask()) & (1ul << value)) != 0) != null ? value : 0;
case UnitConditionVariable.HasHarmfulAuraSchool: case UnitConditionVariable.HasHarmfulAuraSchool:
return unit.GetAuraApplication(aurApp => aurApp.GetFlags().HasFlag(AuraFlags.Negative) && ((int)aurApp.GetBase().GetSpellInfo().GetSchoolMask() & (1 << value)) != 0) != null ? value : 0; return unit.GetAuraApplication(aurApp => aurApp.GetFlags().HasFlag(AuraFlags.Negative) && ((int)aurApp.GetBase().GetSpellInfo().GetSchoolMask() & (1 << value)) != 0) != null ? value : 0;
case UnitConditionVariable.DamagePhysicalPct: case UnitConditionVariable.DamagePhysicalPct:
+6 -6
View File
@@ -2067,20 +2067,20 @@ namespace Game.Entities
if (GetOwnerGUID().IsPlayer() && IsHunterPet()) if (GetOwnerGUID().IsPlayer() && IsHunterPet())
return; return;
uint mask = GetCreatureTemplate().MechanicImmuneMask; ulong mechanicMask = GetCreatureTemplate().MechanicImmuneMask;
if (mask != 0) if (mechanicMask != 0)
{ {
for (uint i = 0 + 1; i < (int)Mechanics.Max; ++i) 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); ApplySpellImmune(placeholderSpellId, SpellImmunity.Mechanic, i, true);
} }
} }
mask = GetCreatureTemplate().SpellSchoolImmuneMask; uint schoolMask = GetCreatureTemplate().SpellSchoolImmuneMask;
if (mask != 0) if (schoolMask != 0)
for (var i = (int)SpellSchools.Normal; i <= (int)SpellSchools.Max; ++i) 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); ApplySpellImmune(placeholderSpellId, SpellImmunity.School, 1u << i, true);
} }
@@ -88,7 +88,7 @@ namespace Game.Entities
public int WidgetSetID; public int WidgetSetID;
public int WidgetSetUnitConditionID; public int WidgetSetUnitConditionID;
public bool RegenHealth; public bool RegenHealth;
public uint MechanicImmuneMask; public ulong MechanicImmuneMask;
public uint SpellSchoolImmuneMask; public uint SpellSchoolImmuneMask;
public CreatureFlagsExtra FlagsExtra; public CreatureFlagsExtra FlagsExtra;
public uint ScriptID; public uint ScriptID;
+2 -2
View File
@@ -1855,10 +1855,10 @@ namespace Game.Entities
if (!positive) if (!positive)
{ {
uint mechanicMask = spellInfo.GetSpellMechanicMaskByEffectMask(effectMask); ulong mechanicMask = spellInfo.GetSpellMechanicMaskByEffectMask(effectMask);
bool mechanicCheck(AuraEffect aurEff) bool mechanicCheck(AuraEffect aurEff)
{ {
if ((mechanicMask & (1 << aurEff.GetMiscValue())) != 0) if ((mechanicMask & (1ul << aurEff.GetMiscValue())) != 0)
return true; return true;
return false; return false;
} }
+1 -1
View File
@@ -542,7 +542,7 @@ namespace Game.Entities
Creature creature1 = ToCreature(); Creature creature1 = ToCreature();
if (creature1) 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)))) if (Convert.ToBoolean(immuneMask & (1 << ((int)Mechanics.Snare - 1))) || Convert.ToBoolean(immuneMask & (1 << ((int)Mechanics.Daze - 1))))
break; break;
} }
+17 -12
View File
@@ -257,12 +257,12 @@ namespace Game.Entities
float TakenTotalMod = 1.0f; float TakenTotalMod = 1.0f;
// Mod damage from spell mechanic // Mod damage from spell mechanic
uint mechanicMask = spellProto.GetAllEffectsMechanicMask(); ulong mechanicMask = spellProto.GetAllEffectsMechanicMask();
if (mechanicMask != 0) if (mechanicMask != 0)
{ {
TakenTotalMod *= GetTotalAuraMultiplier(AuraType.ModMechanicDamageTakenPercent, aurEff => TakenTotalMod *= GetTotalAuraMultiplier(AuraType.ModMechanicDamageTakenPercent, aurEff =>
{ {
if ((mechanicMask & (1 << aurEff.GetMiscValue())) != 0) if ((mechanicMask & (1ul << aurEff.GetMiscValue())) != 0)
return true; return true;
return false; return false;
}); });
@@ -1331,12 +1331,12 @@ namespace Game.Entities
return mask; return mask;
} }
public uint GetMechanicImmunityMask() public ulong GetMechanicImmunityMask()
{ {
uint mask = 0; ulong mask = 0;
var mechanicList = m_spellImmune[(int)SpellImmunity.Mechanic]; var mechanicList = m_spellImmune[(int)SpellImmunity.Mechanic];
foreach (var pair in mechanicList) foreach (var pair in mechanicList)
mask |= (1u << (int)pair.Value); mask |= (1ul << (int)pair.Value);
return mask; return mask;
} }
@@ -2648,17 +2648,18 @@ namespace Game.Entities
return false; return false;
} }
public bool HasAuraWithMechanic(uint mechanicMask)
public bool HasAuraWithMechanic(ulong mechanicMask)
{ {
foreach (var pair in GetAppliedAuras()) foreach (var pair in GetAppliedAuras())
{ {
SpellInfo spellInfo = pair.Value.GetBase().GetSpellInfo(); 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; return true;
foreach (var spellEffectInfo in spellInfo.GetEffects()) foreach (var spellEffectInfo in spellInfo.GetEffects())
if (spellEffectInfo != null && pair.Value.HasEffect(spellEffectInfo.EffectIndex) && spellEffectInfo.IsEffect() && spellEffectInfo.Mechanic != 0) 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; return true;
} }
@@ -2669,6 +2670,7 @@ namespace Game.Entities
{ {
return !m_modAuras.LookupByKey(auraType).Empty(); return !m_modAuras.LookupByKey(auraType).Empty();
} }
public bool HasAuraTypeWithCaster(AuraType auraType, ObjectGuid caster) public bool HasAuraTypeWithCaster(AuraType auraType, ObjectGuid caster)
{ {
foreach (var auraEffect in GetAuraEffectsByType(auraType)) foreach (var auraEffect in GetAuraEffectsByType(auraType))
@@ -2677,6 +2679,7 @@ namespace Game.Entities
return false; return false;
} }
public bool HasAuraTypeWithMiscvalue(AuraType auraType, int miscvalue) public bool HasAuraTypeWithMiscvalue(AuraType auraType, int miscvalue)
{ {
foreach (var auraEffect in GetAuraEffectsByType(auraType)) foreach (var auraEffect in GetAuraEffectsByType(auraType))
@@ -2685,6 +2688,7 @@ namespace Game.Entities
return false; return false;
} }
public bool HasAuraTypeWithAffectMask(AuraType auraType, SpellInfo affectedSpell) public bool HasAuraTypeWithAffectMask(AuraType auraType, SpellInfo affectedSpell)
{ {
foreach (var auraEffect in GetAuraEffectsByType(auraType)) foreach (var auraEffect in GetAuraEffectsByType(auraType))
@@ -2693,6 +2697,7 @@ namespace Game.Entities
return false; return false;
} }
public bool HasAuraTypeWithValue(AuraType auraType, int value) public bool HasAuraTypeWithValue(AuraType auraType, int value)
{ {
foreach (var auraEffect in GetAuraEffectsByType(auraType)) foreach (var auraEffect in GetAuraEffectsByType(auraType))
@@ -2930,7 +2935,7 @@ namespace Game.Entities
UpdateInterruptMask(); 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 => RemoveAppliedAuras(aurApp =>
{ {
@@ -2938,12 +2943,12 @@ namespace Game.Entities
if (exceptSpellId != 0 && aura.GetId() == exceptSpellId) if (exceptSpellId != 0 && aura.GetId() == exceptSpellId)
return false; return false;
uint appliedMechanicMask = aura.GetSpellInfo().GetSpellMechanicMaskByEffectMask(aurApp.GetEffectMask()); ulong appliedMechanicMask = aura.GetSpellInfo().GetSpellMechanicMaskByEffectMask(aurApp.GetEffectMask());
if ((appliedMechanicMask & mechanicMaskToRemove) == 0) if ((appliedMechanicMask & mechanicMaskToRemove) == 0)
return false; return false;
// spell mechanic matches required mask for removal // 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; return true;
// effect mechanic matches required mask for removal - don't remove, only update targets // effect mechanic matches required mask for removal - don't remove, only update targets
@@ -3356,7 +3361,7 @@ namespace Game.Entities
public void RemoveAurasByShapeShift() 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()) foreach (var pair in GetAppliedAuras())
{ {
Aura aura = pair.Value.GetBase(); Aura aura = pair.Value.GetBase();
+2 -2
View File
@@ -3897,7 +3897,7 @@ namespace Game.Entities
}); });
// Mod damage from spell mechanic // Mod damage from spell mechanic
uint mechanicMask = spellProto.GetAllEffectsMechanicMask(); ulong mechanicMask = spellProto.GetAllEffectsMechanicMask();
// Shred, Maul - "Effects which increase Bleed damage also increase Shred damage" // Shred, Maul - "Effects which increase Bleed damage also increase Shred damage"
if (spellProto.SpellFamilyName == SpellFamilyNames.Druid && spellProto.SpellFamilyFlags[0].HasAnyFlag(0x00008800u)) if (spellProto.SpellFamilyName == SpellFamilyNames.Druid && spellProto.SpellFamilyFlags[0].HasAnyFlag(0x00008800u))
@@ -3907,7 +3907,7 @@ namespace Game.Entities
{ {
TakenTotalMod *= GetTotalAuraMultiplier(AuraType.ModMechanicDamageTakenPercent, aurEff => TakenTotalMod *= GetTotalAuraMultiplier(AuraType.ModMechanicDamageTakenPercent, aurEff =>
{ {
if ((mechanicMask & (1 << (aurEff.GetMiscValue()))) != 0) if ((mechanicMask & (1ul << (aurEff.GetMiscValue()))) != 0)
return true; return true;
return false; return false;
}); });
+2 -2
View File
@@ -1902,7 +1902,7 @@ namespace Game
creature.WidgetSetID = fields.Read<int>(64); creature.WidgetSetID = fields.Read<int>(64);
creature.WidgetSetUnitConditionID = fields.Read<int>(65); creature.WidgetSetUnitConditionID = fields.Read<int>(65);
creature.RegenHealth = fields.Read<bool>(66); creature.RegenHealth = fields.Read<bool>(66);
creature.MechanicImmuneMask = fields.Read<uint>(67); creature.MechanicImmuneMask = fields.Read<ulong>(67);
creature.SpellSchoolImmuneMask = fields.Read<uint>(68); creature.SpellSchoolImmuneMask = fields.Read<uint>(68);
creature.FlagsExtra = (CreatureFlagsExtra)fields.Read<uint>(69); creature.FlagsExtra = (CreatureFlagsExtra)fields.Read<uint>(69);
creature.ScriptID = GetScriptId(fields.Read<string>(70)); creature.ScriptID = GetScriptId(fields.Read<string>(70));
@@ -2774,7 +2774,7 @@ namespace Game
Log.outError(LogFilter.Sql, "Possible FIX: UPDATE `creature_template` SET `RegenHealth`={0} WHERE `entry`={1};", cInfo.RegenHealth, cInfo.DifficultyEntry[diff]); Log.outError(LogFilter.Sql, "Possible FIX: UPDATE `creature_template` SET `RegenHealth`={0} WHERE `entry`={1};", cInfo.RegenHealth, cInfo.DifficultyEntry[diff]);
} }
uint differenceMask = cInfo.MechanicImmuneMask & (~difficultyInfo.MechanicImmuneMask); ulong differenceMask = cInfo.MechanicImmuneMask & (~difficultyInfo.MechanicImmuneMask);
if (differenceMask != 0) if (differenceMask != 0)
{ {
Log.outError(LogFilter.Sql, "Creature (Entry: {0}, mechanic_immune_mask: {1}) has weaker immunities in difficulty {2} mode (Entry: {3}, mechanic_immune_mask: {4}).", Log.outError(LogFilter.Sql, "Creature (Entry: {0}, mechanic_immune_mask: {1}) has weaker immunities in difficulty {2} mode (Entry: {3}, mechanic_immune_mask: {4}).",
+1 -1
View File
@@ -604,7 +604,7 @@ namespace Game.Spells
case AuraType.MechanicImmunity: case AuraType.MechanicImmunity:
case AuraType.ModMechanicResistance: case AuraType.ModMechanicResistance:
// compare mechanic // compare mechanic
if (spellInfo == null || !Convert.ToBoolean(spellInfo.GetAllEffectsMechanicMask() & (1 << GetMiscValue()))) if (spellInfo == null || (spellInfo.GetAllEffectsMechanicMask() & (1ul << GetMiscValue())) == 0)
return false; return false;
break; break;
case AuraType.ModCastingSpeedNotStack: case AuraType.ModCastingSpeedNotStack:
+4 -4
View File
@@ -3714,7 +3714,7 @@ namespace Game.Spells
SpellCastFlags castFlags = SpellCastFlags.HasTrajectory; SpellCastFlags castFlags = SpellCastFlags.HasTrajectory;
uint schoolImmunityMask = 0; uint schoolImmunityMask = 0;
uint mechanicImmunityMask = 0; ulong mechanicImmunityMask = 0;
Unit unitCaster = m_caster.ToUnit(); Unit unitCaster = m_caster.ToUnit();
if (unitCaster != null) if (unitCaster != null)
{ {
@@ -3801,7 +3801,7 @@ namespace Game.Spells
if (castFlags.HasAnyFlag(SpellCastFlags.Immunity)) if (castFlags.HasAnyFlag(SpellCastFlags.Immunity))
{ {
castData.Immunities.School = schoolImmunityMask; castData.Immunities.School = schoolImmunityMask;
castData.Immunities.Value = mechanicImmunityMask; castData.Immunities.Value = (uint)mechanicImmunityMask;
} }
/** @todo implement heal prediction packet data /** @todo implement heal prediction packet data
@@ -4194,7 +4194,7 @@ namespace Game.Spells
spellChannelStart.ChannelDuration = duration; spellChannelStart.ChannelDuration = duration;
uint schoolImmunityMask = unitCaster.GetSchoolImmunityMask(); uint schoolImmunityMask = unitCaster.GetSchoolImmunityMask();
uint mechanicImmunityMask = unitCaster.GetMechanicImmunityMask(); ulong mechanicImmunityMask = unitCaster.GetMechanicImmunityMask();
if (schoolImmunityMask != 0 || mechanicImmunityMask != 0) if (schoolImmunityMask != 0 || mechanicImmunityMask != 0)
{ {
@@ -5876,7 +5876,7 @@ namespace Game.Spells
var auras = unitCaster.GetAuraEffectsByType(auraType); var auras = unitCaster.GetAuraEffectsByType(auraType);
foreach (AuraEffect aurEff in auras) foreach (AuraEffect aurEff in auras)
{ {
uint mechanicMask = aurEff.GetSpellInfo().GetAllEffectsMechanicMask(); ulong mechanicMask = aurEff.GetSpellInfo().GetAllEffectsMechanicMask();
if (mechanicMask != 0 && !Convert.ToBoolean(mechanicMask & GetSpellInfo().GetAllowedMechanicMask())) if (mechanicMask != 0 && !Convert.ToBoolean(mechanicMask & GetSpellInfo().GetAllowedMechanicMask()))
{ {
foundNotMechanic = true; foundNotMechanic = true;
+1 -1
View File
@@ -3863,7 +3863,7 @@ namespace Game.Spells
continue; continue;
if (RandomHelper.randChance(aura.CalcDispelChance(unitTarget, !unitTarget.IsFriendlyTo(m_caster)))) if (RandomHelper.randChance(aura.CalcDispelChance(unitTarget, !unitTarget.IsFriendlyTo(m_caster))))
if (Convert.ToBoolean(aura.GetSpellInfo().GetAllEffectsMechanicMask() & (1 << mechanic))) if ((aura.GetSpellInfo().GetAllEffectsMechanicMask() & (1ul << mechanic)) != 0)
dispel_list.Add(new KeyValuePair<uint, ObjectGuid>(aura.GetId(), aura.GetCasterGUID())); dispel_list.Add(new KeyValuePair<uint, ObjectGuid>(aura.GetId(), aura.GetCasterGUID()));
} }
+35 -35
View File
@@ -1287,40 +1287,40 @@ namespace Game.Spells
return SchoolMask; return SchoolMask;
} }
public uint GetAllEffectsMechanicMask() public ulong GetAllEffectsMechanicMask()
{ {
uint mask = 0; ulong mask = 0;
if (Mechanic != 0) if (Mechanic != 0)
mask |= (uint)(1 << (int)Mechanic); mask |= 1ul << (int)Mechanic;
foreach (var effectInfo in _effects) foreach (var effectInfo in _effects)
if (effectInfo.IsEffect() && effectInfo.Mechanic != 0) if (effectInfo.IsEffect() && effectInfo.Mechanic != 0)
mask |= 1u << (int)effectInfo.Mechanic; mask |= 1ul << (int)effectInfo.Mechanic;
return mask; return mask;
} }
public uint GetEffectMechanicMask(uint effIndex) public ulong GetEffectMechanicMask(uint effIndex)
{ {
uint mask = 0; ulong mask = 0;
if (Mechanic != 0) if (Mechanic != 0)
mask |= 1u << (int)Mechanic; mask |= 1ul << (int)Mechanic;
if (GetEffect(effIndex).IsEffect() && GetEffect(effIndex).Mechanic != 0) if (GetEffect(effIndex).IsEffect() && GetEffect(effIndex).Mechanic != 0)
mask |= 1u << (int)GetEffect(effIndex).Mechanic; mask |= 1ul << (int)GetEffect(effIndex).Mechanic;
return mask; return mask;
} }
public uint GetSpellMechanicMaskByEffectMask(uint effectMask) public ulong GetSpellMechanicMaskByEffectMask(uint effectMask)
{ {
uint mask = 0; ulong mask = 0;
if (Mechanic != 0) if (Mechanic != 0)
mask |= (uint)(1 << (int)Mechanic); mask |= 1ul << (int)Mechanic;
foreach (var effectInfo in _effects) foreach (var effectInfo in _effects)
if ((effectMask & (1 << (int)effectInfo.EffectIndex)) != 0 && effectInfo.Mechanic != 0) if ((effectMask & (1 << (int)effectInfo.EffectIndex)) != 0 && effectInfo.Mechanic != 0)
mask |= 1u << (int)effectInfo.Mechanic; mask |= 1ul << (int)effectInfo.Mechanic;
return mask; return mask;
} }
@@ -1381,7 +1381,7 @@ namespace Game.Spells
_auraState = AuraStateType.Enraged; _auraState = AuraStateType.Enraged;
// Bleeding aura state // Bleeding aura state
if (Convert.ToBoolean(GetAllEffectsMechanicMask() & 1 << (int)Mechanics.Bleed)) if (Convert.ToBoolean(GetAllEffectsMechanicMask() & (1 << (int)Mechanics.Bleed)))
_auraState = AuraStateType.Bleed; _auraState = AuraStateType.Bleed;
if (Convert.ToBoolean(GetSchoolMask() & SpellSchoolMask.Frost)) if (Convert.ToBoolean(GetSchoolMask() & SpellSchoolMask.Frost))
@@ -2117,7 +2117,7 @@ namespace Game.Spells
{ {
uint schoolImmunityMask = 0; uint schoolImmunityMask = 0;
uint applyHarmfulAuraImmunityMask = 0; uint applyHarmfulAuraImmunityMask = 0;
uint mechanicImmunityMask = 0; ulong mechanicImmunityMask = 0;
uint dispelImmunity = 0; uint dispelImmunity = 0;
uint damageImmunityMask = 0; uint damageImmunityMask = 0;
@@ -2134,7 +2134,7 @@ namespace Game.Spells
{ {
case 96: // Free Friend, Uncontrollable Frenzy, Warlord's Presence case 96: // Free Friend, Uncontrollable Frenzy, Warlord's Presence
{ {
mechanicImmunityMask |= (uint)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; mechanicImmunityMask |= (ulong)Mechanics.ImmuneToMovementImpairmentAndLossControlMask;
immuneInfo.AuraTypeImmune.Add(AuraType.ModStun); immuneInfo.AuraTypeImmune.Add(AuraType.ModStun);
immuneInfo.AuraTypeImmune.Add(AuraType.ModDecreaseSpeed); immuneInfo.AuraTypeImmune.Add(AuraType.ModDecreaseSpeed);
@@ -2150,7 +2150,7 @@ namespace Game.Spells
{ {
case 43292: // Incite Rage case 43292: // Incite Rage
case 49172: // Wolf Spirit case 49172: // Wolf Spirit
mechanicImmunityMask |= (uint)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; mechanicImmunityMask |= (ulong)Mechanics.ImmuneToMovementImpairmentAndLossControlMask;
immuneInfo.AuraTypeImmune.Add(AuraType.ModStun); immuneInfo.AuraTypeImmune.Add(AuraType.ModStun);
immuneInfo.AuraTypeImmune.Add(AuraType.ModDecreaseSpeed); immuneInfo.AuraTypeImmune.Add(AuraType.ModDecreaseSpeed);
@@ -2178,7 +2178,7 @@ namespace Game.Spells
{ {
if (Id == 57742) // Avenging Fury if (Id == 57742) // Avenging Fury
{ {
mechanicImmunityMask |= (uint)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; mechanicImmunityMask |= (ulong)Mechanics.ImmuneToMovementImpairmentAndLossControlMask;
immuneInfo.AuraTypeImmune.Add(AuraType.ModStun); immuneInfo.AuraTypeImmune.Add(AuraType.ModStun);
immuneInfo.AuraTypeImmune.Add(AuraType.ModDecreaseSpeed); immuneInfo.AuraTypeImmune.Add(AuraType.ModDecreaseSpeed);
@@ -2193,12 +2193,12 @@ namespace Game.Spells
{ {
if (Id == 64187) // Stormshield if (Id == 64187) // Stormshield
{ {
mechanicImmunityMask |= (1 << (int)Mechanics.Stun); mechanicImmunityMask |= 1 << (int)Mechanics.Stun;
immuneInfo.AuraTypeImmune.Add(AuraType.ModStun); immuneInfo.AuraTypeImmune.Add(AuraType.ModStun);
} }
else else
{ {
mechanicImmunityMask |= (uint)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; mechanicImmunityMask |= (ulong)Mechanics.ImmuneToMovementImpairmentAndLossControlMask;
immuneInfo.AuraTypeImmune.Add(AuraType.ModStun); immuneInfo.AuraTypeImmune.Add(AuraType.ModStun);
immuneInfo.AuraTypeImmune.Add(AuraType.ModDecreaseSpeed); immuneInfo.AuraTypeImmune.Add(AuraType.ModDecreaseSpeed);
@@ -2225,7 +2225,7 @@ namespace Game.Spells
} }
else else
{ {
mechanicImmunityMask |= (uint)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; mechanicImmunityMask |= (ulong)Mechanics.ImmuneToMovementImpairmentAndLossControlMask;
immuneInfo.AuraTypeImmune.Add(AuraType.ModStun); immuneInfo.AuraTypeImmune.Add(AuraType.ModStun);
immuneInfo.AuraTypeImmune.Add(AuraType.ModDecreaseSpeed); immuneInfo.AuraTypeImmune.Add(AuraType.ModDecreaseSpeed);
@@ -2241,7 +2241,7 @@ namespace Game.Spells
{ {
if (amount == 0) if (amount == 0)
{ {
mechanicImmunityMask |= (uint)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; mechanicImmunityMask |= (ulong)Mechanics.ImmuneToMovementImpairmentAndLossControlMask;
immuneInfo.SpellEffectImmune.Add(SpellEffectName.KnockBack); immuneInfo.SpellEffectImmune.Add(SpellEffectName.KnockBack);
immuneInfo.SpellEffectImmune.Add(SpellEffectName.KnockBackDest); immuneInfo.SpellEffectImmune.Add(SpellEffectName.KnockBackDest);
@@ -2301,7 +2301,7 @@ namespace Game.Spells
{ {
case 42292: // PvP trinket case 42292: // PvP trinket
case 59752: // Every Man for Himself case 59752: // Every Man for Himself
mechanicImmunityMask |= (uint)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; mechanicImmunityMask |= (ulong)Mechanics.ImmuneToMovementImpairmentAndLossControlMask;
immuneInfo.AuraTypeImmune.Add(AuraType.UseNormalMovementSpeed); immuneInfo.AuraTypeImmune.Add(AuraType.UseNormalMovementSpeed);
break; break;
case 34471: // The Beast Within case 34471: // The Beast Within
@@ -2313,7 +2313,7 @@ namespace Game.Spells
case 134956: // Supremacy of the Horde case 134956: // Supremacy of the Horde
case 195710: // Honorable Medallion case 195710: // Honorable Medallion
case 208683: // Gladiator's Medallion case 208683: // Gladiator's Medallion
mechanicImmunityMask |= (uint)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; mechanicImmunityMask |= (ulong)Mechanics.ImmuneToMovementImpairmentAndLossControlMask;
break; break;
case 54508: // Demonic Empowerment case 54508: // Demonic Empowerment
mechanicImmunityMask |= (1 << (int)Mechanics.Snare) | (1 << (int)Mechanics.Root) | (1 << (int)Mechanics.Stun); mechanicImmunityMask |= (1 << (int)Mechanics.Snare) | (1 << (int)Mechanics.Root) | (1 << (int)Mechanics.Stun);
@@ -2322,7 +2322,7 @@ namespace Game.Spells
if (miscVal < 1) if (miscVal < 1)
return; return;
mechanicImmunityMask |= 1u << miscVal; mechanicImmunityMask |= 1ul << miscVal;
break; break;
} }
break; break;
@@ -2434,11 +2434,11 @@ namespace Game.Spells
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.InvulnerabilityBuff); target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.InvulnerabilityBuff);
} }
uint mechanicImmunity = immuneInfo.MechanicImmuneMask; ulong mechanicImmunity = immuneInfo.MechanicImmuneMask;
if (mechanicImmunity != 0) if (mechanicImmunity != 0)
{ {
for (uint i = 0; i < (int)Mechanics.Max; ++i) for (uint i = 0; i < (int)Mechanics.Max; ++i)
if (Convert.ToBoolean(mechanicImmunity & (1 << (int)i))) if (Convert.ToBoolean(mechanicImmunity & (1ul << (int)i)))
target.ApplySpellImmune(Id, SpellImmunity.Mechanic, i, apply); target.ApplySpellImmune(Id, SpellImmunity.Mechanic, i, apply);
if (HasAttribute(SpellAttr1.ImmunityPurgesEffect)) if (HasAttribute(SpellAttr1.ImmunityPurgesEffect))
@@ -2525,9 +2525,9 @@ namespace Game.Spells
return true; return true;
} }
uint mechanicImmunity = immuneInfo.MechanicImmuneMask; ulong mechanicImmunity = immuneInfo.MechanicImmuneMask;
if (mechanicImmunity != 0) if (mechanicImmunity != 0)
if ((mechanicImmunity & (1 << (int)auraSpellInfo.Mechanic)) != 0) if ((mechanicImmunity & (1ul << (int)auraSpellInfo.Mechanic)) != 0)
return true; return true;
uint dispelImmunity = immuneInfo.DispelImmune; uint dispelImmunity = immuneInfo.DispelImmune;
@@ -2550,7 +2550,7 @@ namespace Game.Spells
uint mechanic = (uint)auraSpellEffectInfo.Mechanic; uint mechanic = (uint)auraSpellEffectInfo.Mechanic;
if (mechanic != 0) if (mechanic != 0)
{ {
if (!Convert.ToBoolean(immuneInfo.MechanicImmuneMask & (1 << (int)mechanic))) if (!Convert.ToBoolean(immuneInfo.MechanicImmuneMask & (1ul << (int)mechanic)))
{ {
immuneToAllEffects = false; immuneToAllEffects = false;
break; break;
@@ -2636,15 +2636,15 @@ namespace Game.Spells
return false; return false;
} }
public uint GetAllowedMechanicMask() public ulong GetAllowedMechanicMask()
{ {
return _allowedMechanicMask; return _allowedMechanicMask;
} }
public uint GetMechanicImmunityMask(Unit caster) public ulong GetMechanicImmunityMask(Unit caster)
{ {
uint casterMechanicImmunityMask = caster.GetMechanicImmunityMask(); ulong casterMechanicImmunityMask = caster.GetMechanicImmunityMask();
uint mechanicImmunityMask = 0; ulong mechanicImmunityMask = 0;
if (CanBeInterrupted(null, caster, true)) if (CanBeInterrupted(null, caster, true))
{ {
@@ -4026,7 +4026,7 @@ namespace Game.Spells
AuraStateType _auraState; AuraStateType _auraState;
SpellDiminishInfo _diminishInfo; SpellDiminishInfo _diminishInfo;
uint _allowedMechanicMask; ulong _allowedMechanicMask;
#endregion #endregion
public struct ScalingInfo public struct ScalingInfo
@@ -5172,7 +5172,7 @@ namespace Game.Spells
{ {
public uint SchoolImmuneMask; public uint SchoolImmuneMask;
public uint ApplyHarmfulAuraImmuneMask; public uint ApplyHarmfulAuraImmuneMask;
public uint MechanicImmuneMask; public ulong MechanicImmuneMask;
public uint DispelImmune; public uint DispelImmune;
public uint DamageSchoolMask; public uint DamageSchoolMask;
+1 -1
View File
@@ -2629,7 +2629,7 @@ namespace Game.Entities
foreach (var spellEffectInfo in spellInfo.GetEffects()) foreach (var spellEffectInfo in spellInfo.GetEffects())
{ {
// all bleed effects and spells ignore armor // all bleed effects and spells ignore armor
if ((spellInfo.GetEffectMechanicMask(spellEffectInfo.EffectIndex) & (1 << (int)Mechanics.Bleed)) != 0) if ((spellInfo.GetEffectMechanicMask(spellEffectInfo.EffectIndex) & (1ul << (int)Mechanics.Bleed)) != 0)
spellInfo.AttributesCu |= SpellCustomAttributes.IgnoreArmor; spellInfo.AttributesCu |= SpellCustomAttributes.IgnoreArmor;
switch (spellEffectInfo.ApplyAuraName) switch (spellEffectInfo.ApplyAuraName)