From 0935f931fa95cbe6db112092a7b13dc5e38ec27b Mon Sep 17 00:00:00 2001 From: Andrii Danylchenko Date: Sat, 20 Apr 2024 15:26:52 +0300 Subject: [PATCH] BattleAI: fix bypassing 2-hex moat --- AI/BattleAI/BattleEvaluator.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/AI/BattleAI/BattleEvaluator.cpp b/AI/BattleAI/BattleEvaluator.cpp index 3a5a4d154..07a221e2c 100644 --- a/AI/BattleAI/BattleEvaluator.cpp +++ b/AI/BattleAI/BattleEvaluator.cpp @@ -64,6 +64,18 @@ std::vector BattleEvaluator::getBrokenWallMoatHexes() const auto moatHex = wallHex.cloneInDirection(BattleHex::LEFT); 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;