mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Better tank target selection (#996)
This commit is contained in:
@@ -87,12 +87,12 @@ public:
|
|||||||
float new_dis = bot->GetDistance(new_unit);
|
float new_dis = bot->GetDistance(new_unit);
|
||||||
float old_dis = bot->GetDistance(old_unit);
|
float old_dis = bot->GetDistance(old_unit);
|
||||||
// hasAggro? -> withinMelee? -> threat
|
// 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);
|
int32_t interval = GetIntervalLevel(new_unit);
|
||||||
if (interval == 1)
|
if (interval == 2)
|
||||||
{
|
{
|
||||||
return new_dis < old_dis;
|
return new_dis < old_dis;
|
||||||
}
|
}
|
||||||
@@ -101,6 +101,10 @@ public:
|
|||||||
int32_t GetIntervalLevel(Unit* unit)
|
int32_t GetIntervalLevel(Unit* unit)
|
||||||
{
|
{
|
||||||
if (!botAI->HasAggro(unit))
|
if (!botAI->HasAggro(unit))
|
||||||
|
{
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
if (botAI->GetBot()->IsWithinMeleeRange(unit))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user