mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-16 02:40:41 +07:00
Added Happiness (and Faith for Religion mods) to stats list - #3524
This commit is contained in:
@ -31,10 +31,11 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
|
|||||||
innerTable.clear()
|
innerTable.clear()
|
||||||
|
|
||||||
val ministatsTable = Table()
|
val ministatsTable = Table()
|
||||||
for (stat in cityInfo.cityStats.currentCityStats.toHashMap()) {
|
for ((stat, amount) in cityInfo.cityStats.currentCityStats.toHashMap()) {
|
||||||
if (stat.key == Stat.Happiness || stat.key == Stat.Faith) continue
|
if (stat == Stat.Faith && !cityInfo.getRuleset().hasReligion()) continue
|
||||||
ministatsTable.add(ImageGetter.getStatIcon(stat.key.name)).size(20f).padRight(5f)
|
ministatsTable.add(ImageGetter.getStatIcon(stat.name)).size(20f).padRight(5f)
|
||||||
ministatsTable.add(round(stat.value).toInt().toString().toLabel()).padRight(10f)
|
val valueToDisplay = if (stat == Stat.Happiness) cityInfo.cityStats.happinessList.values.sum() else amount
|
||||||
|
ministatsTable.add(round(valueToDisplay).toInt().toString().toLabel()).padRight(10f)
|
||||||
}
|
}
|
||||||
innerTable.add(ministatsTable)
|
innerTable.add(ministatsTable)
|
||||||
|
|
||||||
@ -47,8 +48,8 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun addText() {
|
private fun addText() {
|
||||||
val unassignedPopString = "{Unassigned population}:".tr() +
|
val unassignedPopString = "{Unassigned population}: ".tr() +
|
||||||
" " + cityInfo.population.getFreePopulation().toString() + "/" + cityInfo.population.population
|
cityInfo.population.getFreePopulation().toString() + "/" + cityInfo.population.population
|
||||||
|
|
||||||
var turnsToExpansionString =
|
var turnsToExpansionString =
|
||||||
if (cityInfo.cityStats.currentCityStats.culture > 0 && cityInfo.expansion.chooseNewTileToOwn() != null) {
|
if (cityInfo.cityStats.currentCityStats.culture > 0 && cityInfo.expansion.chooseNewTileToOwn() != null) {
|
||||||
@ -56,23 +57,21 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
|
|||||||
var turnsToExpansion = ceil(remainingCulture / cityInfo.cityStats.currentCityStats.culture).toInt()
|
var turnsToExpansion = ceil(remainingCulture / cityInfo.cityStats.currentCityStats.culture).toInt()
|
||||||
if (turnsToExpansion < 1) turnsToExpansion = 1
|
if (turnsToExpansion < 1) turnsToExpansion = 1
|
||||||
"[$turnsToExpansion] turns to expansion".tr()
|
"[$turnsToExpansion] turns to expansion".tr()
|
||||||
} else {
|
} else "Stopped expansion".tr()
|
||||||
"Stopped expansion".tr()
|
|
||||||
}
|
|
||||||
if (cityInfo.expansion.chooseNewTileToOwn() != null)
|
if (cityInfo.expansion.chooseNewTileToOwn() != null)
|
||||||
turnsToExpansionString += " (" + cityInfo.expansion.cultureStored + "/" +
|
turnsToExpansionString +=
|
||||||
cityInfo.expansion.getCultureToNextTile() + ")"
|
" (${cityInfo.expansion.cultureStored}/${cityInfo.expansion.getCultureToNextTile()})"
|
||||||
|
|
||||||
var turnsToPopString =
|
var turnsToPopString =
|
||||||
when {
|
when {
|
||||||
cityInfo.isGrowing() -> "[${cityInfo.getNumTurnsToNewPopulation()}] turns to new population".tr()
|
cityInfo.isGrowing() -> "[${cityInfo.getNumTurnsToNewPopulation()}] turns to new population"
|
||||||
cityInfo.isStarving() -> "[${cityInfo.getNumTurnsToStarvation()}] turns to lose population".tr()
|
cityInfo.isStarving() -> "[${cityInfo.getNumTurnsToStarvation()}] turns to lose population"
|
||||||
cityInfo.getRuleset().units[cityInfo.cityConstructions.currentConstructionFromQueue]
|
cityInfo.getRuleset().units[cityInfo.cityConstructions.currentConstructionFromQueue]
|
||||||
.let { it != null && it.uniques.contains("Excess Food converted to Production when under construction") }
|
.let { it != null && it.uniques.contains("Excess Food converted to Production when under construction") }
|
||||||
-> "Food converts to production".tr()
|
-> "Food converts to production"
|
||||||
else -> "Stopped population growth".tr()
|
else -> "Stopped population growth"
|
||||||
}
|
}.tr()
|
||||||
turnsToPopString += " (" + cityInfo.population.foodStored + "/" + cityInfo.population.getFoodToNextPopulation() + ")"
|
turnsToPopString += " (${cityInfo.population.foodStored}/${cityInfo.population.getFoodToNextPopulation()})"
|
||||||
|
|
||||||
innerTable.add(unassignedPopString.toLabel()).row()
|
innerTable.add(unassignedPopString.toLabel()).row()
|
||||||
innerTable.add(turnsToExpansionString.toLabel()).row()
|
innerTable.add(turnsToExpansionString.toLabel()).row()
|
||||||
|
Reference in New Issue
Block a user