In VGC and Battle Spot, the validator wouldn't do any validation at all
if you didn't bring the minimum number of Pokemon. Now, it still gives
other error messages in addition to "You need at least X Pokemon".
This is mostly nice for validating a single Pokemon for VGC etc without
needing to fill the rest of the team with junk.
The old code tried to validate by changing incorrect values to correct
values, but had lots of bugs. Even if it didn't have bugs, it would have
various flaws like stats being different from what you would expect from
the teambuilder, so the new code just tells you when your HP DV,
shininess, gender, and Hidden Power type are inconsistent with your
other DVs.
(The one exception is SD Thick Club Marowak, which still automatically
fixes its Atk IV, since we still don't have teambuilder UI for that.)
Because of the way fastUnpackTeam works, it's currently a reasonable
assumption that all the values in a `set` are IDs, and various parts
of the code have started to rely on that assumption.
Removing some old code to try to guarantee that the values in a `set`
are names allow us to work towards a new guarantee that `set` values
are IDs.
Closes#2553
This is a huge refactor that consolidates many different places event,
DW, and VC moves are validated, so that they're now validated in the
single place Validator#validateEvent. DW and VC moves are now treated
as special cases of events.
Validator#checkLearnset now does zero validation of event, DW, and VC
moves; it now simply passes the list of possible sources back to
Validator#validateSet, and it's validateSet's job to determine if the
Pokemon meets the requirements for any of those sources.
(In addition to simplifying checkLearnset, this also means more
useful error messages if you fail to meet the requirements for an
event move or DW move.)
validateSet should also be a decent margin simpler, due to a lot of
its code being folded into validateEvent.
Virtual Console validation wasn't happening for Pokemon who learn a
move from Virtual Console from multiple Pokemon in its evo family.
This is most relevant for No Guard Fissure Machamp, which shouldn't
be legal.
This adds validator support for Gen 1 Virtual Console moves.
Fixes#3208
If anyone wants the quick-and-dirty eval script I used to update
Learnsets:
```
Object.entries(Tools.mod('gen1').data.Learnsets).forEach(([speciesid, lset]) => {
Object.entries(lset.learnset).forEach(([moveid, sources]) => {
if (sources.some(s => s.startsWith('1L') || s.startsWith('1M'))) {
let newLset = Tools.data.Learnsets[speciesid].learnset;
if (!newLset[moveid]) newLset[moveid] = [];
let i = 0;
while (i < newLset[moveid].length && newLset[moveid][i].startsWith('7')) i++;
newLset[moveid].splice(i, 0, '7V');
}
})
})
```
Now that we now store Hidden Power type separately from IVs, we can
make some major changes to how Hidden Power is validated.
Instead of Hidden Power type being calculated from the IVs, it's now
sent separately as part of the set. This allows us to warn in the
validator if the Hidden Power type specified by the moveset is
different from the one calculated from the IVs, and give a validation
error if so.
This also allows us to validate the Hidden Power type (pre-bottle-cap
IVs) separately from the set IVs (post-bottle-cap IVs) when doing
event validation, which fixes some validation issues relating to
Hidden Power.
Previously, "requirePentagon" meant "only allow current-gen Pokemon".
Now, "requirePentagon" means "allow Gen 6 Pokemon and later", and
"requirePlus" means "allow Gen 7 Pokemon and later".
The last 7 commits to team-validator take the code in the wrong
direction. While it's possible that the latest one fixes the validation
issues for VGC, they misuse variable names and in general need to be
redone from scratch.
Event-only Pokemon now receive detailed event compatibility
error messages, like we do for event moves.
Event move/ability information is now fixed, so the validator now
explicitly specifies whether it's a move or ability that a move is
incompatible with.
Related: We no longer warn about event IV compatibility for level 100
Pokemon in Gen 7.
This introduces a new ability slot 'S' which corresponds to Battle
Bond only.
There's also a little bit of a hack to consider Battle Bond Greninja
Ash-Greninja for the purposes of move and event validation.