mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-22 22:00:24 +07:00
Fixed : AI city under seige change production every turn.
This commit is contained in:

committed by
Yair Morgenstern

parent
d5b247e2c1
commit
307aea1cc0
@ -52,6 +52,8 @@ class Automation {
|
|||||||
|
|
||||||
fun chooseMilitaryUnit(city: CityInfo) : String {
|
fun chooseMilitaryUnit(city: CityInfo) : String {
|
||||||
val militaryUnits = city.cityConstructions.getConstructableUnits().filter { !it.unitType.isCivilian() }
|
val militaryUnits = city.cityConstructions.getConstructableUnits().filter { !it.unitType.isCivilian() }
|
||||||
|
if (militaryUnits.map { it.name }.contains(city.cityConstructions.currentConstruction))
|
||||||
|
return city.cityConstructions.currentConstruction
|
||||||
val chosenUnit: BaseUnit
|
val chosenUnit: BaseUnit
|
||||||
if(!city.civInfo.isAtWar() && city.civInfo.cities.any { it.getCenterTile().militaryUnit==null}
|
if(!city.civInfo.isAtWar() && city.civInfo.cities.any { it.getCenterTile().militaryUnit==null}
|
||||||
&& militaryUnits.any { it.unitType== UnitType.Ranged }) // this is for city defence so get an archery unit if we can
|
&& militaryUnits.any { it.unitType== UnitType.Ranged }) // this is for city defence so get an archery unit if we can
|
||||||
|
Reference in New Issue
Block a user