mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-30 14:48:56 +07:00
Priority tuning part 1.
This commit is contained in:
@ -85,13 +85,13 @@ class Automation {
|
|||||||
val cityProduction = cityInfo.cityStats.currentCityStats.production.toFloat()
|
val cityProduction = cityInfo.cityStats.currentCityStats.production.toFloat()
|
||||||
|
|
||||||
var buildingValues = HashMap<String, Float>()
|
var buildingValues = HashMap<String, Float>()
|
||||||
//Food buildings : Ganary and lighthouse and hospital
|
//Food buildings : Granary and lighthouse and hospital
|
||||||
val foodBuilding = buildableNotWonders.filter { it.food>0
|
val foodBuilding = buildableNotWonders.filter { it.food>0
|
||||||
|| (it.resourceBonusStats!=null && it.resourceBonusStats!!.food>0) }
|
|| (it.resourceBonusStats!=null && it.resourceBonusStats!!.food>0) }
|
||||||
.minBy{it.cost}
|
.minBy{ it.cost }
|
||||||
if (foodBuilding!=null) {
|
if (foodBuilding!=null) {
|
||||||
buildingValues[foodBuilding.name] = foodBuilding.cost / cityProduction
|
buildingValues[foodBuilding.name] = foodBuilding.cost / cityProduction
|
||||||
if (cityInfo.population.population < buildingValues[foodBuilding.name]!!.toInt()) {
|
if (cityInfo.population.population < foodBuilding.food + 5) {
|
||||||
buildingValues[foodBuilding.name] = buildingValues[foodBuilding.name]!! / 2.0f
|
buildingValues[foodBuilding.name] = buildingValues[foodBuilding.name]!! / 2.0f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -134,8 +134,8 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Wonders
|
//Wonders
|
||||||
val wonder = buildableWonders.minBy { it.cost }
|
if (buildableWonders.isNotEmpty()) {
|
||||||
if (wonder!=null) {
|
val wonder = buildableWonders.getRandom()
|
||||||
buildingValues[wonder.name] = wonder.cost / cityProduction / 4.0f
|
buildingValues[wonder.name] = wonder.cost / cityProduction / 4.0f
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,20 +148,20 @@ class Automation {
|
|||||||
//worker
|
//worker
|
||||||
if (workers<(cities+1)/2) {
|
if (workers<(cities+1)/2) {
|
||||||
buildingValues[CityConstructions.Worker] =
|
buildingValues[CityConstructions.Worker] =
|
||||||
buildableUnits.first{ it.name == CityConstructions.Worker }!!.cost / cityProduction *
|
buildableUnits.first{ it.name == CityConstructions.Worker }.cost / cityProduction *
|
||||||
(workers/(cities+1))
|
(workers/(cities+1))
|
||||||
}
|
}
|
||||||
|
|
||||||
//Work boat
|
//Work boat
|
||||||
if (needWorkboat) {
|
if (needWorkboat) {
|
||||||
buildingValues["Work Boats"] =
|
buildingValues["Work Boats"] =
|
||||||
buildableUnits.first{ it.name == "Work Boats" }!!.cost / cityProduction
|
buildableUnits.first{ it.name == "Work Boats" }.cost / cityProduction * 1.5f
|
||||||
}
|
}
|
||||||
|
|
||||||
//Army
|
//Army
|
||||||
val militaryUnit = chooseCombatUnit(cityInfo)
|
val militaryUnit = chooseCombatUnit(cityInfo)
|
||||||
buildingValues[militaryUnit] =
|
buildingValues[militaryUnit] =
|
||||||
buildableUnits.first{ it.name == militaryUnit }!!.cost / cityProduction * 2.0f *
|
buildableUnits.first{ it.name == militaryUnit }.cost / cityProduction * 2.0f *
|
||||||
(militaryUnits/(cities+1))
|
(militaryUnits/(cities+1))
|
||||||
if (isAtWar) {
|
if (isAtWar) {
|
||||||
buildingValues[militaryUnit] = buildingValues[militaryUnit]!! / 3.0f
|
buildingValues[militaryUnit] = buildingValues[militaryUnit]!! / 3.0f
|
||||||
|
Reference in New Issue
Block a user