From 2dc12dbb69f7a741eb0b3d351f865e99271ca90e Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sat, 17 Dec 2022 17:37:07 -0500 Subject: [PATCH] Core/Spells: Extended mechanic mask to uint64 Port From (https://github.com/TrinityCore/TrinityCore/commit/de7c03c8385780f05530c2b3cf952a712d5f8f00) --- Source/Framework/Constants/ConditionConst.cs | 2 +- .../Framework/Constants/Spells/SpellConst.cs | 6 +- Source/Game/Chat/Commands/NPCCommands.cs | 4 +- Source/Game/Conditions/ConditionManager.cs | 4 +- Source/Game/Entities/Creature/Creature.cs | 12 ++-- Source/Game/Entities/Creature/CreatureData.cs | 2 +- Source/Game/Entities/Object/WorldObject.cs | 4 +- Source/Game/Entities/Unit/Unit.Movement.cs | 2 +- Source/Game/Entities/Unit/Unit.Spells.cs | 29 ++++---- Source/Game/Entities/Unit/Unit.cs | 4 +- Source/Game/Globals/ObjectManager.cs | 4 +- Source/Game/Spells/Auras/AuraEffect.cs | 2 +- Source/Game/Spells/Spell.cs | 8 +-- Source/Game/Spells/SpellEffects.cs | 2 +- Source/Game/Spells/SpellInfo.cs | 70 +++++++++---------- Source/Game/Spells/SpellManager.cs | 2 +- 16 files changed, 83 insertions(+), 74 deletions(-) diff --git a/Source/Framework/Constants/ConditionConst.cs b/Source/Framework/Constants/ConditionConst.cs index bf9475dec..824aaee59 100644 --- a/Source/Framework/Constants/ConditionConst.cs +++ b/Source/Framework/Constants/ConditionConst.cs @@ -67,7 +67,7 @@ namespace Framework.Constants 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 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 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 diff --git a/Source/Framework/Constants/Spells/SpellConst.cs b/Source/Framework/Constants/Spells/SpellConst.cs index f6f78a7f4..22c112707 100644 --- a/Source/Framework/Constants/Spells/SpellConst.cs +++ b/Source/Framework/Constants/Spells/SpellConst.cs @@ -337,7 +337,11 @@ namespace Framework.Constants Sapped = 30, Enraged = 31, Wounded = 32, - Max = 33, + Infected2 = 33, + Infected3 = 34, + Infected4 = 35, + Taunted = 36, + Max = 37, ImmuneToMovementImpairmentAndLossControlMask = ((1 << Charm) | (1 << Disoriented) | (1 << Fear) | (1 << Root) | (1 << Sleep) | (1 << Snare) | (1 << Stun) | diff --git a/Source/Game/Chat/Commands/NPCCommands.cs b/Source/Game/Chat/Commands/NPCCommands.cs index 760e7011c..b4df0beb4 100644 --- a/Source/Game/Chat/Commands/NPCCommands.cs +++ b/Source/Game/Chat/Commands/NPCCommands.cs @@ -97,7 +97,7 @@ namespace Game.Chat uint faction = target.GetFaction(); 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 nativeid = target.GetNativeDisplayId(); uint entry = target.GetEntry(); @@ -166,7 +166,7 @@ namespace Game.Chat handler.SendSysMessage(CypherStrings.NpcinfoMechanicImmune, mechanicImmuneMask); 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); return true; diff --git a/Source/Game/Conditions/ConditionManager.cs b/Source/Game/Conditions/ConditionManager.cs index bb7ca72dd..f6ef3bf44 100644 --- a/Source/Game/Conditions/ConditionManager.cs +++ b/Source/Game/Conditions/ConditionManager.cs @@ -2530,13 +2530,13 @@ namespace Game case UnitConditionVariable.HasHelpfulAuraDispelType: return unit.GetAuraApplication(aurApp => !aurApp.GetFlags().HasFlag(AuraFlags.Negative) && (int)aurApp.GetBase().GetSpellInfo().Dispel == value) != null ? value : 0; 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: return unit.GetAuraApplication((uint)value, aurApp => aurApp.GetFlags().HasFlag(AuraFlags.Negative)) != null ? value : 0; case UnitConditionVariable.HasHarmfulAuraDispelType: return unit.GetAuraApplication(aurApp => aurApp.GetFlags().HasFlag(AuraFlags.Negative) && (int)aurApp.GetBase().GetSpellInfo().Dispel == value) != null ? value : 0; 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: return unit.GetAuraApplication(aurApp => aurApp.GetFlags().HasFlag(AuraFlags.Negative) && ((int)aurApp.GetBase().GetSpellInfo().GetSchoolMask() & (1 << value)) != 0) != null ? value : 0; case UnitConditionVariable.DamagePhysicalPct: diff --git a/Source/Game/Entities/Creature/Creature.cs b/Source/Game/Entities/Creature/Creature.cs index 9eea35dd6..5313df09d 100644 --- a/Source/Game/Entities/Creature/Creature.cs +++ b/Source/Game/Entities/Creature/Creature.cs @@ -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); } diff --git a/Source/Game/Entities/Creature/CreatureData.cs b/Source/Game/Entities/Creature/CreatureData.cs index 92e190b38..63243f4f3 100644 --- a/Source/Game/Entities/Creature/CreatureData.cs +++ b/Source/Game/Entities/Creature/CreatureData.cs @@ -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; diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index e1188d076..7bc6e3de1 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -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; } diff --git a/Source/Game/Entities/Unit/Unit.Movement.cs b/Source/Game/Entities/Unit/Unit.Movement.cs index fefef0862..2497808b6 100644 --- a/Source/Game/Entities/Unit/Unit.Movement.cs +++ b/Source/Game/Entities/Unit/Unit.Movement.cs @@ -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; } diff --git a/Source/Game/Entities/Unit/Unit.Spells.cs b/Source/Game/Entities/Unit/Unit.Spells.cs index 95c973c8a..14d38f381 100644 --- a/Source/Game/Entities/Unit/Unit.Spells.cs +++ b/Source/Game/Entities/Unit/Unit.Spells.cs @@ -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(); diff --git a/Source/Game/Entities/Unit/Unit.cs b/Source/Game/Entities/Unit/Unit.cs index da6dd6cb3..9cb5fe1ff 100644 --- a/Source/Game/Entities/Unit/Unit.cs +++ b/Source/Game/Entities/Unit/Unit.cs @@ -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; }); diff --git a/Source/Game/Globals/ObjectManager.cs b/Source/Game/Globals/ObjectManager.cs index be157174a..73c0cf91d 100644 --- a/Source/Game/Globals/ObjectManager.cs +++ b/Source/Game/Globals/ObjectManager.cs @@ -1902,7 +1902,7 @@ namespace Game creature.WidgetSetID = fields.Read(64); creature.WidgetSetUnitConditionID = fields.Read(65); creature.RegenHealth = fields.Read(66); - creature.MechanicImmuneMask = fields.Read(67); + creature.MechanicImmuneMask = fields.Read(67); creature.SpellSchoolImmuneMask = fields.Read(68); creature.FlagsExtra = (CreatureFlagsExtra)fields.Read(69); creature.ScriptID = GetScriptId(fields.Read(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]); } - uint differenceMask = cInfo.MechanicImmuneMask & (~difficultyInfo.MechanicImmuneMask); + ulong differenceMask = cInfo.MechanicImmuneMask & (~difficultyInfo.MechanicImmuneMask); 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}).", diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index d90028a3c..a397ca9a4 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -604,7 +604,7 @@ namespace Game.Spells case AuraType.MechanicImmunity: case AuraType.ModMechanicResistance: // compare mechanic - if (spellInfo == null || !Convert.ToBoolean(spellInfo.GetAllEffectsMechanicMask() & (1 << GetMiscValue()))) + if (spellInfo == null || (spellInfo.GetAllEffectsMechanicMask() & (1ul << GetMiscValue())) == 0) return false; break; case AuraType.ModCastingSpeedNotStack: diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index 6b6a15ffe..fb0951a2a 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -3714,7 +3714,7 @@ namespace Game.Spells SpellCastFlags castFlags = SpellCastFlags.HasTrajectory; uint schoolImmunityMask = 0; - uint mechanicImmunityMask = 0; + ulong mechanicImmunityMask = 0; Unit unitCaster = m_caster.ToUnit(); if (unitCaster != null) { @@ -3801,7 +3801,7 @@ namespace Game.Spells if (castFlags.HasAnyFlag(SpellCastFlags.Immunity)) { castData.Immunities.School = schoolImmunityMask; - castData.Immunities.Value = mechanicImmunityMask; + castData.Immunities.Value = (uint)mechanicImmunityMask; } /** @todo implement heal prediction packet data @@ -4194,7 +4194,7 @@ namespace Game.Spells spellChannelStart.ChannelDuration = duration; uint schoolImmunityMask = unitCaster.GetSchoolImmunityMask(); - uint mechanicImmunityMask = unitCaster.GetMechanicImmunityMask(); + ulong mechanicImmunityMask = unitCaster.GetMechanicImmunityMask(); if (schoolImmunityMask != 0 || mechanicImmunityMask != 0) { @@ -5876,7 +5876,7 @@ namespace Game.Spells var auras = unitCaster.GetAuraEffectsByType(auraType); foreach (AuraEffect aurEff in auras) { - uint mechanicMask = aurEff.GetSpellInfo().GetAllEffectsMechanicMask(); + ulong mechanicMask = aurEff.GetSpellInfo().GetAllEffectsMechanicMask(); if (mechanicMask != 0 && !Convert.ToBoolean(mechanicMask & GetSpellInfo().GetAllowedMechanicMask())) { foundNotMechanic = true; diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index ba3879dfc..27ed8b28a 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -3863,7 +3863,7 @@ namespace Game.Spells continue; 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(aura.GetId(), aura.GetCasterGUID())); } diff --git a/Source/Game/Spells/SpellInfo.cs b/Source/Game/Spells/SpellInfo.cs index 7f789732b..b48a1606f 100644 --- a/Source/Game/Spells/SpellInfo.cs +++ b/Source/Game/Spells/SpellInfo.cs @@ -1287,40 +1287,40 @@ namespace Game.Spells return SchoolMask; } - public uint GetAllEffectsMechanicMask() + public ulong GetAllEffectsMechanicMask() { - uint mask = 0; + ulong mask = 0; if (Mechanic != 0) - mask |= (uint)(1 << (int)Mechanic); + mask |= 1ul << (int)Mechanic; foreach (var effectInfo in _effects) if (effectInfo.IsEffect() && effectInfo.Mechanic != 0) - mask |= 1u << (int)effectInfo.Mechanic; + mask |= 1ul << (int)effectInfo.Mechanic; return mask; } - public uint GetEffectMechanicMask(uint effIndex) + public ulong GetEffectMechanicMask(uint effIndex) { - uint mask = 0; + ulong mask = 0; if (Mechanic != 0) - mask |= 1u << (int)Mechanic; + mask |= 1ul << (int)Mechanic; if (GetEffect(effIndex).IsEffect() && GetEffect(effIndex).Mechanic != 0) - mask |= 1u << (int)GetEffect(effIndex).Mechanic; + mask |= 1ul << (int)GetEffect(effIndex).Mechanic; return mask; } - public uint GetSpellMechanicMaskByEffectMask(uint effectMask) + public ulong GetSpellMechanicMaskByEffectMask(uint effectMask) { - uint mask = 0; + ulong mask = 0; if (Mechanic != 0) - mask |= (uint)(1 << (int)Mechanic); + mask |= 1ul << (int)Mechanic; foreach (var effectInfo in _effects) if ((effectMask & (1 << (int)effectInfo.EffectIndex)) != 0 && effectInfo.Mechanic != 0) - mask |= 1u << (int)effectInfo.Mechanic; + mask |= 1ul << (int)effectInfo.Mechanic; return mask; } @@ -1381,7 +1381,7 @@ namespace Game.Spells _auraState = AuraStateType.Enraged; // Bleeding aura state - if (Convert.ToBoolean(GetAllEffectsMechanicMask() & 1 << (int)Mechanics.Bleed)) + if (Convert.ToBoolean(GetAllEffectsMechanicMask() & (1 << (int)Mechanics.Bleed))) _auraState = AuraStateType.Bleed; if (Convert.ToBoolean(GetSchoolMask() & SpellSchoolMask.Frost)) @@ -2117,7 +2117,7 @@ namespace Game.Spells { uint schoolImmunityMask = 0; uint applyHarmfulAuraImmunityMask = 0; - uint mechanicImmunityMask = 0; + ulong mechanicImmunityMask = 0; uint dispelImmunity = 0; uint damageImmunityMask = 0; @@ -2134,7 +2134,7 @@ namespace Game.Spells { 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.ModDecreaseSpeed); @@ -2150,7 +2150,7 @@ namespace Game.Spells { case 43292: // Incite Rage case 49172: // Wolf Spirit - mechanicImmunityMask |= (uint)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; + mechanicImmunityMask |= (ulong)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; immuneInfo.AuraTypeImmune.Add(AuraType.ModStun); immuneInfo.AuraTypeImmune.Add(AuraType.ModDecreaseSpeed); @@ -2178,7 +2178,7 @@ namespace Game.Spells { if (Id == 57742) // Avenging Fury { - mechanicImmunityMask |= (uint)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; + mechanicImmunityMask |= (ulong)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; immuneInfo.AuraTypeImmune.Add(AuraType.ModStun); immuneInfo.AuraTypeImmune.Add(AuraType.ModDecreaseSpeed); @@ -2193,12 +2193,12 @@ namespace Game.Spells { if (Id == 64187) // Stormshield { - mechanicImmunityMask |= (1 << (int)Mechanics.Stun); + mechanicImmunityMask |= 1 << (int)Mechanics.Stun; immuneInfo.AuraTypeImmune.Add(AuraType.ModStun); } else { - mechanicImmunityMask |= (uint)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; + mechanicImmunityMask |= (ulong)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; immuneInfo.AuraTypeImmune.Add(AuraType.ModStun); immuneInfo.AuraTypeImmune.Add(AuraType.ModDecreaseSpeed); @@ -2225,7 +2225,7 @@ namespace Game.Spells } else { - mechanicImmunityMask |= (uint)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; + mechanicImmunityMask |= (ulong)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; immuneInfo.AuraTypeImmune.Add(AuraType.ModStun); immuneInfo.AuraTypeImmune.Add(AuraType.ModDecreaseSpeed); @@ -2241,7 +2241,7 @@ namespace Game.Spells { if (amount == 0) { - mechanicImmunityMask |= (uint)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; + mechanicImmunityMask |= (ulong)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; immuneInfo.SpellEffectImmune.Add(SpellEffectName.KnockBack); immuneInfo.SpellEffectImmune.Add(SpellEffectName.KnockBackDest); @@ -2301,7 +2301,7 @@ namespace Game.Spells { case 42292: // PvP trinket case 59752: // Every Man for Himself - mechanicImmunityMask |= (uint)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; + mechanicImmunityMask |= (ulong)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; immuneInfo.AuraTypeImmune.Add(AuraType.UseNormalMovementSpeed); break; case 34471: // The Beast Within @@ -2313,7 +2313,7 @@ namespace Game.Spells case 134956: // Supremacy of the Horde case 195710: // Honorable Medallion case 208683: // Gladiator's Medallion - mechanicImmunityMask |= (uint)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; + mechanicImmunityMask |= (ulong)Mechanics.ImmuneToMovementImpairmentAndLossControlMask; break; case 54508: // Demonic Empowerment mechanicImmunityMask |= (1 << (int)Mechanics.Snare) | (1 << (int)Mechanics.Root) | (1 << (int)Mechanics.Stun); @@ -2322,7 +2322,7 @@ namespace Game.Spells if (miscVal < 1) return; - mechanicImmunityMask |= 1u << miscVal; + mechanicImmunityMask |= 1ul << miscVal; break; } break; @@ -2434,11 +2434,11 @@ namespace Game.Spells target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.InvulnerabilityBuff); } - uint mechanicImmunity = immuneInfo.MechanicImmuneMask; + ulong mechanicImmunity = immuneInfo.MechanicImmuneMask; if (mechanicImmunity != 0) { 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); if (HasAttribute(SpellAttr1.ImmunityPurgesEffect)) @@ -2525,9 +2525,9 @@ namespace Game.Spells return true; } - uint mechanicImmunity = immuneInfo.MechanicImmuneMask; + ulong mechanicImmunity = immuneInfo.MechanicImmuneMask; if (mechanicImmunity != 0) - if ((mechanicImmunity & (1 << (int)auraSpellInfo.Mechanic)) != 0) + if ((mechanicImmunity & (1ul << (int)auraSpellInfo.Mechanic)) != 0) return true; uint dispelImmunity = immuneInfo.DispelImmune; @@ -2550,7 +2550,7 @@ namespace Game.Spells uint mechanic = (uint)auraSpellEffectInfo.Mechanic; if (mechanic != 0) { - if (!Convert.ToBoolean(immuneInfo.MechanicImmuneMask & (1 << (int)mechanic))) + if (!Convert.ToBoolean(immuneInfo.MechanicImmuneMask & (1ul << (int)mechanic))) { immuneToAllEffects = false; break; @@ -2636,15 +2636,15 @@ namespace Game.Spells return false; } - public uint GetAllowedMechanicMask() + public ulong GetAllowedMechanicMask() { return _allowedMechanicMask; } - public uint GetMechanicImmunityMask(Unit caster) + public ulong GetMechanicImmunityMask(Unit caster) { - uint casterMechanicImmunityMask = caster.GetMechanicImmunityMask(); - uint mechanicImmunityMask = 0; + ulong casterMechanicImmunityMask = caster.GetMechanicImmunityMask(); + ulong mechanicImmunityMask = 0; if (CanBeInterrupted(null, caster, true)) { @@ -4026,7 +4026,7 @@ namespace Game.Spells AuraStateType _auraState; SpellDiminishInfo _diminishInfo; - uint _allowedMechanicMask; + ulong _allowedMechanicMask; #endregion public struct ScalingInfo @@ -5172,7 +5172,7 @@ namespace Game.Spells { public uint SchoolImmuneMask; public uint ApplyHarmfulAuraImmuneMask; - public uint MechanicImmuneMask; + public ulong MechanicImmuneMask; public uint DispelImmune; public uint DamageSchoolMask; diff --git a/Source/Game/Spells/SpellManager.cs b/Source/Game/Spells/SpellManager.cs index 78667bad4..881ca3f6b 100644 --- a/Source/Game/Spells/SpellManager.cs +++ b/Source/Game/Spells/SpellManager.cs @@ -2629,7 +2629,7 @@ namespace Game.Entities foreach (var spellEffectInfo in spellInfo.GetEffects()) { // 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; switch (spellEffectInfo.ApplyAuraName)