From c09ee423ba695af808e7d5b64cdf57614d9a506a Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Fri, 1 Jan 2010 21:09:10 +0300 Subject: [PATCH] [9098] More correct targets selection for target pairs with TARGET_SELF2 * Many spell effects that have A target mode SELF2 expected applied to enemy target selected by targetmode B so we need skip SELF2 target mode. * remove SEFL2 from explicit positive target modes. --- src/game/Spell.cpp | 55 +++++++++++++++++++++++++--------------- src/game/SpellMgr.cpp | 7 ++--- src/shared/revision_nr.h | 2 +- 3 files changed, 39 insertions(+), 25 deletions(-) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 08b84e03c..a87bffbf3 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -511,6 +511,27 @@ void Spell::FillTargetMap() break; } break; + case TARGET_SELF: + switch(m_spellInfo->EffectImplicitTargetB[i]) + { + case 0: + case TARGET_EFFECT_SELECT: + SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); + break; + case TARGET_AREAEFFECT_INSTANT: // use B case that not dependent from from A in fact + if((m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) == 0) + m_targets.setDestination(m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ()); + SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); + break; + case TARGET_BEHIND_VICTIM: // use B case that not dependent from from A in fact + SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); + break; + default: + SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); + SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); + break; + } + break; case TARGET_EFFECT_SELECT: switch(m_spellInfo->EffectImplicitTargetB[i]) { @@ -542,27 +563,6 @@ void Spell::FillTargetMap() break; } break; - case TARGET_SELF: - switch(m_spellInfo->EffectImplicitTargetB[i]) - { - case 0: - case TARGET_EFFECT_SELECT: - SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); - break; - case TARGET_AREAEFFECT_INSTANT: // use B case that not dependent from from A in fact - if((m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) == 0) - m_targets.setDestination(m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ()); - SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); - break; - case TARGET_BEHIND_VICTIM: // use B case that not dependent from from A in fact - SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); - break; - default: - SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); - SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); - break; - } - break; case TARGET_CASTER_COORDINATES: switch(m_spellInfo->EffectImplicitTargetB[i]) { @@ -609,6 +609,19 @@ void Spell::FillTargetMap() break; } break; + case TARGET_SELF2: + switch(m_spellInfo->EffectImplicitTargetB[i]) + { + case 0: + case TARGET_EFFECT_SELECT: + SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); + break; + // most A/B target pairs is slef->negative and not expect adding caster to target list + default: + SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); + break; + } + break; default: switch(m_spellInfo->EffectImplicitTargetB[i]) { diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 6fc906437..74223f6f4 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -437,7 +437,6 @@ bool IsExplicitPositiveTarget(uint32 targetA) case TARGET_CHAIN_HEAL: case TARGET_SINGLE_FRIEND_2: case TARGET_AREAEFFECT_PARTY_AND_CLASS: - case TARGET_SELF2: return true; default: break; @@ -585,12 +584,14 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex) return false; case SPELL_AURA_PERIODIC_DAMAGE: // used in positive spells also. // part of negative spell if casted at self (prevent cancel) - if(spellproto->EffectImplicitTargetA[effIndex] == TARGET_SELF) + if (spellproto->EffectImplicitTargetA[effIndex] == TARGET_SELF || + spellproto->EffectImplicitTargetA[effIndex] == TARGET_SELF2) return false; break; case SPELL_AURA_MOD_DECREASE_SPEED: // used in positive spells also // part of positive spell if casted at self - if(spellproto->EffectImplicitTargetA[effIndex] != TARGET_SELF) + if (spellproto->EffectImplicitTargetA[effIndex] == TARGET_SELF || + spellproto->EffectImplicitTargetA[effIndex] == TARGET_SELF2) return false; // but not this if this first effect (don't found batter check) if(spellproto->Attributes & 0x4000000 && effIndex==0) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a83c2a227..a85cb51bc 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9097" + #define REVISION_NR "9098" #endif // __REVISION_NR_H__