Resolved #12611 - automated air units with "Cannot move" do not move

This commit is contained in:
yairm210 2024-12-09 14:08:25 +02:00
parent 7187554adb
commit d08f2a2939

View File

@ -51,6 +51,8 @@ object AirUnitAutomation {
if (BattleHelper.tryAttackNearbyEnemy(unit)) return
if (unit.cache.cannotMove) return // from here on it's all "try to move somewhere else"
if (tryRelocateToCitiesWithEnemyNearBy(unit)) return
val pathsToCities = unit.movement.getAerialPathsToCities()
@ -76,7 +78,6 @@ object AirUnitAutomation {
// no city needs fighters to defend, so let's attack stuff from the closest possible location
tryMoveToCitiesToAerialAttackFrom(pathsToCities, unit)
}
private fun tryAirSweep(unit: MapUnit, tilesWithEnemyUnitsInRange: List<Tile>): Boolean {
@ -97,6 +98,8 @@ object AirUnitAutomation {
return // Wait and heal
}
if (unit.cache.cannotMove) return // from here on it's all "try to move somewhere else"
if (tryRelocateToCitiesWithEnemyNearBy(unit)) return
val pathsToCities = unit.movement.getAerialPathsToCities()