fix(Core/SmartAI): implement param maxCount for SMART_TARGET_PLAYER_RANGE (#18394)

* init

* conditional
This commit is contained in:
Dan 2024-02-25 15:50:07 +01:00 committed by GitHub
parent 94b636834a
commit 4fcd3402ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3456,6 +3456,8 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
for (WorldObject* unit : units)
if (IsPlayer(unit) && baseObject->IsInRange(unit, float(e.target.playerRange.minDist), float(e.target.playerRange.maxDist)))
targets.push_back(unit);
if (e.target.playerRange.maxCount)
Acore::Containers::RandomResize(targets, e.target.playerRange.maxCount);
break;
}
case SMART_TARGET_PLAYER_DISTANCE: