More era-related fixes

This commit is contained in:
Yair Morgenstern 2020-04-17 15:26:24 +03:00
parent eba7dc8c8c
commit 30fc110d67
7 changed files with 26 additions and 20 deletions

View File

@ -64,6 +64,12 @@ object Constants {
const val scienceConversionEffect = "Production to science conversion in cities increased by 33%" const val scienceConversionEffect = "Production to science conversion in cities increased by 33%"
const val ancientEra="Ancient era" const val ancientEra = "Ancient era"
const val futureEra="Future era" const val classicalEra = "Classical era"
const val medievalEra = "Medieval era"
const val renaissanceEra = "Renaissance era"
const val industrialEra = "Industrial era"
const val modernEra = "Modern era"
const val informationEra = "Information era"
const val futureEra = "Future era"
} }

View File

@ -524,10 +524,10 @@ class CivilizationInfo {
fun getResearchAgreementCost(otherCiv: CivilizationInfo): Int { fun getResearchAgreementCost(otherCiv: CivilizationInfo): Int {
// https://forums.civfanatics.com/resources/research-agreements-bnw.25568/ // https://forums.civfanatics.com/resources/research-agreements-bnw.25568/
val basicGoldCostOfSignResearchAgreement = when(getEra()){ val basicGoldCostOfSignResearchAgreement = when(getEra()){
"Medieval era", "Renaissance era" -> 250 Constants.medievalEra, Constants.renaissanceEra -> 250
"Industrial era" -> 300 Constants.industrialEra -> 300
"Modern era" -> 350 Constants.modernEra -> 350
"Information era", Constants.futureEra -> 400 Constants.informationEra, Constants.futureEra -> 400
else -> 0 else -> 0
} }
return (basicGoldCostOfSignResearchAgreement * gameInfo.gameParameters.gameSpeed.modifier).toInt() return (basicGoldCostOfSignResearchAgreement * gameInfo.gameParameters.gameSpeed.modifier).toInt()

View File

@ -98,5 +98,5 @@ class Technology {
return name return name
} }
fun era() = column!!.era fun era(): String = column!!.era
} }

View File

@ -158,8 +158,6 @@ class NewGameScreenOptionsTable(val newGameScreen: NewGameScreen, val updatePlay
} }
private fun addEraSelectBox() { private fun addEraSelectBox() {
// The eras enum values are "Medieval" etc. but are shown to the player as "Medieval era".tr()
// because in other languages "Medieval era" is one word
val eras = ruleset.technologies.values.map { it.era() }.distinct() val eras = ruleset.technologies.values.map { it.era() }.distinct()
addSelectBox("{Starting Era}:", eras, newGameParameters.startingEra) addSelectBox("{Starting Era}:", eras, newGameParameters.startingEra)
{ newGameParameters.startingEra = it } { newGameParameters.startingEra = it }

View File

@ -98,7 +98,7 @@ class PolicyPickerScreen(val worldScreen: WorldScreen, civInfo: CivilizationInfo
if(policy.requires!!.isNotEmpty()) if(policy.requires!!.isNotEmpty())
policyText += "{Requires} ".tr() + policy.requires!!.joinToString { it.tr() } policyText += "{Requires} ".tr() + policy.requires!!.joinToString { it.tr() }
else else
policyText += ("{Unlocked at} {"+policy.branch.era.toString()+" era}").tr() policyText += ("{Unlocked at} {"+ policy.branch.era+"}").tr()
} }
descriptionLabel.setText(policyText) descriptionLabel.setText(policyText)
} }

View File

@ -114,7 +114,7 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
} }
val friendBonusText = when (otherCiv.getCityStateType()) { val friendBonusText = when (otherCiv.getCityStateType()) {
CityStateType.Cultured -> ("Provides [" + (3 * (viewingCiv.getEra().ordinal + 1)).toString() + "] culture at 30 Influence").tr() CityStateType.Cultured -> ("Provides [" + (3 * (viewingCiv.getEraNumber() + 1)).toString() + "] culture at 30 Influence").tr()
CityStateType.Maritime -> "Provides 3 food in capital and 1 food in other cities at 30 Influence".tr() CityStateType.Maritime -> "Provides 3 food in capital and 1 food in other cities at 30 Influence".tr()
CityStateType.Mercantile -> "Provides 3 happiness at 30 Influence".tr() CityStateType.Mercantile -> "Provides 3 happiness at 30 Influence".tr()
CityStateType.Militaristic -> "Provides land units every 20 turns at 30 Influence".tr() CityStateType.Militaristic -> "Provides land units every 20 turns at 30 Influence".tr()

View File

@ -12,6 +12,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.scenes.scene2d.utils.Drawable import com.badlogic.gdx.scenes.scene2d.utils.Drawable
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable
import com.badlogic.gdx.utils.Align import com.badlogic.gdx.utils.Align
import com.sun.xml.internal.bind.v2.runtime.reflect.opt.Const
import com.unciv.Constants import com.unciv.Constants
import com.unciv.models.ruleset.Nation import com.unciv.models.ruleset.Nation
import com.unciv.models.ruleset.Ruleset import com.unciv.models.ruleset.Ruleset
@ -221,15 +222,16 @@ object ImageGetter {
fun getTechIconGroup(techName: String, circleSize: Float): Group { fun getTechIconGroup(techName: String, circleSize: Float): Group {
var techIconColor = Color.WHITE var techIconColor = Color.WHITE
when (ruleset.technologies[techName]!!.era().name) { when (ruleset.technologies[techName]!!.era()) {
"Ancient" -> techIconColor = colorFromRGB(255, 87, 35) Constants.ancientEra -> techIconColor = colorFromRGB(255, 87, 35)
"Classical" -> techIconColor = colorFromRGB(233, 31, 99) Constants.classicalEra -> techIconColor = colorFromRGB(233, 31, 99)
"Medieval" -> techIconColor = colorFromRGB(157, 39, 176) Constants.medievalEra -> techIconColor = colorFromRGB(157, 39, 176)
"Renaissance" -> techIconColor = colorFromRGB(104, 58, 183) Constants.renaissanceEra -> techIconColor = colorFromRGB(104, 58, 183)
"Industrial" -> techIconColor = colorFromRGB(63, 81, 182) Constants.industrialEra -> techIconColor = colorFromRGB(63, 81, 182)
"Modern" -> techIconColor = colorFromRGB(33, 150, 243) Constants.modernEra -> techIconColor = colorFromRGB(33, 150, 243)
"Information" -> techIconColor = colorFromRGB(0, 150, 136) Constants.informationEra -> techIconColor = colorFromRGB(0, 150, 136)
"Future" -> techIconColor = colorFromRGB(76,176,81) Constants.futureEra -> techIconColor = colorFromRGB(76,176,81)
else -> Color.WHITE
} }
return getImage("TechIcons/$techName").apply { color = techIconColor.lerp(Color.BLACK,0.6f) } return getImage("TechIcons/$techName").apply { color = techIconColor.lerp(Color.BLACK,0.6f) }
.surroundWithCircle(circleSize) .surroundWithCircle(circleSize)