[12202] Improve target selection for TARGET_DUELVSPLAYER

Also set the spell to be Redirected only if the spell is actually redirected
This commit is contained in:
Schmoozerd 2012-09-08 23:10:29 +02:00 committed by Antz
parent 5dcb4d40ce
commit 6ba3c19a22
2 changed files with 8 additions and 6 deletions

View file

@ -2581,8 +2581,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
break;
case TARGET_DUELVSPLAYER:
{
Unit* target = m_targets.getUnitTarget();
if (target)
if (Unit* target = m_targets.getUnitTarget())
{
if (m_caster->IsFriendlyTo(target))
{
@ -2590,10 +2589,13 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
}
else
{
if (Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), this, effIndex))
if (Unit* pUnitTarget = m_caster->SelectMagnetTarget(target, this, effIndex))
{
if (target != pUnitTarget)
{
m_targets.setUnitTarget(pUnitTarget);
m_spellFlags |= SPELL_FLAG_REDIRECTED;
}
targetUnitMap.push_back(pUnitTarget);
}
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12201"
#define REVISION_NR "12202"
#endif // __REVISION_NR_H__