Scripts: Removed duplicate target selection function (SelectUnit), there is only SelectTarget now

This commit is contained in:
Shauren
2011-03-09 21:32:04 +01:00
parent 6e1e6957e2
commit c2c40a4750
169 changed files with 420 additions and 523 deletions

View File

@@ -192,38 +192,6 @@ Creature* ScriptedAI::DoSpawnCreature(uint32 uiId, float fX, float fY, float fZ,
return me->SummonCreature(uiId, me->GetPositionX()+fX, me->GetPositionY()+fY, me->GetPositionZ()+fZ, fAngle, (TempSummonType)uiType, uiDespawntime);
}
Unit* ScriptedAI::SelectUnit(SelectAggroTarget pTarget, uint32 uiPosition)
{
//ThreatList m_threatlist;
std::list<HostileReference*>& threatlist = me->getThreatManager().getThreatList();
std::list<HostileReference*>::iterator itr = threatlist.begin();
std::list<HostileReference*>::reverse_iterator ritr = threatlist.rbegin();
if (uiPosition >= threatlist.size() || !threatlist.size())
return NULL;
switch (pTarget)
{
case SELECT_TARGET_RANDOM:
advance (itr , uiPosition + (rand() % (threatlist.size() - uiPosition)));
return Unit::GetUnit((*me),(*itr)->getUnitGuid());
break;
case SELECT_TARGET_TOPAGGRO:
advance (itr , uiPosition);
return Unit::GetUnit((*me),(*itr)->getUnitGuid());
break;
case SELECT_TARGET_BOTTOMAGGRO:
advance (ritr , uiPosition);
return Unit::GetUnit((*me),(*ritr)->getUnitGuid());
break;
default:
return UnitAI::SelectTarget(pTarget, uiPosition);
}
}
SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, uint32 uiSchool, uint32 uiMechanic, SelectTargetType selectTargets, uint32 uiPowerCostMin, uint32 uiPowerCostMax, float fRangeMin, float fRangeMax, SelectEffect selectEffects)
{
//No target so we can't cast