mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-06 01:02:29 +07:00
Correct year shown when starting in later eras (#5070)
* json, getEquivalentTurn * WorldScreenTopBar.kt * affects shown year only
This commit is contained in:
parent
2993ffb272
commit
8cb464c9f7
@ -11,6 +11,7 @@
|
||||
"startingMilitaryUnit": "Warrior",
|
||||
"settlerPopulation": 1,
|
||||
"baseUnitBuyCost": 200,
|
||||
"startPercent": 0,
|
||||
"friendBonus": {
|
||||
"Cultured": ["Provides [3] [Culture] per turn"],
|
||||
"Maritime": ["Provides [2] [Food] [in capital]"],
|
||||
@ -36,6 +37,7 @@
|
||||
"startingCulture": 100,
|
||||
"settlerPopulation": 1,
|
||||
"baseUnitBuyCost": 200,
|
||||
"startPercent": 10,
|
||||
"friendBonus": {
|
||||
"Cultured": ["Provides [3] [Culture] per turn"],
|
||||
"Maritime": ["Provides [2] [Food] [in capital]"],
|
||||
@ -63,6 +65,7 @@
|
||||
"settlerBuildings": ["Shrine","Monument"],
|
||||
"startingObsoleteWonders": ["Temple of Artemis", "Stonehenge", "The Great Library", "Mausoleum of Halicarnassus", "The Pyramids", "Statue of Zeus"],
|
||||
"baseUnitBuyCost": 200,
|
||||
"startPercent": 25,
|
||||
"friendBonus": {
|
||||
"Cultured": ["Provides [6] [Culture] per turn"],
|
||||
"Maritime": ["Provides [2] [Food] [in capital]"],
|
||||
@ -91,6 +94,7 @@
|
||||
"startingObsoleteWonders": ["Temple of Artemis", "Stonehenge", "The Great Library", "Mausoleum of Halicarnassus", "The Pyramids", "Statue of Zeus",
|
||||
"The Great Lighthouse", "Hanging Gardens", "Terracotta Army", "The Oracle", "Petra", "Great Wall", "Colossus"],
|
||||
"baseUnitBuyCost": 300,
|
||||
"startPercent": 37,
|
||||
"friendBonus": {
|
||||
"Cultured": ["Provides [6] [Culture] per turn"],
|
||||
"Maritime": ["Provides [2] [Food] [in capital]"],
|
||||
@ -120,6 +124,7 @@
|
||||
"The Great Lighthouse", "Hanging Gardens", "Terracotta Army", "The Oracle", "Petra", "Great Wall", "Colossus",
|
||||
"Hagia Sophia", "Chichen Itza", "Machu Picchu", "Angkor Wat", "Alhambra", "Notre Dame"],
|
||||
"baseUnitBuyCost": 400,
|
||||
"startPercent": 50,
|
||||
"friendBonus": {
|
||||
"Cultured": ["Provides [13] [Culture] per turn"],
|
||||
"Maritime": ["Provides [2] [Food] [in capital]"],
|
||||
@ -150,6 +155,7 @@
|
||||
"Hagia Sophia", "Chichen Itza", "Machu Picchu", "Angkor Wat", "Alhambra", "Notre Dame",
|
||||
"Sistine Chapel", "Forbidden Palace", "Leaning Tower of Pisa", "Himeji Castle", "Taj Mahal", "Porcelain Tower", "Kremlin"],
|
||||
"baseUnitBuyCost": 600,
|
||||
"startPercent": 65,
|
||||
"friendBonus": {
|
||||
"Cultured": ["Provides [13] [Culture] per turn"],
|
||||
"Maritime": ["Provides [2] [Food] [in capital]"],
|
||||
@ -181,6 +187,7 @@
|
||||
"Sistine Chapel", "Forbidden Palace", "Leaning Tower of Pisa", "Himeji Castle", "Taj Mahal", "Porcelain Tower", "Kremlin",
|
||||
"The Louvre", "Big Ben", "Brandenburg Gate"],
|
||||
"baseUnitBuyCost": 800,
|
||||
"startPercent": 65,
|
||||
"friendBonus": {
|
||||
"Cultured": ["Provides [13] [Culture] per turn"],
|
||||
"Maritime": ["Provides [2] [Food] [in capital]"],
|
||||
@ -213,6 +220,7 @@
|
||||
"The Louvre", "Big Ben", "Brandenburg Gate",
|
||||
"Eiffel Tower", "Statue of Liberty", "Neuschwanstein", "Cristo Redentor"],
|
||||
"baseUnitBuyCost": 1000,
|
||||
"startPercent": 80,
|
||||
// So theoretically this is always just all the wonders at least 2 eras old. So we could just use that.
|
||||
// But where is the modularity? The excluding of very specific wonders? That is no fun.
|
||||
// So we just write down the entire long list (sorted by era!) instead.
|
||||
@ -250,6 +258,7 @@
|
||||
"The Louvre", "Big Ben", "Brandenburg Gate",
|
||||
"Eiffel Tower", "Statue of Liberty", "Neuschwanstein", "Cristo Redentor"],
|
||||
"baseUnitBuyCost": 1000,
|
||||
"startPercent": 80,
|
||||
"friendBonus": {
|
||||
"Cultured": ["Provides [13] [Culture] per turn"],
|
||||
"Maritime": ["Provides [2] [Food] [in capital]"],
|
||||
|
@ -20,6 +20,7 @@ class Era : INamed {
|
||||
var settlerBuildings = ArrayList<String>()
|
||||
var startingObsoleteWonders = ArrayList<String>()
|
||||
var baseUnitBuyCost = 200
|
||||
var startPercent = 0
|
||||
var friendBonus = HashMap<String, List<String>>()
|
||||
var allyBonus = HashMap<String, List<String>>()
|
||||
var iconRGB: List<Int>? = null
|
||||
|
@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||
import com.badlogic.gdx.scenes.scene2d.Group
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.*
|
||||
import com.unciv.logic.GameInfo
|
||||
import com.unciv.logic.civilization.CivilizationInfo
|
||||
import com.unciv.models.metadata.GameSpeed
|
||||
import com.unciv.models.ruleset.tile.ResourceType
|
||||
@ -200,7 +201,7 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() {
|
||||
else resourceLabels[resource.name]!!.setText(civResources.first { it.resource == resource }.amount.toString())
|
||||
}
|
||||
|
||||
val year = getYear(civInfo.gameInfo.gameParameters.gameSpeed, civInfo.gameInfo.turns).toInt()
|
||||
val year = getYear(civInfo.gameInfo.gameParameters.gameSpeed, getEquivalentTurn(civInfo.gameInfo)).toInt()
|
||||
|
||||
val yearText = "[" + abs(year) + "] " + if (year < 0) "BC" else "AD"
|
||||
turnsLabel.setText(Fonts.turn + "" + civInfo.gameInfo.turns + " | " + yearText.tr())
|
||||
@ -264,10 +265,10 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() {
|
||||
|
||||
|
||||
// Best to initialize these once only
|
||||
private val marathon = listOf(YearsToTurn(100, 15.0), YearsToTurn(400, 10.0), YearsToTurn(570, 5.0), YearsToTurn(771, 2.0), YearsToTurn(900, 1.0), YearsToTurn(1000, 0.5), YearsToTurn(1500, 0.25))
|
||||
private val marathon = listOf(YearsToTurn(100, 15.0), YearsToTurn(400, 10.0), YearsToTurn(570, 5.0), YearsToTurn(771, 2.0), YearsToTurn(900, 1.0), YearsToTurn(1080, 0.5), YearsToTurn(1344, 0.25), YearsToTurn(1500, 0.083333))
|
||||
private val epic = listOf(YearsToTurn(140, 25.0), YearsToTurn(230, 15.0), YearsToTurn(270, 10.0), YearsToTurn(360, 5.0), YearsToTurn(430, 2.0), YearsToTurn(530, 1.0), YearsToTurn(1500, 0.5))
|
||||
private val standard = listOf(YearsToTurn(75, 40.0), YearsToTurn(135, 25.0), YearsToTurn(160, 15.0), YearsToTurn(211, 10.0), YearsToTurn(270, 5.0), YearsToTurn(315, 2.0), YearsToTurn(440, 1.0))
|
||||
private val quick = listOf(YearsToTurn(50, 60.0), YearsToTurn(80, 40.0), YearsToTurn(100, 25.0), YearsToTurn(130, 15.0), YearsToTurn(155, 10.0), YearsToTurn(195, 5.0), YearsToTurn(260, 2.0))
|
||||
private val standard = listOf(YearsToTurn(75, 40.0), YearsToTurn(135, 25.0), YearsToTurn(160, 20.0), YearsToTurn(210, 10.0), YearsToTurn(270, 5.0), YearsToTurn(320, 2.0), YearsToTurn(440, 1.0), YearsToTurn(500, 0.5))
|
||||
private val quick = listOf(YearsToTurn(50, 60.0), YearsToTurn(80, 40.0), YearsToTurn(100, 30.0), YearsToTurn(130, 20.0), YearsToTurn(155, 10.0), YearsToTurn(195, 5.0), YearsToTurn(260, 2.0), YearsToTurn(310, 1.0))
|
||||
|
||||
private fun getYear(gameSpeed: GameSpeed, turn: Int): Float {
|
||||
|
||||
@ -290,4 +291,11 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() {
|
||||
|
||||
return year
|
||||
}
|
||||
|
||||
private fun getEquivalentTurn(gameInfo: GameInfo): Int {
|
||||
val totalTurns = 500f * gameInfo.gameParameters.gameSpeed.modifier
|
||||
val startPercent = gameInfo.ruleSet.eras[gameInfo.gameParameters.startingEra]?.startPercent
|
||||
if (startPercent == null) return gameInfo.turns
|
||||
return gameInfo.turns + ((totalTurns * startPercent).toInt() / 100)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user