fix(Core/SmartAI): implement param maxCount for SMART_TARGET_PLAYER_RANGE (#18394)
* init * conditional
This commit is contained in:
@@ -3456,6 +3456,8 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
|
|||||||
for (WorldObject* unit : units)
|
for (WorldObject* unit : units)
|
||||||
if (IsPlayer(unit) && baseObject->IsInRange(unit, float(e.target.playerRange.minDist), float(e.target.playerRange.maxDist)))
|
if (IsPlayer(unit) && baseObject->IsInRange(unit, float(e.target.playerRange.minDist), float(e.target.playerRange.maxDist)))
|
||||||
targets.push_back(unit);
|
targets.push_back(unit);
|
||||||
|
if (e.target.playerRange.maxCount)
|
||||||
|
Acore::Containers::RandomResize(targets, e.target.playerRange.maxCount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SMART_TARGET_PLAYER_DISTANCE:
|
case SMART_TARGET_PLAYER_DISTANCE:
|
||||||
|
|||||||
Reference in New Issue
Block a user