Resolved #10525 - AI clears inquisitors from city centers to make way for spaceship units

This commit is contained in:
Yair Morgenstern 2023-11-19 22:16:54 +02:00
parent e6bb9d4d9a
commit f833918177
2 changed files with 8 additions and 3 deletions

View File

@ -11,12 +11,14 @@ import com.unciv.ui.screens.worldscreen.unit.actions.UnitActions
object CivilianUnitAutomation {
fun shouldClearTileForAddInCapitalUnits(unit: MapUnit, tile:Tile) = tile.getCity()?.isCapital() == true
&& !unit.hasUnique(UniqueType.AddInCapital)
&& unit.civ.units.getCivUnits().any { unit.hasUnique(UniqueType.AddInCapital) }
fun automateCivilianUnit(unit: MapUnit) {
if (tryRunAwayIfNeccessary(unit)) return
if (unit.currentTile.isCityCenter() && unit.currentTile.getCity()!!.isCapital()
&& !unit.hasUnique(UniqueType.AddInCapital)
&& unit.civ.units.getCivUnits().any { unit.hasUnique(UniqueType.AddInCapital) }) {
if (shouldClearTileForAddInCapitalUnits(unit, unit.currentTile)) {
// First off get out of the way, then decide if you actually want to do something else
val tilesCanMoveTo = unit.movement.getDistanceToTiles()
.filter { unit.movement.canMoveTo(it.key) }

View File

@ -89,6 +89,9 @@ object ReligiousUnitAutomation {
?: return
}
if (CivilianUnitAutomation.shouldClearTileForAddInCapitalUnits(unit, destination))
return // Wait for the addInCapital units to go to the city!
unit.movement.headTowards(destination)
if (cityToConvert != null && unit.getTile().getCity() == destination.getCity()) {