mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-28 13:48:49 +07:00
Effect of rationalism was not visible in city UI: Translations patch (#2442)
* Effect of rationalism was not visible in city UI * Effect of rationalism was not visible in city UI - translations patch
This commit is contained in:
@ -61,4 +61,6 @@ object Constants {
|
||||
const val tutorialPopupNamePrefix = "Tutorial: "
|
||||
|
||||
const val close = "Close"
|
||||
|
||||
const val scienceConversionEffect = "Production to science conversion in cities increased by 33%"
|
||||
}
|
@ -64,7 +64,7 @@ class CityStats {
|
||||
"Gold" -> stats.gold += production / 4
|
||||
"Science" -> {
|
||||
var scienceProduced = production / 4
|
||||
if (cityInfo.civInfo.policies.hasEffect("Production to science conversion in cities increased by 33%")) scienceProduced *= 1.33f
|
||||
if (cityInfo.civInfo.policies.hasEffect(Constants.scienceConversionEffect)) scienceProduced *= 1.33f
|
||||
stats.science += scienceProduced
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.unciv.logic.city
|
||||
|
||||
import com.unciv.Constants
|
||||
import com.unciv.logic.civilization.CivilizationInfo
|
||||
import com.unciv.models.stats.INamed
|
||||
import com.unciv.models.translations.tr
|
||||
@ -17,19 +18,27 @@ interface IConstruction : INamed {
|
||||
|
||||
|
||||
|
||||
open class PerpetualConstruction(override var name: String, val description: String) : IConstruction{
|
||||
open class PerpetualConstruction(override var name: String, val description: String) : IConstruction {
|
||||
override fun shouldBeDisplayed(cityConstructions: CityConstructions): Boolean {
|
||||
return isBuildable(cityConstructions)
|
||||
}
|
||||
open fun getProductionTooltip(cityInfo: CityInfo) : String
|
||||
= "\r\n${(cityInfo.cityStats.currentCityStats.production / CONVERSION_RATE).roundToInt()}/${"{turn}".tr()}"
|
||||
open fun getConversionRate(cityInfo: CityInfo) : Int
|
||||
= CONVERSION_RATE
|
||||
|
||||
companion object {
|
||||
const val CONVERSION_RATE: Int = 4
|
||||
val science = object : PerpetualConstruction("Science", "Convert production to science at a rate of $CONVERSION_RATE to 1") {
|
||||
const val CONVERSION_RATE_WITH_POLICY = CONVERSION_RATE * 3 / 4
|
||||
val science = object : PerpetualConstruction("Science", "Convert production to science at a rate of [rate] to 1") {
|
||||
override fun isBuildable(cityConstructions: CityConstructions): Boolean {
|
||||
return cityConstructions.cityInfo.civInfo.tech.getTechUniques().contains("Enables conversion of city production to science")
|
||||
}
|
||||
override fun getProductionTooltip(cityInfo: CityInfo): String {
|
||||
return "\r\n${(cityInfo.cityStats.currentCityStats.production / getConversionRate(cityInfo)).roundToInt()}/${"{turn}".tr()}"
|
||||
}
|
||||
override fun getConversionRate(cityInfo: CityInfo): Int
|
||||
= if (cityInfo.civInfo.policies.hasEffect(Constants.scienceConversionEffect)) CONVERSION_RATE_WITH_POLICY else CONVERSION_RATE
|
||||
}
|
||||
val gold = object : PerpetualConstruction("Gold", "Convert production to gold at a rate of $CONVERSION_RATE to 1") {
|
||||
override fun isBuildable(cityConstructions: CityConstructions): Boolean {
|
||||
|
@ -66,7 +66,7 @@ class ConstructionInfoTable(val city: CityInfo): Table() {
|
||||
else if (construction is Building)
|
||||
description = construction.getDescription(true, city.civInfo, city.civInfo.gameInfo.ruleSet)
|
||||
else if(construction is PerpetualConstruction)
|
||||
description = construction.description.tr()
|
||||
description = construction.description.replace("[rate]","[${construction.getConversionRate(city)}]") .tr()
|
||||
else description="" // Should never happen
|
||||
|
||||
val descriptionLabel = description.toLabel()
|
||||
|
Reference in New Issue
Block a user