SmartAI: player range targets with no minimum include players close by

SMART_TARGET_PLAYER_RANGE with a minimum of 0 dropped every player within
both combat reaches (about 3 yards), so the player who walked Bareth
Dawnstone to the end of Seeking Refuge right beside him got neither the
escort credit nor the completion event.

(cherry picked from commit e0520be75771d8c066e9c717e497d7d3b11dde73)
This commit is contained in:
Karrz1
2026-11-11 23:38:03 +00:00
parent aa2a616f4e
commit 958fe79eb0
@@ -3028,7 +3028,12 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
std::vector<Player*> players;
baseObject->GetPlayerListInGrid(players, static_cast<float>(e.target.playerRange.maxDist));
std::ranges::copy_if(players, std::back_inserter(targets), [&](Player const* target) { return !baseObject->IsWithinDist(target, static_cast<float>(e.target.playerRange.minDist)); });
// minDist 0 means no minimum. IsWithinDist adds both combat reaches, so "not within 0" would leave out every player
// standing within about 3 yards, such as the player who walked an escort to its end right next to it.
std::ranges::copy_if(players, std::back_inserter(targets), [&](Player const* target)
{
return !e.target.playerRange.minDist || !baseObject->IsWithinDist(target, static_cast<float>(e.target.playerRange.minDist));
});
break;
}
case SMART_TARGET_PLAYER_DISTANCE: