mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 14:24:43 -04:00
Get going with producing military if your ass is about to get kicked. (#9109)
This commit is contained in:
parent
9e239de6ce
commit
8b01498227
@ -962,15 +962,21 @@ object NextTurnAutomation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun automateCities(civInfo: Civilization) {
|
private fun automateCities(civInfo: Civilization) {
|
||||||
|
val ownMilitaryStrength = civInfo.getStatForRanking(RankingType.Force)
|
||||||
|
val sumOfEnemiesMilitaryStrength = civInfo.gameInfo.civilizations.filter { it != civInfo }
|
||||||
|
.filter { civInfo.isAtWarWith(it) }.sumOf { it.getStatForRanking(RankingType.Force) }
|
||||||
|
val civHasSignificantlyWeakerMilitaryThanEnemies =
|
||||||
|
ownMilitaryStrength < sumOfEnemiesMilitaryStrength * 0.66f
|
||||||
for (city in civInfo.cities) {
|
for (city in civInfo.cities) {
|
||||||
if (city.isPuppet && city.population.population > 9
|
if (city.isPuppet && city.population.population > 9
|
||||||
&& !city.isInResistance()) {
|
&& !city.isInResistance()
|
||||||
|
) {
|
||||||
city.annexCity()
|
city.annexCity()
|
||||||
}
|
}
|
||||||
|
|
||||||
city.reassignAllPopulation()
|
city.reassignAllPopulation()
|
||||||
|
|
||||||
if (city.health < city.getMaxHealth()) {
|
if (city.health < city.getMaxHealth() || civHasSignificantlyWeakerMilitaryThanEnemies) {
|
||||||
Automation.tryTrainMilitaryUnit(city) // need defenses if city is under attack
|
Automation.tryTrainMilitaryUnit(city) // need defenses if city is under attack
|
||||||
if (city.cityConstructions.constructionQueue.isNotEmpty())
|
if (city.cityConstructions.constructionQueue.isNotEmpty())
|
||||||
continue // found a unit to build so move on
|
continue // found a unit to build so move on
|
||||||
|
Loading…
x
Reference in New Issue
Block a user