mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-23 14:19:15 +07:00
Stop AI puppets from building settlers and military (#7129)
* Stop puppeted cities from building settlers and military * Move puppet check to function
This commit is contained in:

committed by
GitHub

parent
d34fa7db3d
commit
72b197fdc3
@ -106,6 +106,7 @@ object Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun tryTrainMilitaryUnit(city: CityInfo) {
|
fun tryTrainMilitaryUnit(city: CityInfo) {
|
||||||
|
if (city.isPuppet) return
|
||||||
val chosenUnitName = chooseMilitaryUnit(city)
|
val chosenUnitName = chooseMilitaryUnit(city)
|
||||||
if (chosenUnitName != null)
|
if (chosenUnitName != null)
|
||||||
city.cityConstructions.currentConstructionFromQueue = chosenUnitName
|
city.cityConstructions.currentConstructionFromQueue = chosenUnitName
|
||||||
|
@ -878,7 +878,7 @@ object NextTurnAutomation {
|
|||||||
currentConstruction is BaseUnit && currentConstruction.hasUnique(UniqueType.FoundCity)
|
currentConstruction is BaseUnit && currentConstruction.hasUnique(UniqueType.FoundCity)
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
val bestCity = civInfo.cities.maxByOrNull { it.cityStats.currentCityStats.production }!!
|
val bestCity = civInfo.cities.filterNot { it.isPuppet }.maxByOrNull { it.cityStats.currentCityStats.production }!!
|
||||||
if (bestCity.cityConstructions.builtBuildings.size > 1) // 2 buildings or more, otherwise focus on self first
|
if (bestCity.cityConstructions.builtBuildings.size > 1) // 2 buildings or more, otherwise focus on self first
|
||||||
bestCity.cityConstructions.currentConstructionFromQueue = settlerUnits.minByOrNull { it.cost }!!.name
|
bestCity.cityConstructions.currentConstructionFromQueue = settlerUnits.minByOrNull { it.cost }!!.name
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user