mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-22 02:07:43 +07:00
Water units can enter cities
This commit is contained in:
parent
f19750409d
commit
a677850084
@ -192,6 +192,12 @@ class CityInfo {
|
||||
}
|
||||
|
||||
fun destroyCity() {
|
||||
// Edge case! What if a water unit is in a city, and you raze the city?
|
||||
// Well, the water unit has to return to the water!
|
||||
for(unit in getCenterTile().getUnits())
|
||||
if(!unit.canPassThrough(getCenterTile()))
|
||||
unit.movementAlgs().teleportToClosestMoveableTile()
|
||||
|
||||
civInfo.cities = civInfo.cities.toMutableList().apply { remove(this@CityInfo) }
|
||||
getTiles().forEach { expansion.relinquishOwnership(it) }
|
||||
getCenterTile().improvement="City ruins"
|
||||
|
@ -134,7 +134,7 @@ class MapUnit {
|
||||
val tileOwner = tile.getOwner()
|
||||
|
||||
if(tile.getBaseTerrain().impassable) return false
|
||||
if(tile.isLand() && type.isWaterUnit())
|
||||
if(tile.isLand() && type.isWaterUnit() && !tile.isCityCenter())
|
||||
return false
|
||||
|
||||
val isOcean = tile.baseTerrain == "Ocean"
|
||||
|
@ -7,8 +7,7 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
||||
|
||||
private fun getMovementCostBetweenAdjacentTiles(from: TileInfo, to: TileInfo): Float {
|
||||
|
||||
if(from.isLand() && to.isWater()
|
||||
|| from.isWater() && to.isLand())
|
||||
if(unit.type.isLandUnit() && (from.isLand() != to.isLand()))
|
||||
return 100f // this is embarkment or disembarkment, and will take the entire turn
|
||||
|
||||
if (from.roadStatus === RoadStatus.Railroad && to.roadStatus === RoadStatus.Railroad)
|
||||
|
Loading…
Reference in New Issue
Block a user