Support Gen5/3DS/Switch word filters #4423
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Separate 3DS/Switch word filters
Instead of using a superset of both the 3DS/Switch filters, use a separate list of filters for each. This should reduce the number of false positives due to the wrong list being applied for the console.
The filters themselves are taken from the latest 3DS version 11.17.0-50 and the latest Switch version 19.0.1 (rebootless). It doesn't seem that useful to flag something that used to be filtered if it's not flagged anymore, so none of the ones that were only in earlier versions are included. I was also able to trim about 15% of the regexes in each list, due to them being subsets of another regex in the list (e.g.
^abc$
⊆.*abc.*
).Handle 3DS/Switch word filter edge cases
The name being checked is normalized more thoroughly to match the console's behavior:
This catches a few more strings that are filtered on the console:
.*フアツク.*
.*オツパイ.*
Also, if a name matches the name of a Pokémon in any language, it bypasses the filter. In Gen6 this is case-sensitive, but it Gen7+ it is case-insensitive. This means that "cOfAgRiGuS" doesn't pass in Gen6, but does in Gen7+.
Add/implement Gen5 word filter
Gen5 only checks for an exact match after normalization. The normalization is fairly naive, so a bunch of the filters don't actually work--most of the weird behavior should be captured in the test cases. Pokémon from Gen3/4 technically shouldn't have this filter applied, but that's not currently handled.
Adjust behavior of DisableWordFilterPastGen
Previously, this simply disabled the word filters in Gen1-5. It now prevents future word filters from being applied to the current context. With this option enabled, a PK5 will only be checked against the Gen5 list; likewise, a PK6 or PK7 will only be checked against the 3DS list. With it disabled (still the default), a PK5 will be checked against the Switch, 3DS, and Gen5 lists, and a PK6/7 will be checked against the Switch and 3DS lists, so you'll know if its name will be changed on transfer.