rollback tank target value

This commit is contained in:
Yunfan Li
2023-10-07 19:33:12 +08:00
parent ea50b249bb
commit 5b89437929

View File

@@ -18,31 +18,27 @@ class FindTargetForTankStrategy : public FindNonCcTargetStrategy
}
Player* bot = botAI->GetBot();
float threat = threatMgr->GetThreat(bot);
float dist = creature->GetDistance(bot);
if (!result) {
minDistance = dist;
minThreat = threat;
result = creature;
}
// neglect if victim is main tank, or no victim (for untauntable target)
if (threatMgr->getCurrentVictim()) {
// float max_threat = threatMgr->GetThreat(threatMgr->getCurrentVictim()->getTarget());
Unit* victim = threatMgr->getCurrentVictim()->getTarget();
if (victim && victim->ToPlayer() && botAI->IsTank(victim->ToPlayer())) {
if (victim && victim->ToPlayer() && botAI->IsMainTank(victim->ToPlayer())) {
return;
}
}
if (minDistance >= dist || badResult)
if (minThreat >= threat)
{
badResult = false;
minDistance = dist;
minThreat = threat;
result = creature;
}
}
protected:
float minThreat;
float minDistance;
bool badResult = true;
};
Unit* TankTargetValue::Calculate()