mirror of
https://github.com/araxiaonline/TrinityCore2.git
synced 2026-06-15 12:33:36 -04:00
Core/SmartAI: added TARGET_THREAT_LIST, uses all units from creature's threat list as targets
- modified ACTION_CALL_CASTEDCREATUREORGO to use simple targeting --HG-- branch : trunk
This commit is contained in:
@@ -460,11 +460,13 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
|
||||
case SMART_ACTION_CALL_CASTEDCREATUREORGO:
|
||||
{
|
||||
if (!me) return;
|
||||
std::list<HostileReference*>& threatList = me->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i)
|
||||
if (Unit* Temp = Unit::GetUnit(*me,(*i)->getUnitGuid()))
|
||||
if (IsPlayer(Temp))
|
||||
Temp->ToPlayer()->CastedCreatureOrGO(e.action.castedCreatureOrGO.creature, me->GetGUID(), e.action.castedCreatureOrGO.spell);
|
||||
ObjectList* targets = GetTargets(e, unit);
|
||||
if (!targets) return;
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); itr++)
|
||||
{
|
||||
if (IsPlayer((*itr)))
|
||||
(*itr)->ToPlayer()->CastedCreatureOrGO(e.action.castedCreatureOrGO.creature, me->GetGUID(), e.action.castedCreatureOrGO.spell);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_REMOVEAURASFROMSPELL:
|
||||
@@ -1482,6 +1484,15 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder e, Unit* invoker)
|
||||
l->push_back(owner);
|
||||
break;
|
||||
}
|
||||
case SMART_TARGET_THREAT_LIST:
|
||||
{
|
||||
if (!me) return NULL;
|
||||
std::list<HostileReference*>& threatList = me->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i)
|
||||
if (Unit* Temp = Unit::GetUnit(*me,(*i)->getUnitGuid()))
|
||||
l->push_back(Temp);
|
||||
break;
|
||||
}
|
||||
case SMART_TARGET_POSITION:
|
||||
default:
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user