From 78e4d3945b072d0a7e8a22ec4e5cf145cf5e44d4 Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Wed, 23 Oct 2019 13:57:45 +1030 Subject: [PATCH] Fix Nidoqueen egg move validation --- server/room-battle.ts | 6 +++++- sim/team-validator.ts | 1 + test/sim/team-validator.js | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/server/room-battle.ts b/server/room-battle.ts index 04d6200045..17e89ea79f 100644 --- a/server/room-battle.ts +++ b/server/room-battle.ts @@ -24,7 +24,11 @@ type PlayerIndex = 1 | 2 | 3 | 4; interface BattleRequestTracker { rqid: number; request: string; - // true = user has decided, false = user has yet to decide, 'cantUndo' = waiting on other user (U-turn, faint-switch) or uncancellable (trapping ability) + /** + * - true = user has decided, + * - false = user has yet to decide, + * - 'cantUndo' = waiting on other user (U-turn, faint-switch) or uncancellable (trapping ability) + */ isWait: 'cantUndo' | true | false; choice: string; } diff --git a/sim/team-validator.ts b/sim/team-validator.ts index 095a434300..71dd7cbb16 100644 --- a/sim/team-validator.ts +++ b/sim/team-validator.ts @@ -940,6 +940,7 @@ export class TeamValidator { // In Gen 5 and earlier, egg moves can only be inherited from the father // we'll test each possible father separately let eggGroups = template.eggGroups; + if (template.id === 'nidoqueen') eggGroups = dex.getTemplate(template.prevo).eggGroups; if (eggGroups[0] === 'Undiscovered') eggGroups = dex.getTemplate(template.evos[0]).eggGroups; if (eggGroups[0] === 'Undiscovered' || !eggGroups.length) { throw new Error(`${template.species} has no egg groups`); diff --git a/test/sim/team-validator.js b/test/sim/team-validator.js index 9399956ca5..f5855abe61 100644 --- a/test/sim/team-validator.js +++ b/test/sim/team-validator.js @@ -273,6 +273,8 @@ describe('Team Validator', function () { team = [ {species: 'tyranitar', ability: 'unnerve', moves: ['dragondance'], evs: {hp: 1}}, {species: 'staraptor', ability: 'reckless', moves: ['pursuit'], evs: {hp: 1}}, + // Nidoqueen can't breed but can still get egg moves from prevos + {species: 'nidoqueen', ability: 'poisonpoint', moves: ['charm'], evs: {hp: 1}}, ]; illegal = TeamValidator.get('gen5ou').validateTeam(team); assert.strictEqual(illegal, null);