Resolved #1229 - AI doesn't choose to construct workers if the Civ has idle automated workers

This commit is contained in:
Yair Morgenstern 2019-10-24 21:57:24 +03:00
parent 7d1fd6e177
commit 6fb3ba0f13

View file

@ -112,6 +112,8 @@ class ConstructionAutomation(val cityConstructions: CityConstructions){
}
private fun addWorkerChoice() {
if(civInfo.getIdleUnits().any { it.name==Constants.worker && it.action== Constants.unitActionAutomation})
return // If we have automated workers who have no work to do then it's silly to construct new workers.
val citiesCountedTowardsWorkers = min(5, cities) // above 5 cities, extra cities won't make us want more workers
if (workers < citiesCountedTowardsWorkers * 0.6f && civUnits.none { it.name==Constants.worker && it.isIdle() }) {
var modifier = citiesCountedTowardsWorkers / (workers + 0.1f)