Better tank target selection (#996)

This commit is contained in:
Yunfan Li
2025-02-21 23:20:33 +08:00
committed by GitHub
parent 419e96e5aa
commit 0a76fc1d5f

View File

@@ -87,12 +87,12 @@ public:
float new_dis = bot->GetDistance(new_unit);
float old_dis = bot->GetDistance(old_unit);
// hasAggro? -> withinMelee? -> threat
if (GetIntervalLevel(new_unit) > GetIntervalLevel(old_unit))
if (GetIntervalLevel(new_unit) != GetIntervalLevel(old_unit))
{
return true;
return GetIntervalLevel(new_unit) > GetIntervalLevel(old_unit);
}
int32_t interval = GetIntervalLevel(new_unit);
if (interval == 1)
if (interval == 2)
{
return new_dis < old_dis;
}
@@ -101,6 +101,10 @@ public:
int32_t GetIntervalLevel(Unit* unit)
{
if (!botAI->HasAggro(unit))
{
return 2;
}
if (botAI->GetBot()->IsWithinMeleeRange(unit))
{
return 1;
}