mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-03-21 17:25:10 -05:00
Allow passing teams to random formats
The team validator will now complain if try to bring a team to a random format. Also, if you bypass the validator (such as with `/importinputlog` or using the JS API directly), you can now use custom teams in random formats. Fixes #8144
This commit is contained in:
parent
d18c0a4e1f
commit
d4b6ba4c0f
|
|
@ -54,7 +54,7 @@ export const PM = new QueryProcessManager<{
|
|||
team,
|
||||
});
|
||||
problems = [
|
||||
`Your team crashed the validator. We'll fix this crash within a few minutes (we're automatically notified),` +
|
||||
`Your team crashed the validator. We'll fix this crash within a few hours (we're automatically notified),` +
|
||||
` but if you don't want to wait, just use a different team for now.`,
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2611,7 +2611,7 @@ export class Battle {
|
|||
getTeam(options: PlayerOptions): PokemonSet[] {
|
||||
let team = options.team;
|
||||
if (typeof team === 'string') team = Dex.fastUnpackTeam(team);
|
||||
if ((!this.format.team || this.deserialized) && team) return team;
|
||||
if (team) return team;
|
||||
|
||||
if (!options.seed) {
|
||||
options.seed = PRNG.generateSeed();
|
||||
|
|
|
|||
|
|
@ -230,10 +230,22 @@ export class TeamValidator {
|
|||
let problems: string[] = [];
|
||||
const ruleTable = this.ruleTable;
|
||||
if (format.team) {
|
||||
if (team) {
|
||||
return [
|
||||
`This format doesn't let you use your own team.`,
|
||||
`If you're not using a custom client, please report this as a bug. If you are, remember to use \`/utm null\` before starting a game in this format.`,
|
||||
];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (!team || !Array.isArray(team)) {
|
||||
return [`You sent invalid team data. If you're not using a custom client, please report this as a bug.`];
|
||||
if (!team) {
|
||||
return [
|
||||
`This format requires you to use your own team.`,
|
||||
`If you're not using a custom client, please report this as a bug.`,
|
||||
];
|
||||
}
|
||||
if (!Array.isArray(team)) {
|
||||
throw new Error(`Invalid team data`);
|
||||
}
|
||||
|
||||
let [minSize, maxSize] = format.teamLength && format.teamLength.validate || [1, 6];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user