All era names changed to "... era" to fit in with what is actually translated and displayed

Removed Era enum - too restrictive to tech tree variations (atomic era, anyone?)
As a side bonus, mods can now add their own eras, that'll be interesting?
This commit is contained in:
Yair Morgenstern 2020-04-17 15:11:45 +03:00
parent 4c48cfe4f3
commit eba7dc8c8c
18 changed files with 78 additions and 61 deletions

View file

@ -1,7 +1,7 @@
[
{
"name": "Tradition",
"era": "Ancient",
"era": "Ancient era",
"effect": "+3 culture in capital and increased rate of border expansion",
"policies": [
{
@ -44,7 +44,7 @@
},
{
"name": "Liberty",
"era": "Ancient",
"era": "Ancient era",
"effect": "+1 culture in every city",
"policies": [
{
@ -88,7 +88,7 @@
},
{
"name": "Honor",
"era": "Ancient",
"era": "Ancient era",
"effect": "+25% bonus vs Barbarians; gain Culture when you kill a barbarian unit",
"policies": [
{
@ -131,7 +131,7 @@
]
},{
"name": "Piety",
"era": "Classical",
"era": "Classical era",
"effect": "Building time of culture buildings reduced by 15%",
"policies": [
{
@ -174,7 +174,7 @@
]
},/*{
"name": "Patronage",
"era": "Classical",
"era": "Classical era",
"effect": "Influence with City-States degrades 25% slower than normal",
"policies": [
{
@ -219,7 +219,7 @@
{
"name": "Commerce",
"effect": "+25% gold in capital",
"era": "Medieval",
"era": "Medieval era",
"policies": [
{
"name": "Trade Unions",
@ -262,7 +262,7 @@
},
{
"name": "Rationalism",
"era": "Renaissance",
"era": "Renaissance era",
"effect": "Production to science conversion in cities increased by 33%",
"policies": [
{
@ -306,7 +306,7 @@
},
/*{
"name": "Order",
"era": "Industrial",
"era": "Industrial era",
"effect": "+1 Happiness per City",
"policies": [
{
@ -349,7 +349,7 @@
},*/
{
"name": "Freedom",
"era": "Renaissance",
"era": "Renaissance era",
"effect": "+25% great people rate",
"policies": [
{
@ -392,7 +392,7 @@
},
{
"name": "Autocracy",
"era": "Industrial",
"era": "Industrial era",
"effect": "-33% unit upkeep costs",
"policies": [
{

View file

@ -1,7 +1,7 @@
[
{
"columnNumber": 0,
"era": "Ancient",
"era": "Ancient era",
"techCost": 20,
"buildingCost": 40,
"techs": [
@ -15,7 +15,7 @@
},
{
"columnNumber": 1,
"era": "Ancient",
"era": "Ancient era",
"techCost": 35,
"buildingCost": 60,
"techs": [
@ -48,7 +48,7 @@
},
{
"columnNumber": 2,
"era": "Ancient",
"era": "Ancient era",
"techCost": 55,
"buildingCost": 75,
"wonderCost": 185,
@ -99,7 +99,7 @@
},
{
"columnNumber": 3,
"era": "Classical",
"era": "Classical era",
"techCost": 105,
"buildingCost": 100,
"wonderCost": 250,
@ -134,7 +134,7 @@
},
{
"columnNumber": 4,
"era": "Classical",
"era": "Classical era",
"techCost": 175,
"buildingCost": 120,
"wonderCost": 300,
@ -167,7 +167,7 @@
},
{
"columnNumber": 5,
"era": "Medieval",
"era": "Medieval era",
"techCost": 275,
"buildingCost": 160,
"wonderCost": 400,
@ -202,7 +202,7 @@
},
{
"columnNumber": 6,
"era": "Medieval",
"era": "Medieval era",
"techCost": 485,
"buildingCost": 200,
"wonderCost": 500,
@ -250,7 +250,7 @@
},
{
"columnNumber": 7,
"era": "Renaissance",
"era": "Renaissance era",
"techCost": 780,
"buildingCost": 250,
"wonderCost": 625,
@ -290,7 +290,7 @@
},
{
"columnNumber": 8,
"era": "Renaissance",
"era": "Renaissance era",
"techCost": 1150,
"buildingCost": 300,
"wonderCost": 750,
@ -329,7 +329,7 @@
},
{
"columnNumber": 9,
"era": "Industrial",
"era": "Industrial era",
"techCost": 1600,
"buildingCost": 360,
"wonderCost": 920,
@ -374,7 +374,7 @@
},
{
"columnNumber": 10,
"era": "Industrial",
"era": "Industrial era",
"techCost": 2350,
"buildingCost": 500,
"wonderCost": 1060,
@ -408,7 +408,7 @@
},
{
"columnNumber": 11,
"era": "Modern",
"era": "Modern era",
"techCost": 3100,
"buildingCost": 500,
"wonderCost": 1250,
@ -447,7 +447,7 @@
},
{
"columnNumber": 12,
"era": "Modern",
"era": "Modern era",
"techCost": 4100,
"buildingCost": 500,
"wonderCost": 1250,
@ -480,7 +480,7 @@
},
{
"columnNumber": 13,
"era": "Information",
"era": "Information era",
"techCost": 5100,
"buildingCost": 500,
"wonderCost": 1250,
@ -513,7 +513,7 @@
},
{
"columnNumber": 14,
"era": "Information",
"era": "Information era",
"techCost": 6400,
"buildingCost": 750,
"wonderCost": 2000,
@ -547,7 +547,7 @@
},
{
"columnNumber": 15,
"era": "Future",
"era": "Future era",
"techCost": 7700,
"buildingCost": 750,
"wonderCost": 1250,
@ -581,7 +581,7 @@
{
"columnNumber": 16,
"era": "Future",
"era": "Future era",
"techCost": 8800,
"buildingCost": 750,
"wonderCost": 1250,
@ -602,7 +602,7 @@
},
{
"columnNumber": 17,
"era": "Future",
"era": "Future era",
"techCost": 9500,
"buildingCost": 750,
"wonderCost": 1250,

View file

@ -63,4 +63,7 @@ object Constants {
const val close = "Close"
const val scienceConversionEffect = "Production to science conversion in cities increased by 33%"
const val ancientEra="Ancient era"
const val futureEra="Future era"
}

View file

@ -26,7 +26,8 @@ class MapUnitCombatant(val unit: MapUnit) : ICombatant {
}
override fun getDefendingStrength(): Int {
if(unit.isEmbarked() && !unit.type.isCivilian()) return 5 * getCivInfo().getEra().ordinal
if(unit.isEmbarked() && !unit.type.isCivilian())
return 5 * getCivInfo().getEraNumber()
return unit.baseUnit().strength
}

View file

@ -81,7 +81,7 @@ class CivInfoStats(val civInfo: CivilizationInfo){
if (otherCiv.isCityState() && otherCiv.getCityStateType() == CityStateType.Cultured
&& otherCiv.getDiplomacyManager(civInfo.civName).relationshipLevel() >= RelationshipLevel.Friend) {
val cultureBonus = Stats()
var culture = 3f * (civInfo.getEra().ordinal+1)
var culture = 3f * (civInfo.getEraNumber()+1)
if(civInfo.nation.unique == UniqueAbility.FATHER_GOVERNS_CHILDREN)
culture*=1.5f
cultureBonus.add(Stat.Culture, culture)

View file

@ -2,6 +2,7 @@ package com.unciv.logic.civilization
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.math.Vector2
import com.sun.xml.internal.bind.v2.runtime.reflect.opt.Const
import com.unciv.Constants
import com.unciv.JsonParser
import com.unciv.UncivGame
@ -268,13 +269,17 @@ class CivilizationInfo {
&& !isBarbarian() // Barbarians can be never defeated
&& (citiesCreated > 0 || !getCivUnits().any { it.name == Constants.settler })
fun getEra(): TechEra {
fun getEra(): String {
val maxEraOfTech = tech.researchedTechnologies
.asSequence()
.map { it.era() }
.max()
if(maxEraOfTech!=null) return maxEraOfTech
else return TechEra.Ancient
.map { it.column!! }
.maxBy { it.columnNumber }!!
.era
return maxEraOfTech
}
fun getEraNumber(): Int {
return gameInfo.ruleSet.getEraNumber(getEra())
}
fun isAtWarWith(otherCiv:CivilizationInfo): Boolean {
@ -518,12 +523,11 @@ class CivilizationInfo {
fun getResearchAgreementCost(otherCiv: CivilizationInfo): Int {
// https://forums.civfanatics.com/resources/research-agreements-bnw.25568/
val highestEra = sequenceOf(getEra(),otherCiv.getEra()).maxBy { it.ordinal }!!
val basicGoldCostOfSignResearchAgreement = when(highestEra){
TechEra.Medieval, TechEra.Renaissance -> 250
TechEra.Industrial -> 300
TechEra.Modern -> 350
TechEra.Information, TechEra.Future -> 400
val basicGoldCostOfSignResearchAgreement = when(getEra()){
"Medieval era", "Renaissance era" -> 250
"Industrial era" -> 300
"Modern era" -> 350
"Information era", Constants.futureEra -> 400
else -> 0
}
return (basicGoldCostOfSignResearchAgreement * gameInfo.gameParameters.gameSpeed.modifier).toInt()

View file

@ -86,7 +86,7 @@ class PolicyManager {
if(isAdopted(policy.name)) return false
if (policy.name.endsWith("Complete")) return false
if (!getAdoptedPolicies().containsAll(policy.requires!!)) return false
if (policy.branch.era > civInfo.getEra()) return false
if (civInfo.gameInfo.ruleSet.getEraNumber(policy.branch.era) > civInfo.getEraNumber()) return false
return true
}

View file

@ -223,12 +223,12 @@ class TechManager {
civInfo.popupAlerts.add(PopupAlert(AlertType.TechResearched,techName))
val currentEra = civInfo.getEra()
if (previousEra < currentEra) {
civInfo.addNotification("You have entered the [$currentEra era]!", null, Color.GOLD)
if (previousEra != currentEra) {
civInfo.addNotification("You have entered the [$currentEra]!", null, Color.GOLD)
if (civInfo.isMajorCiv()) {
for (knownCiv in civInfo.getKnownCivs()) {
knownCiv.addNotification(
"[${civInfo.civName}] has entered the [$currentEra era]!",
"[${civInfo.civName}] has entered the [$currentEra]!",
null,
Color.BLUE
)

View file

@ -570,7 +570,7 @@ class MapUnit {
.filter {
!civInfo.tech.isResearched(it.name)
&& civInfo.tech.canBeResearched(it.name)
&& it.era() == TechEra.Ancient
&& it.era() == Constants.ancientEra
}
if(researchableAncientEraTechs.isNotEmpty())
actions.add {

View file

@ -247,6 +247,6 @@ class TradeEvaluation{
}
fun evaluateResearchAgreementCostForThem(ourCivilization: CivilizationInfo, otherCivilization: CivilizationInfo): Int {
return -100 * (ourCivilization.getEra().ordinal-otherCivilization.getEra().ordinal)
return -100 * (ourCivilization.getEraNumber()-otherCivilization.getEraNumber())
}
}

View file

@ -1,5 +1,6 @@
package com.unciv.models.metadata
import com.unciv.Constants
import com.unciv.logic.civilization.PlayerType
import com.unciv.models.ruleset.VictoryType
import com.unciv.models.ruleset.tech.TechEra
@ -18,7 +19,7 @@ class GameParameters { // Default values are the default new game
var nuclearWeaponsEnabled = true
var victoryTypes: ArrayList<VictoryType> = VictoryType.values().toCollection(ArrayList()) // By default, all victory types
var startingEra = TechEra.Ancient
var startingEra = Constants.ancientEra
var isOnlineMultiplayer = false
var mods = LinkedHashSet<String>()

View file

@ -4,5 +4,5 @@ import com.unciv.models.ruleset.tech.TechEra
class PolicyBranch : Policy() {
var policies: ArrayList<Policy> = arrayListOf()
lateinit var era: TechEra
lateinit var era: String
}

View file

@ -166,6 +166,12 @@ class Ruleset {
}
}
}
fun getEras(): List<String> {
return technologies.values.map { it.column!!.era }.distinct()
}
fun getEraNumber(era:String) = getEras().indexOf(era)
}
/** Loading mods is expensive, so let's only do it once and

View file

@ -4,7 +4,7 @@ import java.util.*
class TechColumn {
var columnNumber: Int = 0
lateinit var era: TechEra
lateinit var era: String
var techs = ArrayList<Technology>()
var techCost: Int = 0
var buildingCost: Int = 0

View file

@ -1,6 +1,6 @@
package com.unciv.models.ruleset.tech
enum class TechEra{
enum class TechEra {
Ancient,
Classical,
Medieval,

View file

@ -160,8 +160,9 @@ class NewGameScreenOptionsTable(val newGameScreen: NewGameScreen, val updatePlay
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
addSelectBox("{Starting Era}:", TechEra.values().map { it.name + " era" }, newGameParameters.startingEra.name + " era")
{newGameParameters.startingEra = TechEra.valueOf(it.replace(" era", ""))}
val eras = ruleset.technologies.values.map { it.era() }.distinct()
addSelectBox("{Starting Era}:", eras, newGameParameters.startingEra)
{ newGameParameters.startingEra = it }
}

View file

@ -82,18 +82,19 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec
}
private fun createTechTable() {
val columns = civInfo.gameInfo.ruleSet.technologies.values.map { it.column!!.columnNumber}.max()!! +1
val allTechs = civInfo.gameInfo.ruleSet.technologies.values
val columns = allTechs.map { it.column!!.columnNumber}.max()!! +1
val techMatrix = Array<Array<Technology?>>(columns) { arrayOfNulls(10) } // Divided into columns, then rows
for (technology in civInfo.gameInfo.ruleSet.technologies.values) {
for (technology in allTechs) {
techMatrix[technology.column!!.columnNumber][technology.row - 1] = technology
}
val erasName = arrayOf("Ancient","Classical","Medieval","Renaissance","Industrial","Modern","Information","Future")
for (i in 0..7) {
val j = if (erasName[i]!="Ancient" && erasName[i]!="Future") 2 else 3
if (i%2==0) topTable.add((erasName[i]+" era").toLabel().addBorder(2f, Color.BLUE)).fill().colspan(j)
else topTable.add((erasName[i]+" era").toLabel().addBorder(2f, Color.FIREBRICK)).fill().colspan(j)
val erasName = allTechs.map { it.era() }.distinct()
for ((i,eraName) in erasName.withIndex()) {
val columnSpan = if (eraName != Constants.ancientEra && eraName != Constants.futureEra) 2 else 3
val color = if (i % 2 == 0) Color.BLUE else Color.FIREBRICK
topTable.add(eraName.toLabel().addBorder(2f, color)).fill().colspan(columnSpan)
}
for (i in 0..9) {

View file

@ -333,7 +333,7 @@ object UnitActions {
uncivSound = UncivSound.Chimes,
action = {
// http://civilization.wikia.com/wiki/Great_Merchant_(Civ5)
var goldEarned = (350 + 50 * unit.civInfo.getEra().ordinal) * unit.civInfo.gameInfo.gameParameters.gameSpeed.modifier
var goldEarned = (350 + 50 * unit.civInfo.getEraNumber()) * unit.civInfo.gameInfo.gameParameters.gameSpeed.modifier
if (unit.civInfo.policies.isAdopted("Commerce Complete"))
goldEarned *= 2
unit.civInfo.gold += goldEarned.toInt()