Skip to content

Commit

Permalink
Update random-teams.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisXV authored Dec 7, 2023
1 parent 078c26c commit 67330d8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions data/random-teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2047,7 +2047,9 @@ export class RandomTeams {
// Picks `n` random pokemon--no repeats, even among formes
// Also need to either normalize for formes or select formes at random
// Unreleased are okay but no CAP
const last = [0, 151, 251, 386, 493, 649, 721, 807, 898, 1017][this.gen];

if (n <= 0 || n > last) throw new Error(`n must be a number between 1 and ${last} (got ${n})`);
if (requiredType && !this.dex.types.get(requiredType).exists) {
throw new Error(`"${requiredType}" is not a valid type.`);
}
Expand All @@ -2069,6 +2071,7 @@ export class RandomTeams {
if (minSourceGen && species.gen < minSourceGen) continue;
const num = species.num;
if (num <= 0 || pool.includes(num)) continue;
if (num > last) break;
pool.push(num);
}
} else {
Expand Down

0 comments on commit 67330d8

Please sign in to comment.