mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-25 21:03:15 -04:00
Resolve #7869 - limit the number of workers an AI creates
This commit is contained in:
parent
da82dcf559
commit
bf1e613bdd
@ -171,8 +171,11 @@ class ConstructionAutomation(val cityConstructions: CityConstructions){
|
|||||||
}.isBuildable()
|
}.isBuildable()
|
||||||
if (workerEquivalents.none()) return // for mods with no worker units
|
if (workerEquivalents.none()) return // for mods with no worker units
|
||||||
|
|
||||||
if (workers < cities) {
|
// For the first 3 cities, dedicate a worker, from then on only build another worker if you have 12 cities.
|
||||||
var modifier = cities / (workers + 0.1f) // The worse our worker to city ratio is, the more desperate we are
|
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
|
if (!cityIsOverAverageProduction) modifier /= 5 // higher production cities will deal with this
|
||||||
addChoice(relativeCostEffectiveness, workerEquivalents.minByOrNull { it.cost }!!.name, modifier)
|
addChoice(relativeCostEffectiveness, workerEquivalents.minByOrNull { it.cost }!!.name, modifier)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user