From cb626861df8502340a35c86241a044ab45b78fff Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 25 Apr 2023 17:45:00 +0300 Subject: [PATCH] docs: better unique parameter documentation --- .../ruleset/unique/UniqueParameterType.kt | 2 +- docs/Modders/Unique-parameters.md | 51 +++++++++++-------- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueParameterType.kt b/core/src/com/unciv/models/ruleset/unique/UniqueParameterType.kt index d3d47f1556de5..c2972eb7ce5cf 100644 --- a/core/src/com/unciv/models/ruleset/unique/UniqueParameterType.kt +++ b/core/src/com/unciv/models/ruleset/unique/UniqueParameterType.kt @@ -70,7 +70,7 @@ enum class UniqueParameterType( } }, - /** Implemented by [MapUnit.matchesFilter][com.unciv.logic.map.MapUnit.matchesFilter] */ + /** Implemented by [MapUnit.matchesFilter][com.unciv.logic.map.mapunit.MapUnit.matchesFilter] */ MapUnitFilter("mapUnitFilter", Constants.wounded, null, "Map Unit Filters") { private val knownValues = setOf(Constants.wounded, Constants.barbarians, "City-State", Constants.embarked, "Non-City") override fun getErrorSeverity(parameterText: String, ruleset: Ruleset): diff --git a/docs/Modders/Unique-parameters.md b/docs/Modders/Unique-parameters.md index ecb1cad2bd0bc..ef91d505d47cb 100644 --- a/docs/Modders/Unique-parameters.md +++ b/docs/Modders/Unique-parameters.md @@ -9,6 +9,16 @@ These are split into two categories: Note that all of these are case-sensitive! +## nationFilter + +Allows filtering for specific nations. + +- `All` +- `City-states` +- `Major` +- Nation name +- A unique a Nation has (verbatim, no placeholders) + ## baseUnitFilter Unit filters can be divided up into two parts: `baseUnitFilter`s and `mapUnitFilter`s. @@ -35,6 +45,19 @@ The following are allowed to be used: - Any exact unique the unit type has - Any combination of the above (will match only if all match). The format is `{filter1} {filter2}` and can match any number of filters. For example: `[{Military} {Water}]` units, `[{non-air} {Armor}]` units, etc. No space or other text is allowed between the `[` and the first `{`. +## mapUnitFilter + +This indicates a unit as placed on the map. Compare with `baseUnitFilter`. + +- Any matching [baseUnitFilter](#baseunitfilter) +- Any [nationFilter](#nationfilter) matching the owner +- Any unique the unit has - also includes uniques not caught by the [baseUnitFilter](#baseunitfilter), for example promotions +- `Wounded` +- `Embarked` +- `City-State` +- `Barbarians`, `Barbarian` +- Again, any combination of the above is also allowed, e.g. `[{Wounded} {Water}]` units. + ## buildingFilter Allows to only activate a unique for certain buildings. Allowed options are: @@ -53,16 +76,6 @@ Allows to only activate a unique for certain buildings. Allowed options are: - Provides that stat as a bonus for resources (e.g. +1 Food from every Wheat) - Provides that stat per some amount of population (e.g. +1 Science for every 2 population [cityFilter]) -## nationFilter - -Allows filtering for specific nations. - -- `All` -- `City-states` -- `Major` -- Nation name -- A unique a Nation has (verbatim, no placeholders) - ## cityFilter cityFilters allow us to choose the range of cities affected by this unique: @@ -97,17 +110,6 @@ Allowed values are: - `All Road` - for Roads & Railroads -## mapUnitFilter - -This indicates a unit as placed on the map. Compare with `baseUnitFilter`. - -- Any value noted in `baseUnitFilter` -- `Wounded` -- `Embarked` -- `City-State` -- `Barbarians`, `Barbarian` -- Again, any combination of the above is also allowed, e.g. `[{Wounded} {Water}]` units. - ## populationFilter A filter determining a part of the population of a city. It can be any of the following values: @@ -186,6 +188,13 @@ Also note: Resource filters depend on whether a viewing civ is known in the cont So for instance, the unique "[stats] from [tileFilter] tiles [cityFilter]" can match several cases: +## tileFilter + +Any of: +- [terrainFilter](#terrainfilter) for this tile +- [improvementFilter](#improvementfilter) for this tile +- `unimproved' if no improvement exists + ## terrainQuality Used to indicate for what use the terrain should be viewed when dividing the world into regions, in each of which a single player is placed at the start of the game.