aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorQAston <none@none>2009-05-03 01:35:34 +0200
committerQAston <none@none>2009-05-03 01:35:34 +0200
commit6703500a9d12c89907432b75ec050c9a1b0a3f2f (patch)
tree113ce73c26d760cde51fa810efe8fb72fbbfb9ac /src
parent60ba92c02f715aa1a6c12df47841934df34546d4 (diff)
Do not allow finishing moves to proc from selfcast effects - original patch by freeganja
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/SharedDefines.h2
-rw-r--r--src/game/Spell.cpp13
2 files changed, 10 insertions, 5 deletions
diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index c62551e0932..15009304c70 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -349,7 +349,7 @@ enum SpellCategory
#define SPELL_ATTR_EX4_UNK0 0x00000001 // 0
#define SPELL_ATTR_EX4_UNK1 0x00000002 // 1 proc on finishing move?
#define SPELL_ATTR_EX4_UNK2 0x00000004 // 2
-#define SPELL_ATTR_EX4_UNK3 0x00000008 // 3
+#define SPELL_ATTR_EX4_CANT_PROC_FROM_SELFCAST 0x00000008 // 3
#define SPELL_ATTR_EX4_UNK4 0x00000010 // 4
#define SPELL_ATTR_EX4_UNK5 0x00000020 // 5
#define SPELL_ATTR_EX4_UNK6 0x00000040 // 6
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 9c9fde63796..65b073f0565 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -976,6 +976,10 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
uint32 procVictim = m_procVictim;
uint32 procEx = PROC_EX_NONE;
+ //Spells with this flag cannot trigger if effect is casted on self
+ bool canEffectTrigger = (m_spellInfo->AttributesEx4 & SPELL_ATTR_EX4_CANT_PROC_FROM_SELFCAST ? m_caster!=unitTarget : true)
+ && m_canTrigger;
+
if (missInfo==SPELL_MISS_NONE) // In case spell hit target, do all effect on that target
DoSpellHitOnUnit(unit, mask);
else if (missInfo == SPELL_MISS_REFLECT) // In case spell reflect from target, do all effect on caster (if hit)
@@ -1011,7 +1015,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
caster->SendHealSpellLog(unitTarget, m_spellInfo->Id, addhealth, crit);
// Do triggers for unit (reflect triggers passed on hit phase for correct drop charge)
- if (m_canTrigger && missInfo != SPELL_MISS_REFLECT)
+ if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT)
caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo);
int32 gain = unitTarget->ModifyHealth( int32(addhealth) );
@@ -1037,7 +1041,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
procVictim |= PROC_FLAG_TAKEN_ANY_DAMAGE;
// Do triggers for unit (reflect triggers passed on hit phase for correct drop charge)
- if (m_canTrigger && missInfo != SPELL_MISS_REFLECT)
+ if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT)
caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, damageInfo.damage, m_attackType, m_spellInfo);
caster->DealSpellDamage(&damageInfo, true);
@@ -1088,7 +1092,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
SpellNonMeleeDamage damageInfo(caster, unitTarget, m_spellInfo->Id, m_spellSchoolMask);
procEx = createProcExtendMask(&damageInfo, missInfo);
// Do triggers for unit (reflect triggers passed on hit phase for correct drop charge)
- if (m_canTrigger && missInfo != SPELL_MISS_REFLECT)
+ if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT)
caster->ProcDamageAndSpell(unit, procAttacker, procVictim, procEx, 0, m_attackType, m_spellInfo);
}
@@ -1216,7 +1220,8 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->IsAIEnabled)
((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo);
- if (m_ChanceTriggerSpells.size())
+ // spells with this flag can trigger only if not selfcast (eviscerate for example)
+ if (m_ChanceTriggerSpells.size() && (!m_spellInfo->AttributesEx4 & SPELL_ATTR_EX4_CANT_PROC_FROM_SELFCAST || unit!=m_caster)
{
int _duration=0;
for(ChanceTriggerSpells::const_iterator i = m_ChanceTriggerSpells.begin(); i != m_ChanceTriggerSpells.end(); ++i)