mirror of
https://github.com/yairm210/Unciv.git
synced 2025-08-03 12:37:42 -04:00
Added test to ensure countable parameters are proper parameter types
This commit is contained in:
parent
407685f7df
commit
80e6e7a548
@ -29,7 +29,7 @@ interface ICountable {
|
||||
* Contains all knowledge about how to check and evaluate [countable Unique parameters][UniqueParameterType.Countable].
|
||||
*
|
||||
* Expansion instructions:
|
||||
* - A new simple "variable" needs to implement only [simpleName] and [eval].
|
||||
* - A new simple "variable" needs to implement only [text] and [eval].
|
||||
* - A new "variable" _using placeholder(s)_ needs to implement [matches] and [eval].
|
||||
* - Using [simpleName] inside [validate] as the examples do is only done for readability.
|
||||
* - Implement [getErrorSeverity] in most cases, use [UniqueParameterType] to validate each placeholder content.
|
||||
@ -39,7 +39,7 @@ interface ICountable {
|
||||
* implementation, then a new instance here that delegates all its methods to that object. And delete these lines.
|
||||
*/
|
||||
enum class Countables(
|
||||
protected val simpleName: String = "",
|
||||
val text: String = "",
|
||||
private val shortDocumentation: String = "",
|
||||
open val documentationStrings: List<String> = emptyList()
|
||||
) : ICountable {
|
||||
@ -169,25 +169,25 @@ enum class Countables(
|
||||
}
|
||||
}
|
||||
;
|
||||
val placeholderText = simpleName.getPlaceholderText()
|
||||
val placeholderText = text.getPlaceholderText()
|
||||
|
||||
val noPlaceholders = simpleName.isNotEmpty() && !simpleName.contains('[')
|
||||
val noPlaceholders = text.isNotEmpty() && !text.contains('[')
|
||||
|
||||
// Leave these in place only for the really simple cases
|
||||
override fun matches(parameterText: String) = if (noPlaceholders) parameterText == simpleName
|
||||
override fun matches(parameterText: String) = if (noPlaceholders) parameterText == text
|
||||
else parameterText.equalsPlaceholderText(placeholderText)
|
||||
override fun getKnownValuesForAutocomplete(ruleset: Ruleset) = setOf(simpleName)
|
||||
override fun getKnownValuesForAutocomplete(ruleset: Ruleset) = setOf(text)
|
||||
|
||||
open val documentationHeader get() =
|
||||
simpleName + (if (shortDocumentation.isEmpty()) "" else " - $shortDocumentation")
|
||||
"`$text`" + (if (shortDocumentation.isEmpty()) "" else " - $shortDocumentation")
|
||||
|
||||
override fun getErrorSeverity(parameterText: String, ruleset: Ruleset): UniqueType.UniqueParameterErrorSeverity? {
|
||||
if (this == Integer) return UniqueParameterType.Number.getErrorSeverity(parameterText, ruleset)
|
||||
if (!simpleName.contains('[')) {
|
||||
if (parameterText == simpleName) return null
|
||||
if (!text.contains('[')) {
|
||||
if (parameterText == text) return null
|
||||
else return UniqueType.UniqueParameterErrorSeverity.RulesetInvariant
|
||||
} else {
|
||||
val placeholderParameters = simpleName.getPlaceholderParameters()
|
||||
val placeholderParameters = text.getPlaceholderParameters()
|
||||
var worstErrorSeverity: UniqueType.UniqueParameterErrorSeverity? = null
|
||||
for ((index, parameter) in placeholderParameters.withIndex()) {
|
||||
val parameterType = UniqueParameterType.safeValueOf(parameter)
|
||||
@ -206,7 +206,7 @@ enum class Countables(
|
||||
fun getMatching(parameterText: String, ruleset: Ruleset?) = Countables.entries
|
||||
.filter {
|
||||
if (it.matchesWithRuleset) it.matches(parameterText, ruleset!!) else it.matches(parameterText)
|
||||
}
|
||||
}
|
||||
|
||||
fun getCountableAmount(parameterText: String, stateForConditionals: StateForConditionals): Int? {
|
||||
val ruleset = stateForConditionals.gameInfo?.ruleset
|
||||
|
@ -138,12 +138,12 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
??? example "Gain enough Faith for a Pantheon"
|
||||
Applicable to: Triggerable
|
||||
|
||||
??? example "Gain enough Faith for [amount]% of a Great Prophet"
|
||||
??? example "Gain enough Faith for [positiveAmount]% of a Great Prophet"
|
||||
Example: "Gain enough Faith for [3]% of a Great Prophet"
|
||||
|
||||
Applicable to: Triggerable
|
||||
|
||||
??? example "Gain control over [tileFilter] tiles in a [amount]-tile radius"
|
||||
??? example "Gain control over [tileFilter] tiles in a [nonNegativeAmount]-tile radius"
|
||||
Example: "Gain control over [Farm] tiles in a [3]-tile radius"
|
||||
|
||||
Applicable to: Triggerable
|
||||
@ -158,7 +158,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: Triggerable
|
||||
|
||||
??? example "Promotes all spies [amount] time(s)"
|
||||
??? example "Promotes all spies [positiveAmount] time(s)"
|
||||
Example: "Promotes all spies [3] time(s)"
|
||||
|
||||
Applicable to: Triggerable
|
||||
@ -243,12 +243,12 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: UnitTriggerable
|
||||
|
||||
??? example "[unitTriggerTarget] gains [amount] movement"
|
||||
??? example "[unitTriggerTarget] gains [positiveAmount] movement"
|
||||
Example: "[This Unit] gains [3] movement"
|
||||
|
||||
Applicable to: UnitTriggerable
|
||||
|
||||
??? example "[unitTriggerTarget] loses [amount] movement"
|
||||
??? example "[unitTriggerTarget] loses [positiveAmount] movement"
|
||||
Example: "[This Unit] loses [3] movement"
|
||||
|
||||
Applicable to: UnitTriggerable
|
||||
@ -289,18 +289,18 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: Global, FollowerBelief
|
||||
|
||||
??? example "[stats] per [amount] population [cityFilter]"
|
||||
??? example "[stats] per [positiveAmount] population [cityFilter]"
|
||||
Example: "[+1 Gold, +2 Production] per [3] population [in all cities]"
|
||||
|
||||
Applicable to: Global, FollowerBelief
|
||||
|
||||
??? example "[stats] per [amount] social policies adopted"
|
||||
??? example "[stats] per [positiveAmount] social policies adopted"
|
||||
Only works for civ-wide stats
|
||||
Example: "[+1 Gold, +2 Production] per [3] social policies adopted"
|
||||
|
||||
Applicable to: Global
|
||||
|
||||
??? example "[stats] per every [amount] [civWideStat]"
|
||||
??? example "[stats] per every [positiveAmount] [civWideStat]"
|
||||
Example: "[+1 Gold, +2 Production] per every [3] [Gold]"
|
||||
|
||||
Applicable to: Global
|
||||
@ -405,12 +405,12 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: Global, Unit
|
||||
|
||||
??? example "Military Units gifted from City-States start with [amount] XP"
|
||||
??? example "Military Units gifted from City-States start with [positiveAmount] XP"
|
||||
Example: "Military Units gifted from City-States start with [3] XP"
|
||||
|
||||
Applicable to: Global
|
||||
|
||||
??? example "Militaristic City-States grant units [amount] times as fast when you are at war with a common nation"
|
||||
??? example "Militaristic City-States grant units [positiveAmount] times as fast when you are at war with a common nation"
|
||||
Example: "Militaristic City-States grant units [3] times as fast when you are at war with a common nation"
|
||||
|
||||
Applicable to: Global
|
||||
@ -420,7 +420,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: Global
|
||||
|
||||
??? example "Can spend Gold to annex or puppet a City-State that has been your Ally for [amount] turns"
|
||||
??? example "Can spend Gold to annex or puppet a City-State that has been your Ally for [nonNegativeAmount] turns"
|
||||
Example: "Can spend Gold to annex or puppet a City-State that has been your Ally for [3] turns"
|
||||
|
||||
Applicable to: Global
|
||||
@ -507,22 +507,22 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
??? example "Enables construction of Spaceship parts"
|
||||
Applicable to: Global
|
||||
|
||||
??? example "May buy [baseUnitFilter] units for [amount] [stat] [cityFilter] at an increasing price ([amount])"
|
||||
??? example "May buy [baseUnitFilter] units for [nonNegativeAmount] [stat] [cityFilter] at an increasing price ([amount])"
|
||||
Example: "May buy [Melee] units for [3] [Culture] [in all cities] at an increasing price ([3])"
|
||||
|
||||
Applicable to: Global, FollowerBelief
|
||||
|
||||
??? example "May buy [buildingFilter] buildings for [amount] [stat] [cityFilter] at an increasing price ([amount])"
|
||||
??? example "May buy [buildingFilter] buildings for [nonNegativeAmount] [stat] [cityFilter] at an increasing price ([amount])"
|
||||
Example: "May buy [Culture] buildings for [3] [Culture] [in all cities] at an increasing price ([3])"
|
||||
|
||||
Applicable to: Global, FollowerBelief
|
||||
|
||||
??? example "May buy [baseUnitFilter] units for [amount] [stat] [cityFilter]"
|
||||
??? example "May buy [baseUnitFilter] units for [nonNegativeAmount] [stat] [cityFilter]"
|
||||
Example: "May buy [Melee] units for [3] [Culture] [in all cities]"
|
||||
|
||||
Applicable to: Global, FollowerBelief
|
||||
|
||||
??? example "May buy [buildingFilter] buildings for [amount] [stat] [cityFilter]"
|
||||
??? example "May buy [buildingFilter] buildings for [nonNegativeAmount] [stat] [cityFilter]"
|
||||
Example: "May buy [Culture] buildings for [3] [Culture] [in all cities]"
|
||||
|
||||
Applicable to: Global, FollowerBelief
|
||||
@ -537,12 +537,12 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: Global, FollowerBelief
|
||||
|
||||
??? example "May buy [baseUnitFilter] units with [stat] for [amount] times their normal Production cost"
|
||||
??? example "May buy [baseUnitFilter] units with [stat] for [nonNegativeAmount] times their normal Production cost"
|
||||
Example: "May buy [Melee] units with [Culture] for [3] times their normal Production cost"
|
||||
|
||||
Applicable to: Global, FollowerBelief
|
||||
|
||||
??? example "May buy [buildingFilter] buildings with [stat] for [amount] times their normal Production cost"
|
||||
??? example "May buy [buildingFilter] buildings with [stat] for [nonNegativeAmount] times their normal Production cost"
|
||||
Example: "May buy [Culture] buildings with [Culture] for [3] times their normal Production cost"
|
||||
|
||||
Applicable to: Global, FollowerBelief
|
||||
@ -685,7 +685,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: Global
|
||||
|
||||
??? example "[amount] Unit Supply per [amount] population [cityFilter]"
|
||||
??? example "[amount] Unit Supply per [positiveAmount] population [cityFilter]"
|
||||
Example: "[3] Unit Supply per [3] population [in all cities]"
|
||||
|
||||
Applicable to: Global
|
||||
@ -718,7 +718,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
Due to performance considerations, this unique is cached, thus conditionals that may change within a turn may not work.
|
||||
Applicable to: Global
|
||||
|
||||
??? example "Enemy [mapUnitFilter] units must spend [amount] extra movement points when inside your territory"
|
||||
??? example "Enemy [mapUnitFilter] units must spend [positiveAmount] extra movement points when inside your territory"
|
||||
Example: "Enemy [Wounded] units must spend [3] extra movement points when inside your territory"
|
||||
|
||||
Due to performance considerations, this unique is cached, thus conditionals that may change within a turn may not work.
|
||||
@ -1039,13 +1039,13 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: Global, Unit
|
||||
|
||||
??? example "[amount] Movement point cost to disembark"
|
||||
??? example "[nonNegativeAmount] Movement point cost to disembark"
|
||||
Example: "[3] Movement point cost to disembark"
|
||||
|
||||
Due to performance considerations, this unique is cached, thus conditionals that may change within a turn may not work.
|
||||
Applicable to: Global, Unit
|
||||
|
||||
??? example "[amount] Movement point cost to embark"
|
||||
??? example "[nonNegativeAmount] Movement point cost to embark"
|
||||
Example: "[3] Movement point cost to embark"
|
||||
|
||||
Due to performance considerations, this unique is cached, thus conditionals that may change within a turn may not work.
|
||||
@ -1163,7 +1163,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: FounderBelief
|
||||
|
||||
??? example "[stats] from every [amount] global followers [cityFilter]"
|
||||
??? example "[stats] from every [positiveAmount] global followers [cityFilter]"
|
||||
Example: "[+1 Gold, +2 Production] from every [3] global followers [in all cities]"
|
||||
|
||||
Applicable to: FounderBelief
|
||||
@ -1201,7 +1201,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: Global, FollowerBelief
|
||||
|
||||
??? example "[stats] per [amount] population [cityFilter]"
|
||||
??? example "[stats] per [positiveAmount] population [cityFilter]"
|
||||
Example: "[+1 Gold, +2 Production] per [3] population [in all cities]"
|
||||
|
||||
Applicable to: Global, FollowerBelief
|
||||
@ -1301,22 +1301,22 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: Global, FollowerBelief
|
||||
|
||||
??? example "May buy [baseUnitFilter] units for [amount] [stat] [cityFilter] at an increasing price ([amount])"
|
||||
??? example "May buy [baseUnitFilter] units for [nonNegativeAmount] [stat] [cityFilter] at an increasing price ([amount])"
|
||||
Example: "May buy [Melee] units for [3] [Culture] [in all cities] at an increasing price ([3])"
|
||||
|
||||
Applicable to: Global, FollowerBelief
|
||||
|
||||
??? example "May buy [buildingFilter] buildings for [amount] [stat] [cityFilter] at an increasing price ([amount])"
|
||||
??? example "May buy [buildingFilter] buildings for [nonNegativeAmount] [stat] [cityFilter] at an increasing price ([amount])"
|
||||
Example: "May buy [Culture] buildings for [3] [Culture] [in all cities] at an increasing price ([3])"
|
||||
|
||||
Applicable to: Global, FollowerBelief
|
||||
|
||||
??? example "May buy [baseUnitFilter] units for [amount] [stat] [cityFilter]"
|
||||
??? example "May buy [baseUnitFilter] units for [nonNegativeAmount] [stat] [cityFilter]"
|
||||
Example: "May buy [Melee] units for [3] [Culture] [in all cities]"
|
||||
|
||||
Applicable to: Global, FollowerBelief
|
||||
|
||||
??? example "May buy [buildingFilter] buildings for [amount] [stat] [cityFilter]"
|
||||
??? example "May buy [buildingFilter] buildings for [nonNegativeAmount] [stat] [cityFilter]"
|
||||
Example: "May buy [Culture] buildings for [3] [Culture] [in all cities]"
|
||||
|
||||
Applicable to: Global, FollowerBelief
|
||||
@ -1331,12 +1331,12 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: Global, FollowerBelief
|
||||
|
||||
??? example "May buy [baseUnitFilter] units with [stat] for [amount] times their normal Production cost"
|
||||
??? example "May buy [baseUnitFilter] units with [stat] for [nonNegativeAmount] times their normal Production cost"
|
||||
Example: "May buy [Melee] units with [Culture] for [3] times their normal Production cost"
|
||||
|
||||
Applicable to: Global, FollowerBelief
|
||||
|
||||
??? example "May buy [buildingFilter] buildings with [stat] for [amount] times their normal Production cost"
|
||||
??? example "May buy [buildingFilter] buildings with [stat] for [nonNegativeAmount] times their normal Production cost"
|
||||
Example: "May buy [Culture] buildings with [Culture] for [3] times their normal Production cost"
|
||||
|
||||
Applicable to: Global, FollowerBelief
|
||||
@ -2122,13 +2122,13 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
Due to performance considerations, this unique is cached, thus conditionals that may change within a turn may not work.
|
||||
Applicable to: Unit
|
||||
|
||||
??? example "[amount] Movement point cost to disembark"
|
||||
??? example "[nonNegativeAmount] Movement point cost to disembark"
|
||||
Example: "[3] Movement point cost to disembark"
|
||||
|
||||
Due to performance considerations, this unique is cached, thus conditionals that may change within a turn may not work.
|
||||
Applicable to: Global, Unit
|
||||
|
||||
??? example "[amount] Movement point cost to embark"
|
||||
??? example "[nonNegativeAmount] Movement point cost to embark"
|
||||
Example: "[3] Movement point cost to embark"
|
||||
|
||||
Due to performance considerations, this unique is cached, thus conditionals that may change within a turn may not work.
|
||||
@ -2706,7 +2706,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
## Tutorial uniques
|
||||
## CityState uniques
|
||||
??? example "Provides military units every ≈[amount] turns"
|
||||
??? example "Provides military units every ≈[positiveAmount] turns"
|
||||
Example: "Provides military units every ≈[3] turns"
|
||||
|
||||
Applicable to: CityState
|
||||
@ -2811,12 +2811,12 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<before turn number [amount]>"
|
||||
??? example "<before turn number [nonNegativeAmount]>"
|
||||
Example: "<before turn number [3]>"
|
||||
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<after turn number [amount]>"
|
||||
??? example "<after turn number [nonNegativeAmount]>"
|
||||
Example: "<after turn number [3]>"
|
||||
|
||||
Applicable to: Conditional
|
||||
@ -2856,7 +2856,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
??? example "<when nuclear weapons are enabled>"
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<with [amount]% chance>"
|
||||
??? example "<with [nonNegativeAmount]% chance>"
|
||||
Example: "<with [3]% chance>"
|
||||
|
||||
Applicable to: Conditional
|
||||
@ -3076,12 +3076,12 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<in cities with at least [amount] [populationFilter]>"
|
||||
??? example "<in cities with at least [positiveAmount] [populationFilter]>"
|
||||
Example: "<in cities with at least [3] [Followers of this Religion]>"
|
||||
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<in cities with [amount] [populationFilter]>"
|
||||
??? example "<in cities with [positiveAmount] [populationFilter]>"
|
||||
Example: "<in cities with [3] [Followers of this Religion]>"
|
||||
|
||||
Applicable to: Conditional
|
||||
@ -3156,12 +3156,12 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<when above [amount] HP>"
|
||||
??? example "<when above [positiveAmount] HP>"
|
||||
Example: "<when above [3] HP>"
|
||||
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<when below [amount] HP>"
|
||||
??? example "<when below [positiveAmount] HP>"
|
||||
Example: "<when below [3] HP>"
|
||||
|
||||
Applicable to: Conditional
|
||||
@ -3169,7 +3169,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
??? example "<if it hasn't used other actions yet>"
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<with [amount] to [amount] neighboring [tileFilter] tiles>"
|
||||
??? example "<with [nonNegativeAmount] to [positiveAmount] neighboring [tileFilter] tiles>"
|
||||
Example: "<with [3] to [3] neighboring [Farm] tiles>"
|
||||
|
||||
Applicable to: Conditional
|
||||
@ -3184,7 +3184,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<within [amount] tiles of a [tileFilter]>"
|
||||
??? example "<within [positiveAmount] tiles of a [tileFilter]>"
|
||||
Example: "<within [3] tiles of a [Farm]>"
|
||||
|
||||
Applicable to: Conditional
|
||||
@ -3381,7 +3381,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: UnitTriggerCondition
|
||||
|
||||
??? example "<upon losing at least [amount] HP in a single attack>"
|
||||
??? example "<upon losing at least [positiveAmount] HP in a single attack>"
|
||||
Example: "<upon losing at least [3] HP in a single attack>"
|
||||
|
||||
Applicable to: UnitTriggerCondition
|
||||
@ -3419,8 +3419,8 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
Will consume all Movement to execute
|
||||
Applicable to: UnitActionModifier
|
||||
|
||||
??? example "<requires [amount] movement>"
|
||||
Requires [amount] of Movement to execute. Unit's Movement is rounded up
|
||||
??? example "<requires [nonNegativeAmount] movement>"
|
||||
Requires [nonNegativeAmount] of Movement to execute. Unit's Movement is rounded up
|
||||
Example: "<requires [3] movement>"
|
||||
|
||||
Applicable to: UnitActionModifier
|
||||
@ -3446,12 +3446,12 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
??? example "<once>"
|
||||
Applicable to: UnitActionModifier
|
||||
|
||||
??? example "<[amount] times>"
|
||||
??? example "<[positiveAmount] times>"
|
||||
Example: "<[3] times>"
|
||||
|
||||
Applicable to: UnitActionModifier
|
||||
|
||||
??? example "<[amount] additional time(s)>"
|
||||
??? example "<[nonNegativeAmount] additional time(s)>"
|
||||
Example: "<[3] additional time(s)>"
|
||||
|
||||
Applicable to: UnitActionModifier
|
||||
@ -3464,7 +3464,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Modifiers that can be added to other uniques changing user experience, not their behavior
|
||||
|
||||
??? example "<for [amount] turns>"
|
||||
??? example "<for [nonNegativeAmount] turns>"
|
||||
Turns this unique into a trigger, activating this unique as a *global* unique for a number of turns
|
||||
Example: "<for [3] turns>"
|
||||
|
||||
@ -3483,7 +3483,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: MetaModifier
|
||||
|
||||
??? example "<for every [amount] [countable]>"
|
||||
??? example "<for every [positiveAmount] [countable]>"
|
||||
Example: "<for every [3] [1000]>"
|
||||
|
||||
Applicable to: MetaModifier
|
||||
@ -3521,6 +3521,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
*[fraction]: Indicates a fractional number, which can be negative.
|
||||
*[improvementName]: The name of any improvement excluding 'Cancel improvement order'
|
||||
*[modFilter]: A Mod name, case-sensitive _or_ a simple wildcard filter beginning and ending in an Asterisk, case-insensitive.
|
||||
*[nonNegativeAmount]: This indicates a non-negative whole number, larger than or equal to zero, a '+' sign is optional.
|
||||
*[policy]: The name of any policy.
|
||||
*[policyFilter]: The name of any policy.
|
||||
*[positiveAmount]: This indicates a positive whole number, larger than zero, a '+' sign is optional.
|
||||
|
@ -3,15 +3,14 @@ package com.unciv.uniques
|
||||
import com.unciv.models.metadata.BaseRuleset
|
||||
import com.unciv.models.ruleset.Ruleset
|
||||
import com.unciv.models.ruleset.RulesetCache
|
||||
import com.unciv.models.ruleset.unique.Countables
|
||||
import com.unciv.models.ruleset.unique.StateForConditionals
|
||||
import com.unciv.models.ruleset.unique.Unique
|
||||
import com.unciv.models.ruleset.unique.UniqueTriggerActivation
|
||||
import com.unciv.models.ruleset.unique.*
|
||||
import com.unciv.models.ruleset.validation.RulesetValidator
|
||||
import com.unciv.models.stats.Stat
|
||||
import com.unciv.models.translations.getPlaceholderParameters
|
||||
import com.unciv.testing.GdxTestRunner
|
||||
import com.unciv.testing.TestGame
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNotEquals
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@ -25,6 +24,18 @@ class CountableTests {
|
||||
private var civInfo = game.addCiv()
|
||||
private var city = game.addCity(civInfo, game.tileMap[2,0])
|
||||
|
||||
|
||||
@Test
|
||||
fun testAllCountableParametersAreUniqueParameterTypes() {
|
||||
for (countable in Countables.entries) {
|
||||
val parameters = countable.text.getPlaceholderParameters()
|
||||
for (parameter in parameters) {
|
||||
assertNotEquals("Countable ${countable.name} parameter ${parameter} is not a UniqueParameterType",
|
||||
UniqueParameterType.safeValueOf(parameter), UniqueParameterType.Unknown)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testPerCountableForGlobalAndLocalResources() {
|
||||
// one coal provided locally
|
||||
|
Loading…
x
Reference in New Issue
Block a user