mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-31 15:19:29 +07:00
Resolve #7869 - limit the number of workers an AI creates
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user