[Attack target] Fix attack

This commit is contained in:
Yunfan Li
2024-06-04 22:15:27 +08:00
parent 55eecba11b
commit 46e585f854
3 changed files with 60 additions and 75 deletions

View File

@@ -100,6 +100,24 @@ void FindTargetStrategy::GetPlayerCount(Unit* creature, uint32* tankCount, uint3
dpsCountCache[creature] = *dpsCount;
}
bool FindTargetStrategy::IsHighPriority(Unit* attacker)
{
if (Group* group = botAI->GetBot()->GetGroup())
{
ObjectGuid guid = group->GetTargetIcon(4);
if (guid && attacker->GetGUID() == guid) {
return true;
}
}
GuidVector prioritizedTargets = botAI->GetAiObjectContext()->GetValue<GuidVector>("prioritized targets")->Get();
for (ObjectGuid targetGuid : prioritizedTargets) {
if (targetGuid && attacker->GetGUID() == targetGuid) {
return true;
}
}
return false;
}
WorldPosition LastLongMoveValue::Calculate()
{
LastMovement& lastMove = *context->GetValue<LastMovement&>("last movement");