mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
fix rndbot stuck bug
This commit is contained in:
@@ -18,27 +18,31 @@ class FindTargetForTankStrategy : public FindNonCcTargetStrategy
|
||||
}
|
||||
Player* bot = botAI->GetBot();
|
||||
float threat = threatMgr->GetThreat(bot);
|
||||
float dist = creature->GetDistance(bot);
|
||||
if (!result) {
|
||||
minThreat = threat;
|
||||
minDistance = dist;
|
||||
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->IsMainTank(victim->ToPlayer())) {
|
||||
if (victim && victim->ToPlayer() && botAI->IsTank(victim->ToPlayer())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (minThreat >= threat)
|
||||
if (minDistance >= dist || badResult)
|
||||
{
|
||||
minThreat = threat;
|
||||
badResult = false;
|
||||
minDistance = dist;
|
||||
result = creature;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
float minThreat;
|
||||
float minDistance;
|
||||
bool badResult = true;
|
||||
};
|
||||
|
||||
Unit* TankTargetValue::Calculate()
|
||||
|
||||
Reference in New Issue
Block a user