From 9e7eca2258b8290fe4d38c20859e9f1c5a3f322e Mon Sep 17 00:00:00 2001 From: hondacrx Date: Fri, 7 Jan 2022 12:56:36 -0500 Subject: [PATCH] Core/Spells: Corrected SPELL_ATTR8_MASTERY_AFFECTS_POINTS attribute implementation, it is no longer used to restrict if the spell should be cast or not (SpecializationSpells.db2 takes care of that) Port From (https://github.com/TrinityCore/TrinityCore/commit/2a4c7c1e27ac5236874a8fd5315abee196ab4c9a) --- Source/Framework/Constants/Spells/SpellConst.cs | 2 +- Source/Game/Entities/Player/Player.Spells.cs | 12 ------------ Source/Game/Spells/Auras/AuraEffect.cs | 6 +----- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/Source/Framework/Constants/Spells/SpellConst.cs b/Source/Framework/Constants/Spells/SpellConst.cs index 00a70ff88..6c642a793 100644 --- a/Source/Framework/Constants/Spells/SpellConst.cs +++ b/Source/Framework/Constants/Spells/SpellConst.cs @@ -1885,7 +1885,7 @@ namespace Framework.Constants RaidMarker = 0x4000000, // 26 Probably Spell No Need Learn To Cast Unk27 = 0x8000000, // 27 NotInBgOrArena = 0x10000000, // 28 - MasterySpecialization = 0x20000000, // 29 + MasteryAffectPoints = 0x20000000, // 29 Unk30 = 0x40000000, // 30 AttackIgnoreImmuneToPCFlag = 0x80000000 // 31 } diff --git a/Source/Game/Entities/Player/Player.Spells.cs b/Source/Game/Entities/Player/Player.Spells.cs index 289557976..f98115bdb 100644 --- a/Source/Game/Entities/Player/Player.Spells.cs +++ b/Source/Game/Entities/Player/Player.Spells.cs @@ -2278,9 +2278,6 @@ namespace Game.Entities bool need_cast = (spellInfo.Stances == 0 || (form != 0 && Convert.ToBoolean(spellInfo.Stances & (1ul << ((int)form - 1)))) || (form == 0 && spellInfo.HasAttribute(SpellAttr2.NotNeedShapeshift))); - if (spellInfo.HasAttribute(SpellAttr8.MasterySpecialization)) - need_cast &= IsCurrentSpecMasterySpell(spellInfo); - // Check EquippedItemClass // passive spells which apply aura and have an item requirement are to be added manually, instead of casted if (spellInfo.EquippedItemClass >= 0) @@ -2300,15 +2297,6 @@ namespace Game.Entities return need_cast && (spellInfo.CasterAuraState == 0 || HasAuraState(spellInfo.CasterAuraState)); } - public bool IsCurrentSpecMasterySpell(SpellInfo spellInfo) - { - ChrSpecializationRecord chrSpec = CliDB.ChrSpecializationStorage.LookupByKey(GetPrimarySpecialization()); - if (chrSpec != null) - return spellInfo.Id == chrSpec.MasterySpellID[0] || spellInfo.Id == chrSpec.MasterySpellID[1]; - - return false; - } - public void AddStoredAuraTeleportLocation(uint spellId) { StoredAuraTeleportLocation storedLocation = new(); diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index f247dfd44..9b186525a 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -74,7 +74,7 @@ namespace Game.Spells // default amount calculation int amount = 0; - if (!m_spellInfo.HasAttribute(SpellAttr8.MasterySpecialization) || MathFunctions.fuzzyEq(GetSpellEffectInfo().BonusCoefficient, 0.0f)) + if (!m_spellInfo.HasAttribute(SpellAttr8.MasteryAffectPoints) || MathFunctions.fuzzyEq(GetSpellEffectInfo().BonusCoefficient, 0.0f)) amount = GetSpellEffectInfo().CalcValue(caster, m_baseAmount, GetBase().GetOwner().ToUnit(), GetBase().GetCastItemId(), GetBase().GetCastItemLevel()); else if (caster != null && caster.IsTypeId(TypeId.Player)) amount = (int)(caster.ToPlayer().m_activePlayerData.Mastery * GetSpellEffectInfo().BonusCoefficient); @@ -774,10 +774,6 @@ namespace Game.Spells if (spellInfo == null || !(spellInfo.IsPassive() || spellInfo.HasAttribute(SpellAttr0.HiddenClientside))) continue; - // always valid? - if (spellInfo.HasAttribute(SpellAttr8.MasterySpecialization) && !plrTarget.IsCurrentSpecMasterySpell(spellInfo)) - continue; - if (Convert.ToBoolean(spellInfo.Stances & (1ul << (GetMiscValue() - 1)))) target.CastSpell(target, pair.Key, new CastSpellExtraArgs(this)); }