Multi-filter improve code clarity and more unit tests (#11503)

* Some linting and region reorder

* Make MultiFilter accept a negated "and" list plus more unit tests

* MultiFilter gets 'or' capability

* Revert "MultiFilter gets 'or' capability"

This reverts commit 9f6e7c794a.
This commit is contained in:
SomeTroglodyte
2024-04-23 23:00:40 +02:00
committed by GitHub
parent 1bc1f33dfd
commit 9dcfb963e3
9 changed files with 193 additions and 111 deletions

View File

@ -15,19 +15,20 @@ All filters except for `populationFilter` accept multiple values in the format:
> Example: `[{Military} {Water}] units`, `[{Wounded} {Armor}] units`, etc.
No space or other text is allowed between the `[` and the first `{`.
No space or other text is allowed between the `[` and the first `{`, nor between the last `}` and the ending `]`. The space in `} {`, however, is mandatory.
All filters accept `non-[filter]` as a possible value
> Example: `[non-[Wounded]] units`
These can be combined by having the values be negative filters
These can be combined by nesting, with the exception that an "ALL" filter cannot contain another "ALL" filter, even with a NON-filter in between.
> Example: `[{non-[Wounded]} {Armor}] units`
> Example: `[{non-[Wounded]} {Armor}] units` means unit is type Armor and at full health.
> Example: `[non-[{Wounded} {Armor}]] units` means unit is neither wounded nor an Armor one.
These CANNOT be combined in the other way - e.g. `[non-[{Wounded} {Armor}]] units` is NOT valid and will fail to register any units.
`[{non-[{Wounded} {Armor}]} {Embarked}] units` WILL FAIL because the game will treat both "} {" at the same time and see `non-[{Wounded` and `Armor}]`, both invalid.
This is because to the player, the text will be `non-Wounded Armor units`, which parses like `[{non-[Wounded]} {Armor}] units`
Display of complex filters in Civilopedia may become unreadable. If so, consider hiding that unique and provide a better wording using the `Comment []` unique separately.
## civFilter
@ -125,6 +126,7 @@ cityFilters allow us to choose the range of cities affected by this unique:
- `in foreign cities`, `Foreign`
- `in annexed cities`, `Annexed`
- `in puppeted cities`, `Puppeted`
- `in cities being razed`, `Razing`
- `in holy cities`, `Holy`
- `in City-State cities`
- `in cities following this religion` - Should only be used in pantheon/follower uniques for religions