Fix Nidoqueen egg move validation

This commit is contained in:
Guangcong Luo 2019-10-23 13:57:45 +10:30
parent 971f028742
commit 78e4d3945b
3 changed files with 8 additions and 1 deletions

View File

@ -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;
}

View File

@ -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`);

View File

@ -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);