From 07f31498d141a45b60305fb8370fac379984873c Mon Sep 17 00:00:00 2001 From: yang <2101461382@qq.com> Date: Wed, 29 May 2024 15:50:26 +0800 Subject: [PATCH] [Optimization] Optimize the judgment of attack targets --- src/strategy/values/RtiTargetValue.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/strategy/values/RtiTargetValue.cpp b/src/strategy/values/RtiTargetValue.cpp index 40f5eee7..f8f2c714 100644 --- a/src/strategy/values/RtiTargetValue.cpp +++ b/src/strategy/values/RtiTargetValue.cpp @@ -45,10 +45,19 @@ Unit* RtiTargetValue::Calculate() if (!guid) return nullptr; - GuidVector attackers = context->GetValue("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("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;