mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-24 03:53:12 -04:00
Resolved #11901 - Can no longer build infinite air units in cities
This commit is contained in:
parent
13c1ef89a5
commit
661d7a1b79
@ -237,6 +237,8 @@ class City : IsPartOfGameInfoSerialization, INamed {
|
|||||||
200 + cityConstructions.getBuiltBuildings().sumOf { it.cityHealth }
|
200 + cityConstructions.getBuiltBuildings().sumOf { it.cityHealth }
|
||||||
|
|
||||||
fun getStrength() = cityConstructions.getBuiltBuildings().sumOf { it.cityStrength }.toFloat()
|
fun getStrength() = cityConstructions.getBuiltBuildings().sumOf { it.cityStrength }.toFloat()
|
||||||
|
/** Gets max air units that can remain in the city untransported */
|
||||||
|
fun getMaxAirUnits() = 6
|
||||||
|
|
||||||
override fun toString() = name // for debug
|
override fun toString() = name // for debug
|
||||||
|
|
||||||
|
@ -892,7 +892,14 @@ class MapUnit : IsPartOfGameInfoSerialization {
|
|||||||
else -> tile.militaryUnit = this
|
else -> tile.militaryUnit = this
|
||||||
}
|
}
|
||||||
// this check is here in order to not load the fresh built unit into carrier right after the build
|
// this check is here in order to not load the fresh built unit into carrier right after the build
|
||||||
isTransported = !tile.isCityCenter() && baseUnit.movesLikeAirUnits // not moving civilians
|
if (baseUnit.movesLikeAirUnits){
|
||||||
|
if (!tile.isCityCenter()) isTransported = true
|
||||||
|
else {
|
||||||
|
val currentUntransportedUnits = tile.getUnits().count { it.type.isAirUnit() && !it.isTransported }
|
||||||
|
// Tile units includes us, we were just added
|
||||||
|
isTransported = currentUntransportedUnits > tile.getCity()!!.getMaxAirUnits()
|
||||||
|
}
|
||||||
|
}
|
||||||
moveThroughTile(tile)
|
moveThroughTile(tile)
|
||||||
cache.updateUniques()
|
cache.updateUniques()
|
||||||
}
|
}
|
||||||
|
@ -602,7 +602,7 @@ class UnitMovement(val unit: MapUnit) {
|
|||||||
private fun canAirUnitMoveTo(tile: Tile, unit: MapUnit): Boolean {
|
private fun canAirUnitMoveTo(tile: Tile, unit: MapUnit): Boolean {
|
||||||
// landing in the city
|
// landing in the city
|
||||||
if (tile.isCityCenter()) {
|
if (tile.isCityCenter()) {
|
||||||
if (tile.airUnits.filter { !it.isTransported }.size < 6 && tile.getCity()?.civ == unit.civ)
|
if (tile.airUnits.filter { !it.isTransported }.size < tile.getCity()!!.getMaxAirUnits() && tile.getCity()?.civ == unit.civ)
|
||||||
return true // if city is free - no problem, get in
|
return true // if city is free - no problem, get in
|
||||||
} // let's check whether it enters city on carrier now...
|
} // let's check whether it enters city on carrier now...
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user