From 0033470835d1e69a7e8cc6b221e3793459dd9867 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 22 May 2010 16:12:53 +0400 Subject: [PATCH] [9955] Prevent negetive proc events from possitive effects of negative spells. Some negative spells have positive effects with targets not affected by negative effects of spell. For example spell 45524 cast negative effecst to target and possitive effect to caster self. For like possitive only target of negetive spell will not triggered negative proc events. In last cases will avoid triggering glyph 43537 at caster at spell 43537 cast. --- src/game/Spell.cpp | 20 ++++++++++++++++++-- src/game/Spell.h | 13 +++++++------ src/game/SpellMgr.h | 6 ++++++ src/shared/revision_nr.h | 2 +- 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 3f496cf5ad3..c098c6293f5 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -760,6 +760,14 @@ void Spell::prepareDataForTriggerSystem() } break; } + + // some negative spells have positive effects to another or same targets + // avoid triggering negative hit for only positive targets + m_negativeEffectMask = 0x0; + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) + if (!IsPositiveEffect(m_spellInfo->Id, SpellEffectIndex(i))) + m_negativeEffectMask |= (1<SpellFamilyName == SPELLFAMILY_HUNTER && (m_spellInfo->SpellFamilyFlags & UI64LIT(0x000020000000001C))) @@ -950,6 +958,14 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) uint32 procVictim = m_procVictim; uint32 procEx = PROC_EX_NONE; + // drop proc flags in case target not affected negative effects in negative spell + // for example caster bonus or animation + if (((procAttacker | procVictim) & NEGATIVE_TRIGGER_MASK) && !(target->effectMask & m_negativeEffectMask)) + { + procAttacker = PROC_FLAG_NONE; + procVictim = PROC_FLAG_NONE; + } + if (m_spellInfo->speed > 0) { // mark effects that were already handled in Spell::HandleDelayedSpellLaunch on spell launch as processed @@ -1053,8 +1069,8 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) } } } - // Passive spell hits/misses or active spells only misses (only triggers) - else + // Passive spell hits/misses or active spells only misses (only triggers if proc flags set) + else if (procAttacker || procVictim) { // Fill base damage struct (unitTarget - is real spell target) SpellNonMeleeDamage damageInfo(caster, unitTarget, m_spellInfo->Id, m_spellSchoolMask); diff --git a/src/game/Spell.h b/src/game/Spell.h index 5f48b1d3192..c6a372e1a0b 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -559,16 +559,17 @@ class Spell GameObject* focusObject; // Damage and healing in effects need just calculate - int32 m_damage; // Damge in effects count here - int32 m_healing; // Healing in effects count here - int32 m_healthLeech; // Health leech in effects for all targets count here + int32 m_damage; // Damage in effects count here + int32 m_healing; // Healing in effects count here + int32 m_healthLeech; // Health leech in effects for all targets count here //****************************************** // Spell trigger system //****************************************** - bool m_canTrigger; // Can start trigger (m_IsTriggeredSpell can`t use for this) - uint32 m_procAttacker; // Attacker trigger flags - uint32 m_procVictim; // Victim trigger flags + bool m_canTrigger; // Can start trigger (m_IsTriggeredSpell can`t use for this) + uint8 m_negativeEffectMask; // Use for avoid sent negative spell procs for additional positive effects only targets + uint32 m_procAttacker; // Attacker trigger flags + uint32 m_procVictim; // Victim trigger flags void prepareDataForTriggerSystem(); //***************************************** diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 29b74ec88e7..ff2b8b3f7cf 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -502,6 +502,12 @@ enum ProcFlags PROC_FLAG_SUCCESSFUL_RANGED_SPELL_HIT | \ PROC_FLAG_TAKEN_RANGED_SPELL_HIT) +#define NEGATIVE_TRIGGER_MASK (MELEE_BASED_TRIGGER_MASK | \ + PROC_FLAG_SUCCESSFUL_AOE_SPELL_HIT | \ + PROC_FLAG_TAKEN_AOE_SPELL_HIT | \ + PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT | \ + PROC_FLAG_TAKEN_NEGATIVE_SPELL_HIT) + enum ProcFlagsEx { PROC_EX_NONE = 0x0000000, // If none can tigger on Hit/Crit only (passive spells MUST defined by SpellFamily flag) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 0e3aa611cb2..79b86a9f5fc 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 "9954" + #define REVISION_NR "9955" #endif // __REVISION_NR_H__