Skip to content

Commit

Permalink
[9955] Prevent negetive proc events from possitive effects of negativ…
Browse files Browse the repository at this point in the history
…e 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.
  • Loading branch information
VladimirMangos committed May 22, 2010
1 parent c814c07 commit 0033470
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
20 changes: 18 additions & 2 deletions src/game/Spell.cpp
Expand Up @@ -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)))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
13 changes: 7 additions & 6 deletions src/game/Spell.h
Expand Up @@ -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();

//*****************************************
Expand Down
6 changes: 6 additions & 0 deletions src/game/SpellMgr.h
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion 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__

0 comments on commit 0033470

Please sign in to comment.