mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-13 11:43:18 -04:00
Core/SAI: Allow SMART_TARGET_ACTION_INVOKER to target GameObjects (#24416)
* Core/SAI: Allow SMART_TARGET_ACTION_INVOKER to target GameObjects * Include new Coalesce(..) template by @Shauren
This commit is contained in:
@@ -243,7 +243,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: Invoker: %s %s", tempInvoker->GetName().c_str(), tempInvoker->GetGUID().ToString().c_str());
|
||||
|
||||
ObjectVector targets;
|
||||
GetTargets(targets, e, unit);
|
||||
GetTargets(targets, e, Coalesce<WorldObject>(unit, gob));
|
||||
|
||||
switch (e.GetActionType())
|
||||
{
|
||||
@@ -2468,9 +2468,9 @@ SmartScriptHolder SmartScript::CreateSmartEvent(SMART_EVENT e, uint32 event_flag
|
||||
return script;
|
||||
}
|
||||
|
||||
void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e, Unit* invoker /*= nullptr*/) const
|
||||
void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e, WorldObject* invoker /*= nullptr*/) const
|
||||
{
|
||||
Unit* scriptTrigger = nullptr;
|
||||
WorldObject* scriptTrigger = nullptr;
|
||||
if (invoker)
|
||||
scriptTrigger = invoker;
|
||||
else if (Unit* tempLastInvoker = GetLastInvoker())
|
||||
@@ -2548,8 +2548,8 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
|
||||
targets.push_back(scriptTrigger);
|
||||
break;
|
||||
case SMART_TARGET_ACTION_INVOKER_VEHICLE:
|
||||
if (scriptTrigger && scriptTrigger->GetVehicle() && scriptTrigger->GetVehicle()->GetBase())
|
||||
targets.push_back(scriptTrigger->GetVehicle()->GetBase());
|
||||
if (scriptTrigger && scriptTrigger->ToUnit() && scriptTrigger->ToUnit()->GetVehicle() && scriptTrigger->ToUnit()->GetVehicle()->GetBase())
|
||||
targets.push_back(scriptTrigger->ToUnit()->GetVehicle()->GetBase());
|
||||
break;
|
||||
case SMART_TARGET_INVOKER_PARTY:
|
||||
if (scriptTrigger)
|
||||
@@ -3086,7 +3086,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
|
||||
(!e.event.spellHit.school || (spell->SchoolMask & e.event.spellHit.school)))
|
||||
{
|
||||
RecalcTimer(e, e.event.spellHit.cooldownMin, e.event.spellHit.cooldownMax);
|
||||
ProcessAction(e, unit, 0, 0, bvar, spell);
|
||||
ProcessAction(e, unit, 0, 0, bvar, spell, gob);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user