mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-10 15:27:27 +07:00
Resolved #10525 - AI clears inquisitors from city centers to make way for spaceship units
This commit is contained in:
parent
e6bb9d4d9a
commit
f833918177
@ -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) }
|
||||
|
@ -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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user