From 3df72ce46112e0cc99d25b7f44794c009c224f24 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 7 Jan 2009 19:18:12 -0600 Subject: *Fix that bug that the target of Intimidating Shout is both stunned and feared. --HG-- branch : trunk --- src/game/Spell.cpp | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) (limited to 'src/game/Spell.cpp') diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 89f22ae5e1c..9513149be89 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1994,38 +1994,26 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list &TagUnitMap) break; } - if (unMaxTargets && TagUnitMap.size() > unMaxTargets) + if(unMaxTargets) { - // make sure one unit is always removed per iteration - uint32 removed_utarget = 0; - for (std::list::iterator itr = TagUnitMap.begin(), next; itr != TagUnitMap.end(); itr = next) + if(m_targets.getUnitTarget()) { - next = itr; - ++next; - if (!*itr) continue; - if ((*itr) == m_targets.getUnitTarget()) - { - TagUnitMap.erase(itr); - removed_utarget = 1; - // break; - } + TagUnitMap.remove(m_targets.getUnitTarget()); + if(m_spellInfo->Id != 5246) //Intimidating Shout + --unMaxTargets; } + // remove random units from the map - while (TagUnitMap.size() > unMaxTargets - removed_utarget) + std::list::iterator itr; + while(TagUnitMap.size() > unMaxTargets) { - uint32 poz = urand(0, TagUnitMap.size()-1); - for (std::list::iterator itr = TagUnitMap.begin(); itr != TagUnitMap.end(); ++itr, --poz) - { - if (!*itr) continue; - if (!poz) - { - TagUnitMap.erase(itr); - break; - } - } + itr = TagUnitMap.begin(); + advance(itr, urand(0, TagUnitMap.size() - 1)); + TagUnitMap.erase(itr); } + // 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()); } } -- cgit v1.2.3