[Attack target] Fix a target selection bug that causing bot stuck

This commit is contained in:
Yunfan Li
2024-09-26 21:28:40 +08:00
parent 7f05d3f6bf
commit 4df77e6d95

View File

@@ -5,6 +5,7 @@
#include "RtiTargetValue.h"
#include "AttackersValue.h"
#include "Playerbots.h"
#include "ServerFacade.h"
@@ -61,7 +62,7 @@ Unit* RtiTargetValue::Calculate()
//////////////////////////////////////////////////////end: delete below check
Unit* unit = botAI->GetUnit(guid);
if (!unit || unit->isDead() || !bot->IsWithinLOSInMap(unit) ||
if (!unit || unit->isDead() || !bot->IsWithinLOSInMap(unit) || !AttackersValue::IsValidTarget(unit, bot) ||
sServerFacade->IsDistanceGreaterThan(sServerFacade->GetDistance2d(bot, unit),
sPlayerbotAIConfig->sightDistance))
return nullptr;