mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 11:28:03 +07:00
Cities conquered in battle lose population
This commit is contained in:
parent
376ae64e77
commit
9b38d0c33e
@ -218,6 +218,7 @@ class UnitAutomation{
|
||||
}
|
||||
|
||||
private fun tryGarrisoningUnit(unit: MapUnit): Boolean {
|
||||
if(unit.getBaseUnit().unitType.isMelee()) return false // don't garrison melee units, they're not that good at it
|
||||
val reachableCitiesWithoutUnits = unit.civInfo.cities.filter {
|
||||
val centerTile = it.getCenterTile()
|
||||
unit.canMoveTo(centerTile)
|
||||
|
@ -106,6 +106,8 @@ class Battle(val gameInfo:GameInfo=UnCivGame.Current.gameInfo) {
|
||||
private fun conquerCity(city: CityInfo, attacker: ICombatant) {
|
||||
val enemyCiv = city.civInfo
|
||||
attacker.getCivilization().addNotification("We have conquered the city of [${city.name}]!",city.location, Color.RED)
|
||||
val currentPopulation = city.population.population
|
||||
if(currentPopulation>1) city.population.population -= 1 + currentPopulation/4 // so from 2-4 population, remove 1, from 5-8, remove 2, etc.
|
||||
city.moveToCiv(attacker.getCivilization())
|
||||
city.health = city.getMaxHealth() / 2 // I think that cities recover to half health when conquered?
|
||||
city.getCenterTile().apply {
|
||||
|
@ -28,7 +28,8 @@ class MapUnit {
|
||||
fun getBaseUnit(): BaseUnit = GameBasics.Units[name]!!
|
||||
fun getMovementString(): String = DecimalFormat("0.#").format(currentMovement.toDouble()) + "/" + maxMovement
|
||||
|
||||
@Transient private lateinit var currentTile :TileInfo
|
||||
@Transient
|
||||
internal lateinit var currentTile :TileInfo
|
||||
fun getTile(): TileInfo = currentTile
|
||||
|
||||
fun getDistanceToTiles(): HashMap<TileInfo, Float> {
|
||||
|
Loading…
Reference in New Issue
Block a user