aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-05-02 19:45:55 -0500
committermegamage <none@none>2009-05-02 19:45:55 -0500
commiteeeae2e3491c719790bc7f58b19a4d7c6ceafb61 (patch)
tree5986728932e5a3e91654a4615e4dcf5f821d3662 /src
parentcdec454aa7aa1795e6e746a57cd6dce72d2ba89f (diff)
parent74ac9a40f0ad70f708ed2503e7296a4bb7155627 (diff)
*Merge.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/SharedDefines.h2
-rw-r--r--src/game/Spell.cpp20
-rw-r--r--src/game/Spell.h2
-rw-r--r--src/game/SpellEffects.cpp4
4 files changed, 17 insertions, 11 deletions
diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index f497e4c709a..2b139a4de67 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -355,7 +355,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 This will no longer cause guards to attack on use??
#define SPELL_ATTR_EX4_UNK5 0x00000020 // 5
#define SPELL_ATTR_EX4_NOT_STEALABLE 0x00000040 // 6 although such auras might be dispellable, they cannot be stolen
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index cbf41a4d146..8cb8c6a56b3 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -959,7 +959,10 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
? PROC_EX_INTERNAL_TRIGGERED : PROC_EX_NONE;
m_spellAura = NULL; // Set aura to null for every target-make sure that pointer is not used for unit without aura applied
+ //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);
Unit * spellHitTarget = NULL;
+
if (missInfo==SPELL_MISS_NONE) // In case spell hit target, do all effect on that target
spellHitTarget = unit;
else if (missInfo == SPELL_MISS_REFLECT) // In case spell reflect from target, do all effect on caster (if hit)
@@ -999,7 +1002,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
procEx |= PROC_EX_NORMAL_HIT;
// Do triggers for unit (reflect triggers passed on hit phase for correct drop charge)
- if (missInfo != SPELL_MISS_REFLECT)
+ if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT)
caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo);
if (m_spellAura)
@@ -1024,7 +1027,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 (missInfo != SPELL_MISS_REFLECT)
+ if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT)
caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, damageInfo.damage, m_attackType, m_spellInfo);
if (m_spellAura)
@@ -1046,7 +1049,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 (missInfo != SPELL_MISS_REFLECT)
+ if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT)
caster->ProcDamageAndSpell(unit, procAttacker, procVictim, procEx, 0, m_attackType, m_spellInfo);
}
@@ -1230,7 +1233,8 @@ void Spell::DoTriggersOnSpellHit(Unit *unit)
m_caster->CastSpell(unit,m_preCastSpell, true, m_CastItem);
}
- 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)
@@ -1911,7 +1915,7 @@ void Spell::SetTargetMap(uint32 i, uint32 cur)
case TARGET_TYPE_CHANNEL:
{
- if(!m_caster->m_currentSpells[CURRENT_CHANNELED_SPELL])
+ if(!m_originalCaster || !m_originalCaster->m_currentSpells[CURRENT_CHANNELED_SPELL])
{
sLog.outError( "SPELL: no current channeled spell for spell ID %u", m_spellInfo->Id );
break;
@@ -1920,14 +1924,14 @@ void Spell::SetTargetMap(uint32 i, uint32 cur)
switch(cur)
{
case TARGET_UNIT_CHANNEL:
- if(Unit* target = m_caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->m_targets.getUnitTarget())
+ if(Unit* target = m_originalCaster->m_currentSpells[CURRENT_CHANNELED_SPELL]->m_targets.getUnitTarget())
AddUnitTarget(target, i);
else
sLog.outError( "SPELL: cannot find channel spell target for spell ID %u", m_spellInfo->Id );
break;
case TARGET_DEST_CHANNEL:
- if(m_caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->m_targets.HasDst())
- m_targets = m_caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->m_targets;
+ if(m_originalCaster->m_currentSpells[CURRENT_CHANNELED_SPELL]->m_targets.HasDst())
+ m_targets = m_originalCaster->m_currentSpells[CURRENT_CHANNELED_SPELL]->m_targets;
else
sLog.outError( "SPELL: cannot find channel spell destination for spell ID %u", m_spellInfo->Id );
break;
diff --git a/src/game/Spell.h b/src/game/Spell.h
index 4b630ce8dc9..b0ef28fd89d 100644
--- a/src/game/Spell.h
+++ b/src/game/Spell.h
@@ -107,7 +107,7 @@ enum SpellNotifyPushType
PUSH_IN_LINE,
PUSH_SRC_CENTER,
PUSH_DST_CENTER,
- PUSH_CASTER_CENTER,
+ PUSH_CASTER_CENTER, //this is never used in grid search
PUSH_CHAIN,
};
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index c3d4b226cb4..3933db44367 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -2110,7 +2110,9 @@ void Spell::EffectTriggerSpell(uint32 i)
bool instant = false;
for(uint32 j = i+1; j < 3; ++j)
{
- if(m_spellInfo->Effect[j]==SPELL_EFFECT_INSTAKILL && m_spellInfo->EffectImplicitTargetA[j]==TARGET_UNIT_CASTER)
+ if(m_spellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER
+ && (m_spellInfo->Effect[j]==SPELL_EFFECT_INSTAKILL
+ || m_spellInfo->Effect[j]==SPELL_EFFECT_SANCTUARY))
{
instant = true;
break;