From c55e6f6fde180d4f61e07234e0bf6172c236b51b Mon Sep 17 00:00:00 2001 From: dot-Comfey <84290266+dot-Comfey@users.noreply.github.com> Date: Wed, 2 Oct 2024 14:51:41 -0700 Subject: [PATCH] Properly validate cosmetic forms in learnsetDomain (#10597) --- sim/dex-species.ts | 2 +- sim/team-validator.ts | 3 +++ test/sim/team-validator/misc.js | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sim/dex-species.ts b/sim/dex-species.ts index ae91296184eb..1dc4c75a3331 100644 --- a/sim/dex-species.ts +++ b/sim/dex-species.ts @@ -578,7 +578,7 @@ export class DexSpecies { const movePool = new Set(); for (const {species, learnset} of this.getFullLearnset(id)) { for (const moveid in learnset) { - eggMovesOnly = this.eggMovesOnly(species, this.get(id)); + if (!eggMovesOnly) eggMovesOnly = this.eggMovesOnly(species, this.get(id)); if (eggMovesOnly) { if (learnset[moveid].some(source => source.startsWith('9E'))) { movePool.add(moveid as ID); diff --git a/sim/team-validator.ts b/sim/team-validator.ts index 88514cea46a5..aa366da60748 100644 --- a/sim/team-validator.ts +++ b/sim/team-validator.ts @@ -2779,6 +2779,9 @@ export class TeamValidator { nextSpecies = baseSpecies; let speciesCount = 0; if (!tradebackEligible) { + if (!dex.species.getLearnsetData(nextSpecies.id).learnset) { + nextSpecies = dex.species.get(nextSpecies.changesFrom || nextSpecies.baseSpecies); + } while (nextSpecies) { for (let gen = nextSpecies.gen; gen <= dex.gen; gen++) { /** diff --git a/test/sim/team-validator/misc.js b/test/sim/team-validator/misc.js index 4e9b1368629a..10c1ddf81bf5 100644 --- a/test/sim/team-validator/misc.js +++ b/test/sim/team-validator/misc.js @@ -209,6 +209,7 @@ describe('Team Validator', function () { team = [ {species: 'incineroar', ability: 'blaze', moves: ['knockoff', 'partingshot'], evs: {hp: 1}}, + {species: 'shelloseast', ability: 'stickyhold', moves: ['infestation', 'stringshot'], evs: {hp: 1}}, ]; assert.legalTeam(team, 'gen8ou'); });