Resolve #7869 - limit the number of workers an AI creates

This commit is contained in:
Yair Morgenstern
2023-01-09 18:45:55 +02:00
parent da82dcf559
commit bf1e613bdd

View File

@ -171,8 +171,11 @@ class ConstructionAutomation(val cityConstructions: CityConstructions){
}.isBuildable()
if (workerEquivalents.none()) return // for mods with no worker units
if (workers < cities) {
var modifier = cities / (workers + 0.1f) // The worse our worker to city ratio is, the more desperate we are
// For the first 3 cities, dedicate a worker, from then on only build another worker if you have 12 cities.
val numberOfWorkersWeWant = if (cities < 4) cities else max(3, cities/3)
if (workers < numberOfWorkersWeWant) {
var modifier = numberOfWorkersWeWant / (workers + 0.1f) // The worse our worker to city ratio is, the more desperate we are
if (!cityIsOverAverageProduction) modifier /= 5 // higher production cities will deal with this
addChoice(relativeCostEffectiveness, workerEquivalents.minByOrNull { it.cost }!!.name, modifier)
}