mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-10 07:16:54 +07:00
Make AI difficulty changable (#11996)
* Added AIDifficultyLevel to the difficulty object * Fixed difficulty levels not showing in the cyclopedia screen
This commit is contained in:
parent
37b4bcbda8
commit
7d69945c57
@ -13,6 +13,7 @@
|
||||
"barbarianBonus": 0.75,
|
||||
"barbarianSpawnDelay": 8,
|
||||
"playerBonusStartingUnits": [], // Note that the units from Eras.json are added to this pool. This should only contain bonus starting units.
|
||||
"aiDifficultyLevel": "Chieftain",
|
||||
"aiCityGrowthModifier": 1.6, // that is to say it'll take them 1.6 times as long to grow the city
|
||||
"aiUnitCostModifier": 1.75,
|
||||
"aiBuildingCostModifier": 1.6,
|
||||
@ -42,6 +43,7 @@
|
||||
"barbarianBonus": 0.5,
|
||||
"barbarianSpawnDelay": 5,
|
||||
"playerBonusStartingUnits": [],
|
||||
"aiDifficultyLevel": "Chieftain",
|
||||
"aiCityGrowthModifier": 1.3,
|
||||
"aiUnitCostModifier": 1.3,
|
||||
"aiBuildingCostModifier": 1.3,
|
||||
@ -71,6 +73,7 @@
|
||||
"barbarianBonus": 0.4,
|
||||
"barbarianSpawnDelay": 3,
|
||||
"playerBonusStartingUnits": [],
|
||||
"aiDifficultyLevel": "Chieftain",
|
||||
"aiCityGrowthModifier": 1.1,
|
||||
"aiUnitCostModifier": 1.1,
|
||||
"aiBuildingCostModifier": 1.1,
|
||||
@ -100,6 +103,7 @@
|
||||
"barbarianBonus": 0.33,
|
||||
"barbarianSpawnDelay": 0,
|
||||
"playerBonusStartingUnits": [],
|
||||
"aiDifficultyLevel": "Chieftain",
|
||||
"aiCityGrowthModifier": 1,
|
||||
"aiUnitCostModifier": 1,
|
||||
"aiBuildingCostModifier": 1,
|
||||
@ -129,6 +133,7 @@
|
||||
"barbarianBonus": 0.25,
|
||||
"barbarianSpawnDelay": 0,
|
||||
"playerBonusStartingUnits": [],
|
||||
"aiDifficultyLevel": "Chieftain",
|
||||
"aiCityGrowthModifier": 0.9,
|
||||
"aiUnitCostModifier": 0.85,
|
||||
"aiBuildingCostModifier": 0.85,
|
||||
@ -158,6 +163,7 @@
|
||||
"barbarianBonus": 0.2,
|
||||
"barbarianSpawnDelay": 0,
|
||||
"playerBonusStartingUnits": [],
|
||||
"aiDifficultyLevel": "Chieftain",
|
||||
"aiCityGrowthModifier": 0.85,
|
||||
"aiUnitCostModifier": 0.8,
|
||||
"aiBuildingCostModifier": 0.8,
|
||||
@ -187,6 +193,7 @@
|
||||
"barbarianBonus": 0.1,
|
||||
"barbarianSpawnDelay": 0,
|
||||
"playerBonusStartingUnits": [],
|
||||
"aiDifficultyLevel": "Chieftain",
|
||||
"aiCityGrowthModifier": 0.75,
|
||||
"aiUnitCostModifier": 0.65,
|
||||
"aiBuildingCostModifier": 0.65,
|
||||
@ -216,6 +223,7 @@
|
||||
"barbarianBonus": 0,
|
||||
"barbarianSpawnDelay": 0,
|
||||
"playerBonusStartingUnits": [],
|
||||
"aiDifficultyLevel": "Chieftain",
|
||||
"aiCityGrowthModifier": 0.6,
|
||||
"aiUnitCostModifier": 0.5,
|
||||
"aiBuildingCostModifier": 0.5,
|
||||
|
@ -13,6 +13,7 @@
|
||||
"barbarianBonus": 0.75,
|
||||
"barbarianSpawnDelay": 8,
|
||||
"playerBonusStartingUnits": [], // Note that the units from Eras.json are added to this pool. This should only contain bonus starting units.
|
||||
"aiDifficultyLevel": "Chieftain",
|
||||
"aiCityGrowthModifier": 1.6, // that is to say it'll take them 1.6 times as long to grow the city
|
||||
"aiUnitCostModifier": 1.75,
|
||||
"aiBuildingCostModifier": 1.6,
|
||||
@ -42,6 +43,7 @@
|
||||
"barbarianBonus": 0.5,
|
||||
"barbarianSpawnDelay": 5,
|
||||
"playerBonusStartingUnits": [],
|
||||
"aiDifficultyLevel": "Chieftain",
|
||||
"aiCityGrowthModifier": 1.3,
|
||||
"aiUnitCostModifier": 1.3,
|
||||
"aiBuildingCostModifier": 1.3,
|
||||
@ -71,6 +73,7 @@
|
||||
"barbarianBonus": 0.4,
|
||||
"barbarianSpawnDelay": 3,
|
||||
"playerBonusStartingUnits": [],
|
||||
"aiDifficultyLevel": "Chieftain",
|
||||
"aiCityGrowthModifier": 1.1,
|
||||
"aiUnitCostModifier": 1.1,
|
||||
"aiBuildingCostModifier": 1.1,
|
||||
@ -100,6 +103,7 @@
|
||||
"barbarianBonus": 0.33,
|
||||
"barbarianSpawnDelay": 0,
|
||||
"playerBonusStartingUnits": [],
|
||||
"aiDifficultyLevel": "Chieftain",
|
||||
"aiCityGrowthModifier": 1,
|
||||
"aiUnitCostModifier": 1,
|
||||
"aiBuildingCostModifier": 1,
|
||||
@ -129,6 +133,7 @@
|
||||
"barbarianBonus": 0.25,
|
||||
"barbarianSpawnDelay": 0,
|
||||
"playerBonusStartingUnits": [],
|
||||
"aiDifficultyLevel": "Chieftain",
|
||||
"aiCityGrowthModifier": 0.9,
|
||||
"aiUnitCostModifier": 0.85,
|
||||
"aiBuildingCostModifier": 0.85,
|
||||
@ -158,6 +163,7 @@
|
||||
"barbarianBonus": 0.2,
|
||||
"barbarianSpawnDelay": 0,
|
||||
"playerBonusStartingUnits": [],
|
||||
"aiDifficultyLevel": "Chieftain",
|
||||
"aiCityGrowthModifier": 0.85,
|
||||
"aiUnitCostModifier": 0.8,
|
||||
"aiBuildingCostModifier": 0.8,
|
||||
@ -187,6 +193,7 @@
|
||||
"barbarianBonus": 0.1,
|
||||
"barbarianSpawnDelay": 0,
|
||||
"playerBonusStartingUnits": [],
|
||||
"aiDifficultyLevel": "Chieftain",
|
||||
"aiCityGrowthModifier": 0.75,
|
||||
"aiUnitCostModifier": 0.65,
|
||||
"aiBuildingCostModifier": 0.65,
|
||||
@ -216,6 +223,7 @@
|
||||
"barbarianBonus": 0,
|
||||
"barbarianSpawnDelay": 0,
|
||||
"playerBonusStartingUnits": [],
|
||||
"aiDifficultyLevel": "Chieftain",
|
||||
"aiCityGrowthModifier": 0.6,
|
||||
"aiUnitCostModifier": 0.5,
|
||||
"aiBuildingCostModifier": 0.5,
|
||||
|
@ -314,7 +314,9 @@ class Civilization : IsPartOfGameInfoSerialization {
|
||||
//region pure functions
|
||||
fun getDifficulty(): Difficulty {
|
||||
if (isHuman()) return gameInfo.getDifficulty()
|
||||
// TODO We should be able to mark a difficulty as 'default AI difficulty' somehow
|
||||
if (gameInfo.ruleset.difficulties.containsKey(gameInfo.getDifficulty().aiDifficultyLevel)) {
|
||||
return gameInfo.ruleset.difficulties[gameInfo.getDifficulty().aiDifficultyLevel]!!
|
||||
}
|
||||
val chieftainDifficulty = gameInfo.ruleset.difficulties["Chieftain"]
|
||||
if (chieftainDifficulty != null) return chieftainDifficulty
|
||||
return gameInfo.ruleset.difficulties.values.first()
|
||||
|
@ -22,6 +22,7 @@ class Difficulty: INamed, ICivilopediaText {
|
||||
var barbarianSpawnDelay: Int = 0
|
||||
var playerBonusStartingUnits = ArrayList<String>()
|
||||
|
||||
var aiDifficultyLevel: String? = null
|
||||
var aiCityGrowthModifier: Float = 1f
|
||||
var aiUnitCostModifier: Float = 1f
|
||||
var aiBuildingCostModifier: Float = 1f
|
||||
@ -71,6 +72,7 @@ class Difficulty: INamed, ICivilopediaText {
|
||||
|
||||
lines += FormattedLine()
|
||||
lines += FormattedLine("AI settings", header = 3)
|
||||
lines += FormattedLine("{AI difficulty level}: $aiDifficultyLevel", indent = 1)
|
||||
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)
|
||||
|
@ -202,7 +202,7 @@ class CivilopediaScreen(
|
||||
|
||||
// do not confuse with IConstruction.shouldBeDisplayed - that one tests all prerequisites for building
|
||||
fun shouldBeDisplayed(obj: ICivilopediaText) =
|
||||
obj is IHasUniques && !obj.isHiddenFromCivilopedia(game.gameInfo, ruleset)
|
||||
obj !is IHasUniques || !obj.isHiddenFromCivilopedia(game.gameInfo, ruleset)
|
||||
|
||||
for (loopCategory in CivilopediaCategories.entries) {
|
||||
if (!religionEnabled && loopCategory == CivilopediaCategories.Belief) continue
|
||||
|
Loading…
Reference in New Issue
Block a user