[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.
This commit is contained in:
VladimirMangos 2010-05-22 16:12:53 +04:00
parent 182fda8f3e
commit de454d6ff8
4 changed files with 32 additions and 9 deletions

View file

@ -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<<i);
// Hunter traps spells (for Entrapment trigger)
// Gives your Immolation Trap, Frost Trap, Explosive Trap, and Snake Trap ....
if (m_spellInfo->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);

View file

@ -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();
//*****************************************

View file

@ -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)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9954"
#define REVISION_NR "9955"
#endif // __REVISION_NR_H__