Overview

A slightly stronger tool with which to match Pokémon instances conditionally. Checks that its constituent properties, labels, persistent data, and/or buckets all match the given Pokémon when asked. Even has a codec for simple parsing.

Pieces

Properties

The properties property of a PokemonMatcher is the same tool used by Cobblemon itself when you use the /pokespawn or /pokeedit commands. For a full list of things this can match against, check out the PokemonProperties file for the version of Cobblemon you’re using (here’s v1.6.1’s version). The value is empty by default, matching all Pokémon.

Labels

The labels property of a PokemonMatcher - together with anyLabel - determines whether or not a given Pokémon’s current form holds either one or all of these labels. For instance, here’s where Cobblemon v1.6.1 adds the legendary label to Mewtwo. By default, the label list is empty, matching all Pokémon as an empty list is ignored.

If anyLabel is true, the Pokémon will only have to match one label in the list, otherwise it will have to match all of them; the value is false by default, requiring a match for all of them.

Persistent Data

The persistentData property of a PokemonMatcher together with anyPersistentData - determines whether or not a given Pokémon’s persistent data matches against the key-value pairs. Under the hood, does an untyped get-or-null for each key, then converts that to a string and compares against the corresponding value. By default, the persistent data is empty, matching all Pokémon as an empty map is ignored.

If anyPersistentData is true, the Pokémon’s persistent data will only have to match one property in the object, otherwise it will have to match all of them; the value is false by default, requiring a match for all of them.

Buckets

The buckets property of a PokemonMatcher is a list of valid spawning buckets for this Pokémon. By default, Cobblemon has the following buckets: common, uncommon, rare, and ultra-rare, though a side content dev may add more via Cobblemon’s spawner config, and the team may add more in the future. By default, the list is empty, matching all Pokémon as an empty list is ignored.

Forms

The forms property of a PokemonMatcher is a list of valid forms for this Pokémon. The form names must be given exactly as they are given in the species data file for the Pokémon. This will match if any of the forms in the last match the given Pokémon’s form, as Pokémon can only have the one form.

All or One

The matchOne property, which is false by default, causes the PokemonMatcher to match the given Pokémon if any of the properties, labels, persistent data, or buckets predicates individually match, when its value is true.