mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
[Optimization] Optimize the judgment of attack targets
This commit is contained in:
@@ -45,10 +45,19 @@ Unit* RtiTargetValue::Calculate()
|
||||
if (!guid)
|
||||
return nullptr;
|
||||
|
||||
GuidVector attackers = context->GetValue<GuidVector >("attackers")->Get();
|
||||
if (find(attackers.begin(), attackers.end(), guid) == attackers.end())
|
||||
if (!bot->IsInCombat())
|
||||
return nullptr;
|
||||
|
||||
//////////////////////////////////////////////////////begin: delete below check
|
||||
// Some units that need to be killed in battle are not on the list of attackers,
|
||||
// such as the Kor'kron Battle-Mage in Icecrown Citadel.
|
||||
|
||||
// GuidVector attackers = context->GetValue<GuidVector >("attackers")->Get();
|
||||
// if (find(attackers.begin(), attackers.end(), guid) == attackers.end())
|
||||
// return nullptr;
|
||||
//
|
||||
//////////////////////////////////////////////////////end: delete below check
|
||||
|
||||
Unit* unit = botAI->GetUnit(guid);
|
||||
if (!unit || unit->isDead() || !bot->IsWithinLOSInMap(unit) || sServerFacade->IsDistanceGreaterThan(sServerFacade->GetDistance2d(bot, unit), sPlayerbotAIConfig->sightDistance))
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user