From 81b6cb27511948407f7082af99de7ccb189a4e74 Mon Sep 17 00:00:00 2001 From: Lynx3d Date: Mon, 6 Dec 2010 21:18:25 +0100 Subject: [PATCH] [10830] Prevent spell_proc_event entries to proc on any spell cast when SpellFamilyName is zero. Now only spells that actually deal damage or heal will trigger when neither SpellFamilyName nor ProcEx & PROC_EX_EX_TRIGGER_ALWAYS are set. Before, setting a SchoolMask would override this check, causing many bogus procs. --- src/game/SpellAuras.cpp | 6 +++--- src/game/SpellAuras.h | 6 +++--- src/game/Unit.cpp | 10 +++++----- src/shared/revision_nr.h | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 09cace496..c2e9dca50 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -909,13 +909,13 @@ bool Aura::isAffectedOnSpell(SpellEntry const *spell) const return false; } -bool Aura::CanProcFrom(SpellEntry const *spell, uint32 EventProcEx, uint32 procEx, bool active) const +bool Aura::CanProcFrom(SpellEntry const *spell, uint32 EventProcEx, uint32 procEx, bool active, bool useClassMask) const { // Check EffectClassMask uint32 const *ptr = getAuraSpellClassMask(); - // if no class mask defined - allow proc - if (!((uint64*)ptr)[0] && !ptr[2]) + // if no class mask defined, or spell_proc_event has SpellFamilyName=0 - allow proc + if (!useClassMask || (!((uint64*)ptr)[0] && !ptr[2])) { if (!(EventProcEx & PROC_EX_EX_TRIGGER_ALWAYS)) { diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index c549f445a..fa0dfff5b 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -372,7 +372,7 @@ class MANGOS_DLL_SPEC Aura Modifier const* GetModifier() const { return &m_modifier; } int32 GetMiscValue() const { return m_spellAuraHolder->GetSpellProto()->EffectMiscValue[m_effIndex]; } int32 GetMiscBValue() const { return m_spellAuraHolder->GetSpellProto()->EffectMiscValueB[m_effIndex]; } - + SpellEntry const* GetSpellProto() const { return GetHolder()->GetSpellProto(); } uint32 GetId() const{ return GetHolder()->GetSpellProto()->Id; } ObjectGuid const& GetCastItemGuid() const { return GetHolder()->GetCastItemGuid(); } @@ -434,7 +434,7 @@ class MANGOS_DLL_SPEC Aura uint32 const *getAuraSpellClassMask() const { return m_spellAuraHolder->GetSpellProto()->GetEffectSpellClassMask(m_effIndex); } bool isAffectedOnSpell(SpellEntry const *spell) const; - bool CanProcFrom(SpellEntry const *spell, uint32 EventProcEx, uint32 procEx, bool active) const; + bool CanProcFrom(SpellEntry const *spell, uint32 EventProcEx, uint32 procEx, bool active, bool useClassMask) const; //SpellAuraHolder const* GetHolder() const { return m_spellHolder; } SpellAuraHolder* GetHolder() { return m_spellAuraHolder; } @@ -469,7 +469,7 @@ class MANGOS_DLL_SPEC Aura AuraRemoveMode m_removeMode:8; // Store info for know remove aura reason SpellEffectIndex m_effIndex :8; // Aura effect index in spell - + bool m_positive:1; bool m_isPeriodic:1; bool m_isAreaAura:1; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index e2b3205f3..ab80d1ce7 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -2864,7 +2864,7 @@ bool Unit::IsSpellBlocked(Unit *pCaster, SpellEntry const *spellEntry, WeaponAtt float blockChance = GetUnitBlockChance(); blockChance += (int32(pCaster->GetWeaponSkillValue(attackType)) - int32(GetMaxSkillValueForLevel()))*0.04f; - + return roll_chance_f(blockChance); } @@ -9762,11 +9762,11 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag (spellProcEvent->spellFamilyMask2[i] & procSpell->SpellFamilyFlags2) == 0) continue; } - // don't check FamilyFlags if schoolMask exists - else if (!spellProcEvent->schoolMask && !triggeredByAura->CanProcFrom(procSpell, spellProcEvent->procEx, procExtra, damage != 0)) + // don't check dbc FamilyFlags unless spellFamilyName != 0 + else if (!triggeredByAura->CanProcFrom(procSpell, spellProcEvent->procEx, procExtra, damage != 0, spellProcEvent->spellFamilyName != 0)) continue; } - else if (!triggeredByAura->CanProcFrom(procSpell, PROC_EX_NONE, procExtra, damage != 0)) + else if (!triggeredByAura->CanProcFrom(procSpell, PROC_EX_NONE, procExtra, damage != 0, true)) continue; } @@ -10797,4 +10797,4 @@ bool Unit::IsAllowedDamageInArea(Unit* pVictim) const return false; return true; -} \ No newline at end of file +} diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 574a4ee04..eede091dc 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10829" + #define REVISION_NR "10830" #endif // __REVISION_NR_H__