1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

BattleAI: fix bypassing 2-hex moat

This commit is contained in:
Andrii Danylchenko 2024-04-20 15:26:52 +03:00
parent ae69311023
commit 0935f931fa

View File

@ -64,6 +64,18 @@ std::vector<BattleHex> BattleEvaluator::getBrokenWallMoatHexes() const
auto moatHex = wallHex.cloneInDirection(BattleHex::LEFT); auto moatHex = wallHex.cloneInDirection(BattleHex::LEFT);
result.push_back(moatHex); result.push_back(moatHex);
moatHex = moatHex.cloneInDirection(BattleHex::LEFT);
auto obstaclesSecondRow = cb->getBattle(battleID)->battleGetAllObstaclesOnPos(moatHex, false);
for(auto obstacle : obstaclesSecondRow)
{
if(obstacle->obstacleType == CObstacleInstance::EObstacleType::MOAT)
{
result.push_back(moatHex);
break;
}
}
} }
return result; return result;