aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Spell.cpp81
-rw-r--r--src/game/SpellAuras.cpp8
-rw-r--r--src/game/SpellMgr.cpp39
-rw-r--r--src/game/SpellMgr.h65
-rw-r--r--src/game/Unit.cpp4
5 files changed, 101 insertions, 96 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 23b9a0069ff..00c47a5cc4e 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -1084,16 +1084,54 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
if( missInfo != SPELL_MISS_NONE && missInfo != SPELL_MISS_MISS)
m_needComboPoints = false;
+ // Trigger info was not filled in spell::preparedatafortriggersystem - we do it now
+ if (canEffectTrigger && !procAttacker && !procVictim)
+ {
+ bool positive = true;
+ if (m_damage > 0)
+ positive = false;
+ else if (!m_healing)
+ {
+ for (uint8 i = 0; i< MAX_SPELL_EFFECTS; ++i)
+ // If at least one effect negative spell is negative hit
+ if (mask & (1<<i) && !IsPositiveEffect(m_spellInfo->Id, i))
+ {
+ positive = false;
+ break;
+ }
+ }
+ switch(m_spellInfo->DmgClass)
+ {
+ case SPELL_DAMAGE_CLASS_MAGIC:
+ if (positive)
+ {
+ procAttacker |= PROC_FLAG_SUCCESSFUL_POSITIVE_MAGIC_SPELL;
+ procVictim |= PROC_FLAG_TAKEN_POSITIVE_MAGIC_SPELL;
+ }
+ else
+ {
+ procAttacker |= PROC_FLAG_SUCCESSFUL_NEGATIVE_MAGIC_SPELL;
+ procVictim |= PROC_FLAG_TAKEN_NEGATIVE_MAGIC_SPELL;
+ }
+ break;
+ case SPELL_DAMAGE_CLASS_NONE:
+ if (positive)
+ {
+ procAttacker |= PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL_HIT;
+ procVictim |= PROC_FLAG_TAKEN_POSITIVE_SPELL;
+ }
+ else
+ {
+ procAttacker |= PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT;
+ procVictim |= PROC_FLAG_TAKEN_NEGATIVE_SPELL_HIT;
+ }
+ break;
+ }
+ }
// All calculated do it!
// Do healing and triggers
if (m_healing > 0)
{
- // Trigger info was not filled in spell::preparedatafortriggersystem - we do it now
- if (canEffectTrigger && !procAttacker && !procVictim)
- {
- procAttacker |= PROC_FLAG_SUCCESSFUL_HEALING_SPELL;
- procVictim |= PROC_FLAG_TAKEN_HEALING_SPELL;
- }
bool crit = caster->isSpellCrit(unitTarget, m_spellInfo, m_spellSchoolMask);
uint32 addhealth = m_healing;
if (crit)
@@ -1117,13 +1155,6 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
// Do damage and triggers
else if (m_damage > 0)
{
- // Trigger info was not filled in spell::preparedatafortriggersystem - we do it now
- if (canEffectTrigger && !procAttacker && !procVictim)
- {
- procAttacker |= PROC_FLAG_SUCCESSFUL_DAMAGING_SPELL_HIT;
- procVictim |= PROC_FLAG_TAKEN_DAMAGING_SPELL_HIT;
- }
-
// Fill base damage struct (unitTarget - is real spell target)
SpellNonMeleeDamage damageInfo(caster, unitTarget, m_spellInfo->Id, m_spellSchoolMask);
@@ -1160,30 +1191,6 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
// Passive spell hits/misses or active spells only misses (only triggers)
else
{
- // Trigger info was not filled in spell::preparedatafortriggersystem - we do it now
- if (canEffectTrigger && !procAttacker && !procVictim)
- {
- // Check spell positivity on target
- bool positive = true;
- for (uint8 i = 0; i< MAX_SPELL_EFFECTS; ++i)
- // If at least one effect negative spell is negative hit
- if (mask & (1<<i) && !IsPositiveEffect(m_spellInfo->Id, i))
- {
- positive = false;
- break;
- }
- if (positive)
- {
- procAttacker |= PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL;
- procVictim |= PROC_FLAG_TAKEN_POSITIVE_SPELL;
- }
- else
- {
- procAttacker |= PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT;
- procVictim |= PROC_FLAG_TAKEN_NEGATIVE_SPELL_HIT;
- }
- }
-
// Fill base damage struct (unitTarget - is real spell target)
SpellNonMeleeDamage damageInfo(caster, unitTarget, m_spellInfo->Id, m_spellSchoolMask);
procEx |= createProcExtendMask(&damageInfo, missInfo);
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 601f4467259..50e26349ef9 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -1264,13 +1264,13 @@ void Aura::_RemoveAura()
uint32 ProcCaster, ProcVictim;
if (IsPositiveSpell(GetId()))
{
- ProcCaster = PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL;
- ProcVictim = PROC_FLAG_TAKEN_POSITIVE_SPELL;
+ ProcCaster = PROC_FLAG_SUCCESSFUL_POSITIVE_MAGIC_SPELL | PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL_HIT;
+ ProcVictim = PROC_FLAG_TAKEN_POSITIVE_MAGIC_SPELL | PROC_FLAG_TAKEN_POSITIVE_SPELL;
}
else
{
- ProcCaster = PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT;
- ProcVictim = PROC_FLAG_TAKEN_NEGATIVE_SPELL_HIT;
+ ProcCaster = PROC_FLAG_SUCCESSFUL_NEGATIVE_MAGIC_SPELL | PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT;
+ ProcVictim = PROC_FLAG_TAKEN_NEGATIVE_MAGIC_SPELL | PROC_FLAG_TAKEN_NEGATIVE_SPELL_HIT;
}
caster->ProcDamageAndSpell(m_target,ProcCaster, ProcVictim, procEx, m_procDamage, BASE_ATTACK, m_spellProto);
}
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index e2434cb0010..b99997dd526 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -1273,17 +1273,6 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr
// No extra req need
uint32 procEvent_procEx = PROC_EX_NONE;
- // Some of not damaging spells have on damage procflags
- // And all of them are specified by spellfamilymask in proc entry
- // so, lets allow non dmg spells to proc on dmg auras if they have correct spellfamily
- if (spellProcEvent && spellProcEvent->spellFamilyMask)
- {
- if (EventProcFlag & PROC_FLAG_SUCCESSFUL_DAMAGING_SPELL_HIT && procFlags & PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT)
- procFlags |= PROC_FLAG_SUCCESSFUL_DAMAGING_SPELL_HIT;
- if (EventProcFlag & PROC_FLAG_SUCCESSFUL_HEALING_SPELL && procFlags & PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL)
- procFlags |= PROC_FLAG_SUCCESSFUL_HEALING_SPELL;
- }
-
// check prockFlags for condition
if((procFlags & EventProcFlag) == 0)
return false;
@@ -1303,24 +1292,24 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr
if (procFlags & PROC_FLAG_ON_DO_PERIODIC)
{
- if (EventProcFlag & PROC_FLAG_SUCCESSFUL_DAMAGING_SPELL_HIT)
+ if (EventProcFlag & PROC_FLAG_SUCCESSFUL_NEGATIVE_MAGIC_SPELL)
{
if (!(procExtra & PROC_EX_INTERNAL_DOT))
return false;
}
- else if (EventProcFlag & PROC_FLAG_SUCCESSFUL_HEALING_SPELL
+ else if (EventProcFlag & PROC_FLAG_TAKEN_POSITIVE_MAGIC_SPELL
&& !(procExtra & PROC_EX_INTERNAL_HOT))
return false;
}
if (procFlags & PROC_FLAG_ON_TAKE_PERIODIC)
{
- if (EventProcFlag & PROC_FLAG_TAKEN_DAMAGING_SPELL_HIT)
+ if (EventProcFlag & PROC_FLAG_TAKEN_NEGATIVE_MAGIC_SPELL)
{
if (!(procExtra & PROC_EX_INTERNAL_DOT))
return false;
}
- else if (EventProcFlag & PROC_FLAG_TAKEN_HEALING_SPELL
+ else if (EventProcFlag & PROC_FLAG_TAKEN_POSITIVE_MAGIC_SPELL
&& !(procExtra & PROC_EX_INTERNAL_HOT))
return false;
}
@@ -1370,17 +1359,23 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr
// Check for extra req (if none) and hit/crit
if (procEvent_procEx == PROC_EX_NONE)
{
- // No extra req, so can trigger only for hit/crit - spell has to be active or to have PROC_FLAG_TAKEN_NEGATIVE_SPELL_HIT
- if((procExtra & (PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT)) && (active || procFlags & PROC_FLAG_TAKEN_NEGATIVE_SPELL_HIT))
+ // No extra req, so can trigger only for hit/crit - spell has to be active
+ if((procExtra & (PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT)) && active)
return true;
}
else // Passive spells hits here only if resist/reflect/immune/evade
{
- // Exist req for PROC_EX_EX_TRIGGER_ALWAYS
- if ((procExtra & AURA_SPELL_PROC_EX_MASK) && (procEvent_procEx & PROC_EX_EX_TRIGGER_ALWAYS))
- return true;
- // Check Extra Requirement like (hit/crit/miss/resist/parry/dodge/block/immune/reflect/absorb and other)
- if (procEvent_procEx & procExtra)
+ if (procExtra & AURA_SPELL_PROC_EX_MASK)
+ {
+ // Exist req for PROC_EX_EX_TRIGGER_ALWAYS
+ if (procEvent_procEx & PROC_EX_EX_TRIGGER_ALWAYS)
+ return true;
+ // Check Extra Requirement like (hit/crit/miss/resist/parry/dodge/block/immune/reflect/absorb and other)
+ if (procEvent_procEx & procExtra)
+ return true;
+ }
+ // if spell marked as procing from not active spells it can proc from normal or critical hit
+ if (procEvent_procEx & PROC_EX_NOT_ACTIVE_SPELL && (procExtra & (PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT)))
return true;
}
return false;
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index 077f37dfcd5..38c64e9cb92 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -388,45 +388,45 @@ typedef UNORDERED_MAP<uint32, flag96> SpellAffectMap;
// Spell proc event related declarations (accessed using SpellMgr functions)
enum ProcFlags
{
- PROC_FLAG_NONE = 0x00000000,
+ PROC_FLAG_NONE = 0x00000000,
- PROC_FLAG_KILLED = 0x00000001, // 00 Killed by agressor
- PROC_FLAG_KILL = 0x00000002, // 01 Kill target (in most cases need XP/Honor reward)
+ PROC_FLAG_KILLED = 0x00000001, // 00 Killed by agressor
+ PROC_FLAG_KILL = 0x00000002, // 01 Kill target (in most cases need XP/Honor reward)
- PROC_FLAG_SUCCESSFUL_MELEE_HIT = 0x00000004, // 02 Successful melee auto attack
- PROC_FLAG_TAKEN_MELEE_HIT = 0x00000008, // 03 Taken damage from melee auto attack hit
+ PROC_FLAG_SUCCESSFUL_MELEE_HIT = 0x00000004, // 02 Successful melee auto attack
+ PROC_FLAG_TAKEN_MELEE_HIT = 0x00000008, // 03 Taken damage from melee auto attack hit
- PROC_FLAG_SUCCESSFUL_MELEE_SPELL_HIT = 0x00000010, // 04 Successful attack by Spell that use melee weapon
- PROC_FLAG_TAKEN_MELEE_SPELL_HIT = 0x00000020, // 05 Taken damage by Spell that use melee weapon
+ PROC_FLAG_SUCCESSFUL_MELEE_SPELL_HIT = 0x00000010, // 04 Successful attack by Spell that use melee weapon
+ PROC_FLAG_TAKEN_MELEE_SPELL_HIT = 0x00000020, // 05 Taken damage by Spell that use melee weapon
- PROC_FLAG_SUCCESSFUL_RANGED_HIT = 0x00000040, // 06 Successful Ranged auto attack
- PROC_FLAG_TAKEN_RANGED_HIT = 0x00000080, // 07 Taken damage from ranged auto attack
+ PROC_FLAG_SUCCESSFUL_RANGED_HIT = 0x00000040, // 06 Successful Ranged auto attack
+ PROC_FLAG_TAKEN_RANGED_HIT = 0x00000080, // 07 Taken damage from ranged auto attack
- PROC_FLAG_SUCCESSFUL_RANGED_SPELL_HIT = 0x00000100, // 08 Successful Ranged attack by Spell that use ranged weapon
- PROC_FLAG_TAKEN_RANGED_SPELL_HIT = 0x00000200, // 09 Taken damage by Spell that use ranged weapon
+ PROC_FLAG_SUCCESSFUL_RANGED_SPELL_HIT = 0x00000100, // 08 Successful Ranged attack by Spell that use ranged weapon
+ PROC_FLAG_TAKEN_RANGED_SPELL_HIT = 0x00000200, // 09 Taken damage by Spell that use ranged weapon
- PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL = 0x00000400, // 10 Successful Positive spell hit
- PROC_FLAG_TAKEN_POSITIVE_SPELL = 0x00000800, // 11 Taken Positive spell hit
+ PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL_HIT = 0x00000400, // 10 Successful Positive spell hit
+ PROC_FLAG_TAKEN_POSITIVE_SPELL = 0x00000800, // 11 Taken Positive spell hit
- PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT = 0x00001000, // 12 Successful Negative spell hit
- PROC_FLAG_TAKEN_NEGATIVE_SPELL_HIT = 0x00002000, // 13 Taken Negative spell hit
+ PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT = 0x00001000, // 12 Successful Negative spell hit
+ PROC_FLAG_TAKEN_NEGATIVE_SPELL_HIT = 0x00002000, // 13 Taken Negative spell hit
- PROC_FLAG_SUCCESSFUL_HEALING_SPELL = 0x00004000, // 14 Successful Direct Heal spell hit
- PROC_FLAG_TAKEN_HEALING_SPELL = 0x00008000, // 15 Taken Direct Heal spell hit
+ PROC_FLAG_SUCCESSFUL_POSITIVE_MAGIC_SPELL = 0x00004000, // 14 Successful Positive Magic spell hit
+ PROC_FLAG_TAKEN_POSITIVE_MAGIC_SPELL = 0x00008000, // 15 Taken Positive Magic spell hit
- PROC_FLAG_SUCCESSFUL_DAMAGING_SPELL_HIT = 0x00010000, // 16 Successful Direct Damage spell hit
- PROC_FLAG_TAKEN_DAMAGING_SPELL_HIT = 0x00020000, // 17 Taken Direct Damage spell hit
+ PROC_FLAG_SUCCESSFUL_NEGATIVE_MAGIC_SPELL = 0x00010000, // 16 Successful Negative Magic spell hit
+ PROC_FLAG_TAKEN_NEGATIVE_MAGIC_SPELL = 0x00020000, // 17 Taken Negative Magic spell hit
- PROC_FLAG_ON_DO_PERIODIC = 0x00040000, // 18 Successful do periodic (damage / healing, determined from 14,16 flags)
- PROC_FLAG_ON_TAKE_PERIODIC = 0x00080000, // 19 Taken spell periodic (damage / healing, determined from 15,17 flags)
+ PROC_FLAG_ON_DO_PERIODIC = 0x00040000, // 18 Successful do periodic (damage / healing, determined from 14,16 flags)
+ PROC_FLAG_ON_TAKE_PERIODIC = 0x00080000, // 19 Taken spell periodic (damage / healing, determined from 15,17 flags)
- PROC_FLAG_TAKEN_ANY_DAMAGE = 0x00100000, // 20 Taken any damage
- PROC_FLAG_ON_TRAP_ACTIVATION = 0x00200000, // 21 On trap activation
+ PROC_FLAG_TAKEN_ANY_DAMAGE = 0x00100000, // 20 Taken any damage
+ PROC_FLAG_ON_TRAP_ACTIVATION = 0x00200000, // 21 On trap activation
- PROC_FLAG_TAKEN_OFFHAND_HIT = 0x00400000, // 22 Taken off-hand melee attacks ( this is probably wrong )
- PROC_FLAG_SUCCESSFUL_OFFHAND_HIT = 0x00800000, // 23 Successful off-hand melee attacks ( this is probably wrong )
+ PROC_FLAG_TAKEN_OFFHAND_HIT = 0x00400000, // 22 Taken off-hand melee attacks ( this is probably wrong )
+ PROC_FLAG_SUCCESSFUL_OFFHAND_HIT = 0x00800000, // 23 Successful off-hand melee attacks ( this is probably wrong )
- PROC_FLAG_DEATH = 0x01000000 // 24 Died in any way
+ PROC_FLAG_DEATH = 0x01000000 // 24 Died in any way
};
#define MELEE_BASED_TRIGGER_MASK (PROC_FLAG_SUCCESSFUL_MELEE_HIT | \
@@ -456,13 +456,16 @@ enum ProcFlagsEx
PROC_EX_INTERRUPT = 0x0001000, // Melee hit result can be Interrupt (not used)
PROC_EX_AURA_REMOVE_DESTROY = 0x0002000, // aura absorb destroy or dispel
PROC_EX_AURA_REMOVE_EXPIRE = 0x0004000, // aura remove by default and by cancel
+ PROC_EX_NOT_ACTIVE_SPELL = 0x0008000, // to mark spells which can proc without damage, but not specified with spellfamilyflags
PROC_EX_EX_TRIGGER_ALWAYS = 0x0010000, // If set trigger always ( no matter another flags) used for drop charges
PROC_EX_EX_ONE_TIME_TRIGGER = 0x0020000, // If set trigger always but only one time (not used)
- PROC_EX_INTERNAL_CANT_PROC = 0x0800000, // Only for internal use
- PROC_EX_INTERNAL_DOT = 0x1000000, // Only for internal use
- PROC_EX_INTERNAL_HOT = 0x2000000, // Only for internal use
- PROC_EX_INTERNAL_TRIGGERED = 0x4000000, // Only for internal use
- PROC_EX_INTERNAL_REQ_FAMILY = 0x8000000 // Only for internal use
+
+ // Flags for internal use - do not use these in db!
+ PROC_EX_INTERNAL_CANT_PROC = 0x0800000,
+ PROC_EX_INTERNAL_DOT = 0x1000000,
+ PROC_EX_INTERNAL_HOT = 0x2000000,
+ PROC_EX_INTERNAL_TRIGGERED = 0x4000000,
+ PROC_EX_INTERNAL_REQ_FAMILY = 0x8000000
};
#define AURA_REMOVE_PROC_EX_MASK \
(PROC_EX_AURA_REMOVE_DESTROY | PROC_EX_AURA_REMOVE_EXPIRE)
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index c35dacf72db..442ef4a6cca 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -2982,7 +2982,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
if (reflectchance > 0 && roll_chance_i(reflectchance))
{
// Start triggers for remove charges if need (trigger only for victim, and mark as active spell)
- ProcDamageAndSpell(pVictim, PROC_FLAG_NONE, PROC_FLAG_SUCCESSFUL_DAMAGING_SPELL_HIT, PROC_EX_REFLECT, 1, BASE_ATTACK, spell);
+ ProcDamageAndSpell(pVictim, PROC_FLAG_NONE, PROC_FLAG_SUCCESSFUL_NEGATIVE_MAGIC_SPELL, PROC_EX_REFLECT, 1, BASE_ATTACK, spell);
return SPELL_MISS_REFLECT;
}
}
@@ -7897,7 +7897,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
// try detect target manually if not set
if ( target == NULL )
- target = !(procFlags & (PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL | PROC_FLAG_SUCCESSFUL_HEALING_SPELL)) && IsPositiveSpell(trigger_spell_id) ? this : pVictim;
+ target = !(procFlags & (PROC_FLAG_SUCCESSFUL_POSITIVE_MAGIC_SPELL | PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL_HIT)) && IsPositiveSpell(trigger_spell_id) ? this : pVictim;
// default case
if(!target || target!=this && !target->isAlive())