[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.
This commit is contained in:
VladimirMangos 2010-01-01 21:09:10 +03:00
parent f9ec746123
commit c09ee423ba
3 changed files with 39 additions and 25 deletions

View file

@ -511,6 +511,27 @@ void Spell::FillTargetMap()
break; break;
} }
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: case TARGET_EFFECT_SELECT:
switch(m_spellInfo->EffectImplicitTargetB[i]) switch(m_spellInfo->EffectImplicitTargetB[i])
{ {
@ -542,27 +563,6 @@ void Spell::FillTargetMap()
break; break;
} }
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: case TARGET_CASTER_COORDINATES:
switch(m_spellInfo->EffectImplicitTargetB[i]) switch(m_spellInfo->EffectImplicitTargetB[i])
{ {
@ -609,6 +609,19 @@ void Spell::FillTargetMap()
break; break;
} }
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: default:
switch(m_spellInfo->EffectImplicitTargetB[i]) switch(m_spellInfo->EffectImplicitTargetB[i])
{ {

View file

@ -437,7 +437,6 @@ bool IsExplicitPositiveTarget(uint32 targetA)
case TARGET_CHAIN_HEAL: case TARGET_CHAIN_HEAL:
case TARGET_SINGLE_FRIEND_2: case TARGET_SINGLE_FRIEND_2:
case TARGET_AREAEFFECT_PARTY_AND_CLASS: case TARGET_AREAEFFECT_PARTY_AND_CLASS:
case TARGET_SELF2:
return true; return true;
default: default:
break; break;
@ -585,12 +584,14 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex)
return false; return false;
case SPELL_AURA_PERIODIC_DAMAGE: // used in positive spells also. case SPELL_AURA_PERIODIC_DAMAGE: // used in positive spells also.
// part of negative spell if casted at self (prevent cancel) // 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; return false;
break; break;
case SPELL_AURA_MOD_DECREASE_SPEED: // used in positive spells also case SPELL_AURA_MOD_DECREASE_SPEED: // used in positive spells also
// part of positive spell if casted at self // 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; return false;
// but not this if this first effect (don't found batter check) // but not this if this first effect (don't found batter check)
if(spellproto->Attributes & 0x4000000 && effIndex==0) if(spellproto->Attributes & 0x4000000 && effIndex==0)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9097" #define REVISION_NR "9098"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__