mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-10 07:16:54 +07:00
Added validations for city-state uniques
This commit is contained in:
parent
ee2ab74715
commit
e83e733104
@ -39,7 +39,7 @@
|
||||
"color": [255, 0, 0]
|
||||
},
|
||||
{
|
||||
"name":"Religious",
|
||||
"name": "Religious",
|
||||
"friendBonusUniques": [
|
||||
"[+3 Faith] <before the [Medieval era]>",
|
||||
"[+6 Faith] <starting from the [Medieval era]> <before the [Industrial era]>",
|
||||
|
@ -1,32 +1,55 @@
|
||||
[
|
||||
{
|
||||
"name":"Cultured",
|
||||
"friendBonusUniques": ["[+3 Culture]"],
|
||||
"allyBonusUniques": ["[+6 Culture]"],
|
||||
"name": "Cultured",
|
||||
"friendBonusUniques": [
|
||||
"[+3 Culture] <before the [Medieval era]>",
|
||||
"[+6 Culture] <starting from the [Medieval era]> <before the [Industrial era]>",
|
||||
"[+13 Culture] <starting from the [Industrial era]>"
|
||||
],
|
||||
"allyBonusUniques": [
|
||||
"[+6 Culture] <before the [Medieval era]>",
|
||||
"[+12 Culture] <starting from the [Medieval era]> <before the [Industrial era]>",
|
||||
"[+26 Culture] <starting from the [Industrial era]>"
|
||||
],
|
||||
"color": [139, 96, 255]
|
||||
},
|
||||
{
|
||||
"name":"Maritime",
|
||||
"name": "Maritime",
|
||||
"friendBonusUniques": ["[+2 Food] [in capital]"],
|
||||
"allyBonusUniques": ["[+2 Food] [in capital]", "[+1 Food] [in all cities]"],
|
||||
"color": [56, 255, 112]
|
||||
},
|
||||
{
|
||||
"name":"Mercantile",
|
||||
"friendBonusUniques": ["[+2 Happiness]"],
|
||||
"allyBonusUniques": ["[+2 Happiness]", "Provides a unique luxury"],
|
||||
"name": "Mercantile",
|
||||
"friendBonusUniques": [
|
||||
"[+2 Happiness] <before the [Medieval era]>",
|
||||
"[+3 Happiness] <starting from the [Medieval era]>"
|
||||
],
|
||||
"allyBonusUniques": [
|
||||
"[+2 Happiness] <before the [Medieval era]>",
|
||||
"[+3 Happiness] <starting from the [Medieval era]>",
|
||||
"Provides a unique luxury"
|
||||
],
|
||||
"color": [255, 216, 0]
|
||||
},
|
||||
{
|
||||
"name":"Militaristic",
|
||||
"name": "Militaristic",
|
||||
"friendBonusUniques": ["Provides military units every ≈[20] turns"],
|
||||
"allyBonusUniques": ["Provides military units every ≈[17] turns"],
|
||||
"color": [255, 0, 0]
|
||||
},
|
||||
{
|
||||
"name":"Religious",
|
||||
"friendBonusUniques": ["[+3 Faith]"],
|
||||
"allyBonusUniques": ["[+6 Faith]"],
|
||||
"friendBonusUniques": [
|
||||
"[+3 Faith] <before the [Medieval era]>",
|
||||
"[+6 Faith] <starting from the [Medieval era]> <before the [Industrial era]>",
|
||||
"[+13 Faith] <starting from the [Industrial era]>"
|
||||
],
|
||||
"allyBonusUniques": [
|
||||
"[+6 Faith] <before the [Medieval era]>",
|
||||
"[+12 Faith] <starting from the [Medieval era]> <before the [Industrial era]>",
|
||||
"[+26 Faith] <starting from the [Industrial era]>"
|
||||
],
|
||||
"color": [255, 255, 255]
|
||||
}
|
||||
]
|
||||
|
@ -14,20 +14,6 @@
|
||||
"embarkDefense": 3,
|
||||
"startPercent": 0,
|
||||
"citySound": "cityAncient",
|
||||
"friendBonus": {
|
||||
"Cultured": ["Provides [+3 Culture] per turn"],
|
||||
"Maritime": ["Provides [+2 Food] [in capital] per turn"],
|
||||
"Mercantile": ["Provides [+2] Happiness"],
|
||||
"Religious": ["Provides [+3 Faith] per turn"],
|
||||
"Militaristic": ["Provides military units every ≈[20] turns"]
|
||||
},
|
||||
"allyBonus": {
|
||||
"Cultured": ["Provides [+6 Culture] per turn"],
|
||||
"Maritime": ["Provides [+2 Food] [in capital] per turn", "Provides [+1 Food] [in all cities] per turn"],
|
||||
"Mercantile": ["Provides [+2] Happiness", "Provides a unique luxury"],
|
||||
"Religious": ["Provides [+6 Faith] per turn"],
|
||||
"Militaristic": ["Provides military units every ≈[17] turns"]
|
||||
},
|
||||
"iconRGB": [255, 87, 35]
|
||||
},
|
||||
{
|
||||
@ -44,20 +30,6 @@
|
||||
"embarkDefense": 4,
|
||||
"startPercent": 10,
|
||||
"citySound": "cityClassical",
|
||||
"friendBonus": {
|
||||
"Cultured": ["Provides [+3 Culture] per turn"],
|
||||
"Maritime": ["Provides [+2 Food] [in capital] per turn"],
|
||||
"Mercantile": ["Provides [+2] Happiness"],
|
||||
"Religious": ["Provides [+3 Faith] per turn"],
|
||||
"Militaristic": ["Provides military units every ≈[20] turns"]
|
||||
},
|
||||
"allyBonus": {
|
||||
"Cultured": ["Provides [+6 Culture] per turn"],
|
||||
"Maritime": ["Provides [+2 Food] [in capital] per turn", "Provides [+1 Food] [in all cities] per turn"],
|
||||
"Mercantile": ["Provides [+2] Happiness", "Provides a unique luxury"],
|
||||
"Religious": ["Provides [+6 Faith] per turn"],
|
||||
"Militaristic": ["Provides military units every ≈[17] turns"]
|
||||
},
|
||||
"iconRGB": [233, 31, 99]
|
||||
},
|
||||
{
|
||||
@ -76,20 +48,6 @@
|
||||
"embarkDefense": 6,
|
||||
"startPercent": 25,
|
||||
"citySound": "cityMedieval",
|
||||
"friendBonus": {
|
||||
"Cultured": ["Provides [+6 Culture] per turn"],
|
||||
"Maritime": ["Provides [+2 Food] [in capital] per turn"],
|
||||
"Mercantile": ["Provides [+3] Happiness"],
|
||||
"Religious": ["Provides [+6 Faith] per turn"],
|
||||
"Militaristic": ["Provides military units every ≈[20] turns"]
|
||||
},
|
||||
"allyBonus": {
|
||||
"Cultured": ["Provides [+12 Culture] per turn"],
|
||||
"Maritime": ["Provides [+2 Food] [in capital] per turn", "Provides [+1 Food] [in all cities] per turn"],
|
||||
"Mercantile": ["Provides [+3] Happiness", "Provides a unique luxury"],
|
||||
"Religious": ["Provides [+12 Faith] per turn"],
|
||||
"Militaristic": ["Provides military units every ≈[17] turns"]
|
||||
},
|
||||
"iconRGB": [157, 39, 176]
|
||||
},
|
||||
{
|
||||
@ -109,20 +67,6 @@
|
||||
"embarkDefense": 8,
|
||||
"startPercent": 37,
|
||||
"citySound": "cityRenaissance",
|
||||
"friendBonus": {
|
||||
"Cultured": ["Provides [+6 Culture] per turn"],
|
||||
"Maritime": ["Provides [+2 Food] [in capital] per turn"],
|
||||
"Mercantile": ["Provides [+3] Happiness"],
|
||||
"Religious": ["Provides [+6 Faith] per turn"],
|
||||
"Militaristic": ["Provides military units every ≈[20] turns"]
|
||||
},
|
||||
"allyBonus": {
|
||||
"Cultured": ["Provides [+12 Culture] per turn"],
|
||||
"Maritime": ["Provides [+2 Food] [in capital] per turn", "Provides [+1 Food] [in all cities] per turn"],
|
||||
"Mercantile": ["Provides [+3] Happiness", "Provides a unique luxury"],
|
||||
"Religious": ["Provides [+12 Faith] per turn"],
|
||||
"Militaristic": ["Provides military units every ≈[17] turns"]
|
||||
},
|
||||
"iconRGB": [104, 58, 183]
|
||||
},
|
||||
{
|
||||
@ -143,20 +87,6 @@
|
||||
"embarkDefense": 10,
|
||||
"startPercent": 50,
|
||||
"citySound": "cityIndustrial",
|
||||
"friendBonus": {
|
||||
"Cultured": ["Provides [+13 Culture] per turn"],
|
||||
"Maritime": ["Provides [+2 Food] [in capital] per turn"],
|
||||
"Mercantile": ["Provides [+3] Happiness"],
|
||||
"Religious": ["Provides [+13 Faith] per turn"],
|
||||
"Militaristic": ["Provides military units every ≈[20] turns"]
|
||||
},
|
||||
"allyBonus": {
|
||||
"Cultured": ["Provides [+26 Culture] per turn"],
|
||||
"Maritime": ["Provides [+2 Food] [in capital] per turn", "Provides [+1 Food] [in all cities] per turn"],
|
||||
"Mercantile": ["Provides [+3] Happiness", "Provides a unique luxury"],
|
||||
"Religious": ["Provides [+26 Faith] per turn"],
|
||||
"Militaristic": ["Provides military units every ≈[17] turns"]
|
||||
},
|
||||
"iconRGB": [63, 81, 182],
|
||||
},
|
||||
{
|
||||
@ -178,20 +108,6 @@
|
||||
"embarkDefense": 13,
|
||||
"startPercent": 65,
|
||||
"citySound": "cityModern",
|
||||
"friendBonus": {
|
||||
"Cultured": ["Provides [+13 Culture] per turn"],
|
||||
"Maritime": ["Provides [+2 Food] [in capital] per turn"],
|
||||
"Mercantile": ["Provides [+3] Happiness"],
|
||||
"Religious": ["Provides [+13 Faith] per turn"],
|
||||
"Militaristic": ["Provides military units every ≈[20] turns"]
|
||||
},
|
||||
"allyBonus": {
|
||||
"Cultured": ["Provides [+26 Culture] per turn"],
|
||||
"Maritime": ["Provides [+2 Food] [in capital] per turn", "Provides [+1 Food] [in all cities] per turn"],
|
||||
"Mercantile": ["Provides [+3] Happiness", "Provides a unique luxury"],
|
||||
"Religious": ["Provides [+26 Faith] per turn"],
|
||||
"Militaristic": ["Provides military units every ≈[17] turns"]
|
||||
},
|
||||
"iconRGB": [33, 150, 243],
|
||||
},
|
||||
{
|
||||
@ -214,20 +130,6 @@
|
||||
"embarkDefense": 16,
|
||||
"startPercent": 65,
|
||||
"citySound": "cityAtomic",
|
||||
"friendBonus": {
|
||||
"Cultured": ["Provides [+13 Culture] per turn"],
|
||||
"Maritime": ["Provides [+2 Food] [in capital] per turn"],
|
||||
"Mercantile": ["Provides [+3] Happiness"],
|
||||
"Religious": ["Provides [+13 Faith] per turn"],
|
||||
"Militaristic": ["Provides military units every ≈[20] turns"]
|
||||
},
|
||||
"allyBonus": {
|
||||
"Cultured": ["Provides [+26 Culture] per turn"],
|
||||
"Maritime": ["Provides [+2 Food] [in capital] per turn", "Provides [+1 Food] [in all cities] per turn"],
|
||||
"Mercantile": ["Provides [+3] Happiness", "Provides a unique luxury"],
|
||||
"Religious": ["Provides [+26 Faith] per turn"],
|
||||
"Militaristic": ["Provides military units every ≈[17] turns"]
|
||||
},
|
||||
"iconRGB": [0, 150, 136],
|
||||
},
|
||||
{
|
||||
@ -254,21 +156,6 @@
|
||||
// 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.
|
||||
"citySound": "cityInformation",
|
||||
"friendBonus": {
|
||||
"Cultured": ["Provides [+13 Culture] per turn"],
|
||||
"Maritime": ["Provides [+2 Food] [in capital] per turn"],
|
||||
"Mercantile": ["Provides [+3] Happiness"],
|
||||
"Religious": ["Provides [+13 Faith] per turn"],
|
||||
"Militaristic": ["Provides military units every ≈[20] turns"]
|
||||
},
|
||||
"allyBonus": {
|
||||
"Cultured": ["Provides [+26 Culture] per turn"],
|
||||
"Maritime": ["Provides [+2 Food] [in capital] per turn", "Provides [+1 Food] [in all cities] per turn"],
|
||||
"Mercantile": ["Provides [+3] Happiness", "Provides a unique luxury"],
|
||||
"Religious": ["Provides [+26 Faith] per turn"],
|
||||
"Militaristic": ["Provides military units every ≈[17] turns"]
|
||||
|
||||
},
|
||||
"iconRGB": [76, 176, 81],
|
||||
},
|
||||
{ // Technically, this Era doesn't exist in the original game.
|
||||
@ -294,21 +181,6 @@
|
||||
"embarkDefense": 25,
|
||||
"startPercent": 80,
|
||||
"citySound": "cityFuture",
|
||||
"friendBonus": {
|
||||
"Cultured": ["Provides [+13 Culture] per turn"],
|
||||
"Maritime": ["Provides [+2 Food] [in capital] per turn"],
|
||||
"Mercantile": ["Provides [+3] Happiness"],
|
||||
"Religious": ["Provides [+13 Faith] per turn"],
|
||||
"Militaristic": ["Provides military units every ≈[20] turns"]
|
||||
},
|
||||
"allyBonus": {
|
||||
"Cultured": ["Provides [+26 Culture] per turn"],
|
||||
"Maritime": ["Provides [+2 Food] [in capital] per turn", "Provides [+1 Food] [in all cities] per turn"],
|
||||
"Mercantile": ["Provides [+3] Happiness", "Provides a unique luxury"],
|
||||
"Religious": ["Provides [+26 Faith] per turn"],
|
||||
"Militaristic": ["Provides military units every ≈[17] turns"]
|
||||
|
||||
},
|
||||
"iconRGB": [76, 176, 81],
|
||||
}
|
||||
]
|
||||
|
@ -11,7 +11,6 @@ import com.unciv.models.ruleset.unique.UniqueTarget
|
||||
import com.unciv.models.ruleset.unique.UniqueType
|
||||
import com.unciv.models.stats.INamed
|
||||
import com.unciv.models.stats.Stats
|
||||
import com.unciv.models.translations.fillPlaceholders
|
||||
import com.unciv.ui.utils.getRelativeTextDistance
|
||||
|
||||
class RulesetValidator(val ruleset: Ruleset) {
|
||||
@ -277,10 +276,10 @@ class RulesetValidator(val ruleset: Ruleset) {
|
||||
if (era.settlerPopulation <= 0)
|
||||
lines += "Population in cities from settlers must be strictly positive! Found value ${era.settlerPopulation} for era ${era.name}"
|
||||
|
||||
if (era.allyBonus.isEmpty() && rulesetHasCityStates)
|
||||
lines.add("No ally bonus defined for era ${era.name}", RulesetErrorSeverity.Warning)
|
||||
if (era.friendBonus.isEmpty() && rulesetHasCityStates)
|
||||
lines.add("No friend bonus defined for era ${era.name}", RulesetErrorSeverity.Warning)
|
||||
if (era.allyBonus.isNotEmpty())
|
||||
lines.add("Era ${era.name} contains city-state bonuses. City-state bonuses are now defined in CityStateType.json", RulesetErrorSeverity.WarningOptionsOnly)
|
||||
if (era.friendBonus.isNotEmpty())
|
||||
lines.add("Era ${era.name} contains city-state bonuses. City-state bonuses are now defined in CityStateType.json", RulesetErrorSeverity.WarningOptionsOnly)
|
||||
|
||||
|
||||
checkUniques(era, lines, rulesetSpecific, tryFixUnknownUniques)
|
||||
@ -360,6 +359,19 @@ class RulesetValidator(val ruleset: Ruleset) {
|
||||
lines += "Difficulty ${difficulty.name} contains starting unit $unitName which does not exist!"
|
||||
}
|
||||
|
||||
for (cityStateType in ruleset.cityStateTypes.values) {
|
||||
for (unique in cityStateType.allyBonusUniqueMap.getAllUniques() + cityStateType.friendBonusUniqueMap.getAllUniques()){
|
||||
val errors = checkUnique(
|
||||
unique,
|
||||
tryFixUnknownUniques,
|
||||
cityStateType.name,
|
||||
rulesetSpecific,
|
||||
UniqueTarget.CityState
|
||||
)
|
||||
lines.addAll(errors)
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
if (ruleset.modOptions.maxXPfromBarbarians != 30) {
|
||||
lines.add("maxXPfromBarbarians is moved to the constants object, instead use: \nconstants: {\n maxXPfromBarbarians: ${ruleset.modOptions.maxXPfromBarbarians},\n}", RulesetErrorSeverity.Warning)
|
||||
|
@ -47,7 +47,7 @@ enum class UniqueTarget(val inheritsFrom: UniqueTarget? = null) {
|
||||
// Other
|
||||
Speed,
|
||||
Tutorial,
|
||||
CityState,
|
||||
CityState(Global),
|
||||
ModOptions,
|
||||
Conditional,
|
||||
;
|
||||
|
Loading…
Reference in New Issue
Block a user