*Fix that bug that the target of Intimidating Shout is both stunned and feared.
--HG-- branch : trunk
This commit is contained in:
+12
-24
@@ -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);
|
|
||||||
for (std::list<Unit*>::iterator itr = TagUnitMap.begin(); itr != TagUnitMap.end(); ++itr, --poz)
|
|
||||||
{
|
|
||||||
if (!*itr) continue;
|
|
||||||
if (!poz)
|
|
||||||
{
|
{
|
||||||
|
itr = TagUnitMap.begin();
|
||||||
|
advance(itr, urand(0, TagUnitMap.size() - 1));
|
||||||
TagUnitMap.erase(itr);
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user