*Fix that bug that the target of Intimidating Shout is both stunned and feared.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-01-07 19:18:12 -06:00
parent a41329b9bb
commit 3df72ce461
+13 -25
View File
@@ -1994,38 +1994,26 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
break; break;
} }
if (unMaxTargets && TagUnitMap.size() > unMaxTargets) if(unMaxTargets)
{ {
// make sure one unit is always removed per iteration if(m_targets.getUnitTarget())
uint32 removed_utarget = 0;
for (std::list<Unit*>::iterator itr = TagUnitMap.begin(), next; itr != TagUnitMap.end(); itr = next)
{ {
next = itr; TagUnitMap.remove(m_targets.getUnitTarget());
++next; if(m_spellInfo->Id != 5246) //Intimidating Shout
if (!*itr) continue; --unMaxTargets;
if ((*itr) == m_targets.getUnitTarget())
{
TagUnitMap.erase(itr);
removed_utarget = 1;
// break;
}
} }
// remove random units from the map // remove random units from the map
while (TagUnitMap.size() > unMaxTargets - removed_utarget) std::list<Unit*>::iterator itr;
while(TagUnitMap.size() > unMaxTargets)
{ {
uint32 poz = urand(0, TagUnitMap.size()-1); itr = TagUnitMap.begin();
for (std::list<Unit*>::iterator itr = TagUnitMap.begin(); itr != TagUnitMap.end(); ++itr, --poz) advance(itr, urand(0, TagUnitMap.size() - 1));
{ TagUnitMap.erase(itr);
if (!*itr) continue;
if (!poz)
{
TagUnitMap.erase(itr);
break;
}
}
} }
// the player's target will always be added to the map // the player's target will always be added to the map
if (removed_utarget && m_targets.getUnitTarget()) if(m_targets.getUnitTarget() && m_spellInfo->Id != 5246)
TagUnitMap.push_back(m_targets.getUnitTarget()); TagUnitMap.push_back(m_targets.getUnitTarget());
} }
} }