[Attack Target] Prioritized targets

This commit is contained in:
Yunfan Li
2024-05-28 11:25:07 +08:00
parent 43c0435e78
commit d5d1bb3904
5 changed files with 75 additions and 7 deletions

View File

@@ -23,6 +23,20 @@ GuidVector AttackersValue::Calculate()
if (Group* group = bot->GetGroup())
AddAttackersOf(group, targets);
// prioritize target
GuidVector prioritizedTargets = AI_VALUE(GuidVector, "prioritized targets");
for (ObjectGuid target : prioritizedTargets) {
Unit* unit = botAI->GetUnit(target);
if (unit) {
targets.insert(unit);
}
}
ObjectGuid skullGuid = bot->GetGroup()->GetTargetIcon(4);
Unit* skullTarget = botAI->GetUnit(skullGuid);
if (skullTarget) {
targets.insert(skullTarget);
}
RemoveNonThreating(targets);
for (Unit* unit : targets)
@@ -30,7 +44,7 @@ GuidVector AttackersValue::Calculate()
if (bot->duel && bot->duel->Opponent)
result.push_back(bot->duel->Opponent->GetGUID());
return result;
}