mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-25 21:03:15 -04:00
When disbanding carriers, transported air units move to nearby tiles if they can. If thy can't then they're disbanded.
This commit is contained in:
parent
7ac515ad6e
commit
f6b8afc952
@ -514,6 +514,14 @@ class MapUnit {
|
||||
if(currentTile.getOwner()==civInfo)
|
||||
civInfo.gold += baseUnit.getDisbandGold()
|
||||
if (civInfo.isDefeated()) civInfo.destroy()
|
||||
|
||||
for(unit in currentTile.getUnits().filter { it.type.isAirUnit() && it.isTransported }) {
|
||||
if (unit.movement.canMoveTo(currentTile)) continue // we disbanded a carrier in a city, it can still stay in the city
|
||||
val tileCanMoveTo = unit.currentTile.getTilesInDistance(unit.getRange())
|
||||
.firstOrNull{unit.movement.canMoveTo(it)}
|
||||
if(tileCanMoveTo!=null) unit.movement.moveToTile(tileCanMoveTo)
|
||||
else unit.disband()
|
||||
}
|
||||
}
|
||||
|
||||
private fun getAncientRuinBonus(tile: TileInfo) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user