Skip to content

Commit

Permalink
[12202] Improve target selection for TARGET_DUELVSPLAYER
Browse files Browse the repository at this point in the history
Also set the spell to be Redirected only if the spell is actually redirected
  • Loading branch information
Schmoozerd authored and Salja committed Sep 9, 2012
1 parent d51c1ca commit 57082b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/game/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2581,19 +2581,21 @@ 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))
{
targetUnitMap.push_back(target);
}
else
{
if (Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), this, effIndex))
if (Unit* pUnitTarget = m_caster->SelectMagnetTarget(target, this, effIndex))
{
m_targets.setUnitTarget(pUnitTarget);
m_spellFlags |= SPELL_FLAG_REDIRECTED;
if (target != pUnitTarget)
{
m_targets.setUnitTarget(pUnitTarget);
m_spellFlags |= SPELL_FLAG_REDIRECTED;
}
targetUnitMap.push_back(pUnitTarget);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12201"
#define REVISION_NR "12202"
#endif // __REVISION_NR_H__

0 comments on commit 57082b8

Please sign in to comment.