mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 05:46:43 -04:00
Civilopedia - Difficulty (#4789)
* Civilopedia - Difficulty * Civilopedia - Difficulty - patch2 * Civilopedia - Difficulty - patch3
This commit is contained in:
parent
6146cc834a
commit
0d041ab1ef
@ -167,7 +167,7 @@
|
||||
"aiBuildingMaintenanceModifier": 0.65,
|
||||
"aiUnitMaintenanceModifier": 0.65,
|
||||
"aiFreeTechs": ["Pottery","Animal Husbandry","Mining"],
|
||||
"aiMajorCivBonusStartingUnits": ["Era Starting Unit", "Era Starting Unit", "Worker", "Scout"],
|
||||
"aiMajorCivBonusStartingUnits": ["Worker", "Scout", "Era Starting Unit", "Era Starting Unit"],
|
||||
"aiCityStateBonusStartingUnits": [],
|
||||
"aiUnhappinessModifier": 0.75,
|
||||
"aisExchangeTechs": true,
|
||||
@ -192,7 +192,7 @@
|
||||
"aiBuildingMaintenanceModifier": 0.5,
|
||||
"aiUnitMaintenanceModifier": 0.5,
|
||||
"aiFreeTechs": ["Pottery","Animal Husbandry","Mining","The Wheel"],
|
||||
"aiMajorCivBonusStartingUnits": ["Settler", "Era Starting Unit", "Era Starting Unit", "Era Starting Unit", "Worker", "Scout"],
|
||||
"aiMajorCivBonusStartingUnits": ["Settler", "Worker", "Scout", "Era Starting Unit", "Era Starting Unit", "Era Starting Unit"],
|
||||
"aiCityStateBonusStartingUnits": [],
|
||||
"aiUnhappinessModifier": 0.6,
|
||||
"aisExchangeTechs": true,
|
||||
|
@ -934,23 +934,23 @@ Improvement [improvement] does not exist in ruleset! = Verbesserung [improvement
|
||||
Change map to fit selected ruleset? = Karte ändern, um sie dem neuen Regelsatz anzupassen?
|
||||
|
||||
# Civilopedia difficulty levels
|
||||
Player settings = Spieler Einstellungen
|
||||
Player settings = Spieler-Einstellungen
|
||||
Base Happiness = Basiszufriedenheit
|
||||
Happiness per luxury = Zufriedenheit pro Luxusgut
|
||||
Extra happiness per luxury = Zusätzliche Zufriedenheit pro Luxusgut
|
||||
Research cost modifier = Forschungskosten-Modifikator
|
||||
Unit cost modifier = Einheitenkosten-Modifikator
|
||||
Building cost modifier = Baukosten-Modifikator
|
||||
Policy cost modifier = Politikenkosten-Modifikator
|
||||
Unhappiness modifier = Unzufriedenheits-Modifikator
|
||||
Bonus vs. Barbarians = Bonus vs. Barbaren
|
||||
Bonus vs. Barbarians = Bonus gegen Barbaren
|
||||
|
||||
AI settings = KI Einstellungen
|
||||
AI settings = KI-Einstellungen
|
||||
AI city growth modifier = KI Stadtwachstums-Modifikator
|
||||
AI unit cost modifier = KI Einheitenkosten-Modifikator
|
||||
AI building cost modifier = KI Baukosten-Modifikator
|
||||
AI wonder cost modifier = KI Wunderkosten-Modifikator
|
||||
AI building maintenance modifier = KI Bauunterhaltungs-Modifikator
|
||||
AI unit maintenance modifier = KI Einheitenunterhaltungs-Modifikator
|
||||
AI wonder cost modifier = KI Wunder-Baukosten-Modifikator
|
||||
AI building maintenance modifier = KI Gebäude-Unterhaltskosten-Modifikator
|
||||
AI unit maintenance modifier = KI Einheiten-Unterhaltskosten-Modifikator
|
||||
AI unhappiness modifier = KI Unzufriedenheits-Modifikator
|
||||
|
||||
Turns until barbarians enter player tiles = Züge bis Barbaren Spielerfelder betreten
|
||||
|
@ -942,14 +942,15 @@ Change map to fit selected ruleset? =
|
||||
# Civilopedia difficulty levels
|
||||
Player settings =
|
||||
Base Happiness =
|
||||
Happiness per luxury =
|
||||
Extra happiness per luxury =
|
||||
Research cost modifier =
|
||||
Unit cost modifier =
|
||||
Building cost modifier =
|
||||
Policy cost modifier =
|
||||
Unhappiness modifier =
|
||||
Bonus vs. Barbarians =
|
||||
|
||||
Bonus starting units =
|
||||
|
||||
AI settings =
|
||||
AI city growth modifier =
|
||||
AI unit cost modifier =
|
||||
@ -958,7 +959,9 @@ AI wonder cost modifier =
|
||||
AI building maintenance modifier =
|
||||
AI unit maintenance modifier =
|
||||
AI unhappiness modifier =
|
||||
|
||||
AI free techs =
|
||||
Major AI civilization bonus starting units =
|
||||
City state bonus starting units =
|
||||
Turns until barbarians enter player tiles =
|
||||
Gold reward for clearing barbarian camps =
|
||||
|
||||
|
@ -2,9 +2,11 @@ package com.unciv.models.ruleset
|
||||
|
||||
import com.unciv.Constants
|
||||
import com.unciv.models.stats.INamed
|
||||
import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.civilopedia.ICivilopediaText
|
||||
import com.unciv.ui.civilopedia.FormattedLine
|
||||
import com.unciv.ui.utils.Fonts
|
||||
|
||||
class Difficulty: INamed {
|
||||
class Difficulty: INamed, ICivilopediaText {
|
||||
override lateinit var name: String
|
||||
var baseHappiness: Int = 0
|
||||
var extraHappinessPerLuxury: Float = 0f
|
||||
@ -32,35 +34,80 @@ class Difficulty: INamed {
|
||||
var turnBarbariansCanEnterPlayerTiles = 0
|
||||
var clearBarbarianCampReward = 25
|
||||
|
||||
fun getDescription(): String {
|
||||
val lines = ArrayList<String>()
|
||||
lines += "Player settings"
|
||||
lines += " - {Base Happiness}: $baseHappiness"
|
||||
lines += " - {Happiness per luxury}: $extraHappinessPerLuxury"
|
||||
lines += " - {Research cost modifier}: $researchCostModifier"
|
||||
lines += " - {Unit cost modifier}: $researchCostModifier"
|
||||
lines += " - {Building cost modifier}: $buildingCostModifier"
|
||||
lines += " - {Policy cost modifier}: $policyCostModifier"
|
||||
lines += " - {Unhappiness modifier}: $unhappinessModifier"
|
||||
lines += " - {Bonus vs. Barbarians}: $barbarianBonus"
|
||||
// lines += " - {Starting units}: $startingUnits"
|
||||
lines += ""
|
||||
lines += "AI settings"
|
||||
lines += " - {AI city growth modifier}: $aiCityGrowthModifier"
|
||||
lines += " - {AI unit cost modifier}: $aiUnitCostModifier"
|
||||
lines += " - {AI building cost modifier}: $aiBuildingCostModifier"
|
||||
lines += " - {AI wonder cost modifier}: $aiWonderCostModifier"
|
||||
lines += " - {AI building maintenance modifier}: $aiBuildingMaintenanceModifier"
|
||||
lines += " - {AI unit maintenance modifier}: $aiUnitMaintenanceModifier"
|
||||
// lines += " - {AI free techs}: $aiFreeTechs"
|
||||
// lines += " - {AI major civilizations starting units}: $aiMajorCivStartingUnits"
|
||||
// lines += " - {AI city-state starting units}: $aiCityStateStartingUnits"
|
||||
lines += " - {AI unhappiness modifier}: $aiUnhappinessModifier"
|
||||
lines += ""
|
||||
lines += "{Turns until barbarians enter player tiles}: $turnBarbariansCanEnterPlayerTiles"
|
||||
lines += "{Gold reward for clearing barbarian camps}: $clearBarbarianCampReward"
|
||||
// property defined in json but so far unused:
|
||||
// var aisExchangeTechs = false
|
||||
|
||||
return lines.joinToString("\n") { it.tr() }
|
||||
override var civilopediaText = listOf<FormattedLine>()
|
||||
|
||||
|
||||
override fun makeLink() = "Difficulty/$name"
|
||||
override fun replacesCivilopediaDescription() = true
|
||||
override fun hasCivilopediaTextLines() = true
|
||||
|
||||
private fun Float.toPercent() = (this * 100).toInt()
|
||||
override fun getCivilopediaTextLines(ruleset: Ruleset): List<FormattedLine> {
|
||||
val lines = ArrayList<FormattedLine>()
|
||||
lines += FormattedLine("Player settings", header = 3)
|
||||
lines += FormattedLine("{Base Happiness}: $baseHappiness ${Fonts.happiness}", indent = 1)
|
||||
lines += FormattedLine("{Extra happiness per luxury}: ${extraHappinessPerLuxury.toInt()} ${Fonts.happiness}", indent = 1)
|
||||
lines += FormattedLine("{Research cost modifier}: ${researchCostModifier.toPercent()}% ${Fonts.science}", indent = 1)
|
||||
lines += FormattedLine("{Unit cost modifier}: ${unitCostModifier.toPercent()}% ${Fonts.production}", indent = 1)
|
||||
lines += FormattedLine("{Building cost modifier}: ${buildingCostModifier.toPercent()}% ${Fonts.production}", indent = 1)
|
||||
lines += FormattedLine("{Policy cost modifier}: ${policyCostModifier.toPercent()}% ${Fonts.culture}", indent = 1)
|
||||
lines += FormattedLine("{Unhappiness modifier}: ${unhappinessModifier.toPercent()}%", indent = 1)
|
||||
lines += FormattedLine("{Bonus vs. Barbarians}: ${barbarianBonus.toPercent()}% ${Fonts.strength}", indent = 1)
|
||||
|
||||
if (playerBonusStartingUnits.isNotEmpty()) {
|
||||
lines += FormattedLine()
|
||||
lines += FormattedLine("{Bonus starting units}:", indent = 1)
|
||||
playerBonusStartingUnits.groupBy { it }.map {
|
||||
it.key to it.value.size // name to Pair.first and count to Pair.second
|
||||
}.forEach {
|
||||
// Through a virtual Unique was the simplest way to prevent white icons showing for stuff like eraSpecificUnit
|
||||
lines += FormattedLine(Unique(if (it.second == 1) "[${it.first}]" else "${it.second} [${it.first}]"), indent = 2)
|
||||
}
|
||||
}
|
||||
|
||||
lines += FormattedLine()
|
||||
lines += FormattedLine("AI settings", header = 3)
|
||||
lines += FormattedLine("{AI city growth modifier}: ${aiCityGrowthModifier.toPercent()}% ${Fonts.food}", indent = 1)
|
||||
lines += FormattedLine("{AI unit cost modifier}: ${aiUnitCostModifier.toPercent()}% ${Fonts.production}", indent = 1)
|
||||
lines += FormattedLine("{AI building cost modifier}: ${aiBuildingCostModifier.toPercent()}% ${Fonts.production}", indent = 1)
|
||||
lines += FormattedLine("{AI wonder cost modifier}: ${aiWonderCostModifier.toPercent()}% ${Fonts.production}", indent = 1)
|
||||
lines += FormattedLine("{AI building maintenance modifier}: ${aiBuildingMaintenanceModifier.toPercent()}% ${Fonts.gold}", indent = 1)
|
||||
lines += FormattedLine("{AI unit maintenance modifier}: ${aiUnitMaintenanceModifier.toPercent()}% ${Fonts.gold}", indent = 1)
|
||||
lines += FormattedLine("{AI unhappiness modifier}: ${aiUnhappinessModifier.toPercent()}%", indent = 1)
|
||||
|
||||
if (aiFreeTechs.isNotEmpty()) {
|
||||
lines += FormattedLine()
|
||||
lines += FormattedLine("{AI free techs}:", indent = 1)
|
||||
aiFreeTechs.forEach {
|
||||
lines += FormattedLine(it, link = "Technology/$it", indent = 2)
|
||||
}
|
||||
}
|
||||
if (aiMajorCivBonusStartingUnits.isNotEmpty()) {
|
||||
lines += FormattedLine()
|
||||
lines += FormattedLine("{Major AI civilization bonus starting units}:", indent = 1)
|
||||
aiMajorCivBonusStartingUnits.groupBy { it }.map {
|
||||
it.key to it.value.size
|
||||
}.forEach {
|
||||
lines += FormattedLine(Unique(if (it.second == 1) "[${it.first}]" else "${it.second} [${it.first}]"), indent = 2)
|
||||
}
|
||||
}
|
||||
if (aiCityStateBonusStartingUnits.isNotEmpty()) {
|
||||
lines += FormattedLine()
|
||||
lines += FormattedLine("{City state bonus starting units}:", indent = 1)
|
||||
aiCityStateBonusStartingUnits.groupBy { it }.map {
|
||||
it.key to it.value.size
|
||||
}.forEach {
|
||||
lines += FormattedLine(Unique(if (it.second == 1) "[${it.first}]" else "${it.second} [${it.first}]"), indent = 2)
|
||||
}
|
||||
}
|
||||
|
||||
lines += FormattedLine()
|
||||
lines += FormattedLine("{Turns until barbarians enter player tiles}: $turnBarbariansCanEnterPlayerTiles ${Fonts.turn}")
|
||||
lines += FormattedLine("{Gold reward for clearing barbarian camps}: $clearBarbarianCampReward ${Fonts.gold}")
|
||||
return lines
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -280,8 +280,9 @@ class CivilopediaScreen(
|
||||
.map {
|
||||
CivilopediaEntry(
|
||||
it.name,
|
||||
it.getDescription(),
|
||||
"",
|
||||
// CivilopediaCategories.Difficulty.getImage?.invoke(it.name, imageSize)
|
||||
flavour = (it as? ICivilopediaText)
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ class FormattedLine (
|
||||
// have no backing field, be `by lazy` or use @Transient, Thank you.
|
||||
|
||||
/** Looks for linkable ruleset objects in [Unique] parameters and returns a linked [FormattedLine] if successful, a plain one otherwise */
|
||||
constructor(unique: Unique) : this(unique.text, getUniqueLink(unique))
|
||||
constructor(unique: Unique, indent: Int = 0) : this(unique.text, getUniqueLink(unique), indent = indent)
|
||||
|
||||
/** Link types that can be used for [FormattedLine.link] */
|
||||
enum class LinkType {
|
||||
|
Loading…
x
Reference in New Issue
Block a user