From 02d7325576dfd23493653cc4d0ef2437fc8b4632 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 12 Jun 2023 23:13:47 +0300 Subject: [PATCH] UnitFilter also matches TechFilter for that unit --- core/src/com/unciv/models/ruleset/unit/BaseUnit.kt | 2 ++ docs/Modders/Unique-parameters.md | 1 + 2 files changed, 3 insertions(+) diff --git a/core/src/com/unciv/models/ruleset/unit/BaseUnit.kt b/core/src/com/unciv/models/ruleset/unit/BaseUnit.kt index 8a47853229..de0542ca81 100644 --- a/core/src/com/unciv/models/ruleset/unit/BaseUnit.kt +++ b/core/src/com/unciv/models/ruleset/unit/BaseUnit.kt @@ -301,8 +301,10 @@ class BaseUnit : RulesetObject(), INonPerpetualConstruction { "Nuclear Weapon" -> isNuclearWeapon() "Great Person" -> isGreatPerson() "Religious" -> hasUnique(UniqueType.ReligiousUnit) + else -> { if (type.matchesFilter(filter)) return true + if (requiredTech != null && ruleset.technologies[requiredTech]?.matchesFilter(filter)==true) return true if ( // Uniques using these kinds of filters should be deprecated and replaced with adjective-only parameters filter.endsWith(" units") diff --git a/docs/Modders/Unique-parameters.md b/docs/Modders/Unique-parameters.md index ef91d505d4..10b83bb830 100644 --- a/docs/Modders/Unique-parameters.md +++ b/docs/Modders/Unique-parameters.md @@ -41,6 +41,7 @@ The following are allowed to be used: - `Nuclear Weapon` - `Great Person`, `Great` - `Embarked` +- Matching [technologyfilter](#technologyfilter) for the tech this unit requires - e.g. `Modern Era` - Any exact unique the unit has - 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 `{`.