From 01a81402035ccca5114afb5b4748e4aa9b7da9cb Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sat, 31 Aug 2019 11:01:41 -0400 Subject: [PATCH] Core/Spell: Added the possibility to explicitly disable auraEffect procs using attributes Port From (https://github.com/TrinityCore/TrinityCore/commit/77fc6ceea8716a85baca80b1816fbe3588b182e7) --- Source/Game/Entities/Unit/Unit.Spells.cs | 4 ++-- Source/Game/Spells/Auras/Aura.cs | 8 ++++---- Source/Game/Spells/SpellManager.cs | 13 ++++++++----- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Source/Game/Entities/Unit/Unit.Spells.cs b/Source/Game/Entities/Unit/Unit.Spells.cs index 321142d88..8a6a044a6 100644 --- a/Source/Game/Entities/Unit/Unit.Spells.cs +++ b/Source/Game/Entities/Unit/Unit.Spells.cs @@ -1817,7 +1817,7 @@ namespace Game.Entities foreach (AuraApplication aurApp in procAuras) { Cypher.Assert(aurApp.GetTarget() == this); - uint procEffectMask = aurApp.GetBase().IsProcTriggeredOnEvent(aurApp, eventInfo, now); + uint procEffectMask = aurApp.GetBase().GetProcEffectMask(aurApp, eventInfo, now); if (procEffectMask != 0) { aurApp.GetBase().PrepareProcToTrigger(aurApp, eventInfo, now); @@ -1830,7 +1830,7 @@ namespace Game.Entities { foreach (var pair in GetAppliedAuras()) { - uint procEffectMask = pair.Value.GetBase().IsProcTriggeredOnEvent(pair.Value, eventInfo, now); + uint procEffectMask = pair.Value.GetBase().GetProcEffectMask(pair.Value, eventInfo, now); if (procEffectMask != 0) { pair.Value.GetBase().PrepareProcToTrigger(pair.Value, eventInfo, now); diff --git a/Source/Game/Spells/Auras/Aura.cs b/Source/Game/Spells/Auras/Aura.cs index 15f378e1c..c87f4a9a5 100644 --- a/Source/Game/Spells/Auras/Aura.cs +++ b/Source/Game/Spells/Auras/Aura.cs @@ -1646,7 +1646,7 @@ namespace Game.Spells SetLastProcSuccessTime(now); } - public uint IsProcTriggeredOnEvent(AuraApplication aurApp, ProcEventInfo eventInfo, DateTime now) + public uint GetProcEffectMask(AuraApplication aurApp, ProcEventInfo eventInfo, DateTime now) { SpellProcEntry procEntry = Global.SpellMgr.GetSpellProcEntry(GetId()); // only auras with spell proc entry can trigger proc @@ -1712,9 +1712,9 @@ namespace Game.Spells // At least one effect has to pass checks to proc aura uint procEffectMask = 0; for (byte i = 0; i < SpellConst.MaxEffects; ++i) - if (aurApp.HasEffect(i)) - if (GetEffect(i).CheckEffectProc(aurApp, eventInfo)) - procEffectMask |= (1u << i); + if ((procEffectMask & (1u << i)) != 0) + if ((procEntry.DisableEffectsMask & (1u << i)) != 0 || !GetEffect(i).CheckEffectProc(aurApp, eventInfo)) + procEffectMask &= ~(1u << i); if (procEffectMask == 0) return 0; diff --git a/Source/Game/Spells/SpellManager.cs b/Source/Game/Spells/SpellManager.cs index 2ef5599f1..027e8a2d1 100644 --- a/Source/Game/Spells/SpellManager.cs +++ b/Source/Game/Spells/SpellManager.cs @@ -1159,7 +1159,7 @@ namespace Game.Entities // 0 1 2 3 4 5 6 SQLResult result = DB.World.Query("SELECT SpellId, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, SpellFamilyMask3, " + // 7 8 9 10 11 12 13 14 15 - "ProcFlags, SpellTypeMask, SpellPhaseMask, HitMask, AttributesMask, ProcsPerMinute, Chance, Cooldown, Charges FROM spell_proc"); + "ProcFlags, SpellTypeMask, SpellPhaseMask, HitMask, AttributesMask, DisableEffectsMask, ProcsPerMinute, Chance, Cooldown, Charges FROM spell_proc"); uint count = 0; if (!result.IsEmpty()) @@ -1201,10 +1201,11 @@ namespace Game.Entities baseProcEntry.SpellPhaseMask = (ProcFlagsSpellPhase)result.Read(9); baseProcEntry.HitMask = (ProcFlagsHit)result.Read(10); baseProcEntry.AttributesMask = (ProcAttributes)result.Read(11); - baseProcEntry.ProcsPerMinute = result.Read(12); - baseProcEntry.Chance = result.Read(13); - baseProcEntry.Cooldown = result.Read(14); - baseProcEntry.Charges = result.Read(15); + baseProcEntry.DisableEffectsMask = result.Read(12); + baseProcEntry.ProcsPerMinute = result.Read(13); + baseProcEntry.Chance = result.Read(14); + baseProcEntry.Cooldown = result.Read(15); + baseProcEntry.Charges = result.Read(16); while (spellInfo != null) { @@ -1383,6 +1384,7 @@ namespace Game.Entities } procEntry.AttributesMask = 0; + procEntry.DisableEffectsMask = 0; if (spellInfo.ProcFlags.HasAnyFlag(ProcFlags.Kill)) procEntry.AttributesMask |= ProcAttributes.ReqExpOrHonor; if (addTriggerFlag) @@ -3438,6 +3440,7 @@ namespace Game.Entities public ProcFlagsSpellPhase SpellPhaseMask { get; set; } // if nonzero - bitmask for matching phase of a spellcast on which proc occurs, see enum ProcFlagsSpellPhase public ProcFlagsHit HitMask { get; set; } // if nonzero - bitmask for matching proc condition based on hit result, see enum ProcFlagsHit public ProcAttributes AttributesMask { get; set; } // bitmask, see ProcAttributes + public uint DisableEffectsMask { get; set; } // bitmask public float ProcsPerMinute { get; set; } // if nonzero - chance to proc is equal to value * aura caster's weapon speed / 60 public float Chance { get; set; } // if nonzero - owerwrite procChance field for given Spell.dbc entry, defines chance of proc to occur, not used if ProcsPerMinute set public uint Cooldown { get; set; } // if nonzero - cooldown in secs for aura proc, applied to aura