From f52bc482bb43057f6566a55cb0e10adca7b179b0 Mon Sep 17 00:00:00 2001 From: Kris Johnson <11083252+KrisXV@users.noreply.github.com> Date: Wed, 1 Oct 2025 21:13:50 -0600 Subject: [PATCH] Add Terastal Crescendo online competition (#11471) * Add Terastal Crescendo online competition * Fix build --- config/formats.ts | 8 ++++++++ data/rulesets.ts | 14 +++++++++----- sim/side.ts | 11 ++++++----- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/config/formats.ts b/config/formats.ts index e791d1e392..7b512ee950 100644 --- a/config/formats.ts +++ b/config/formats.ts @@ -272,6 +272,14 @@ export const Formats: import('../sim/dex-formats').FormatList = [ ruleset: ['Flat Rules', '!! Adjust Level = 50', 'Min Source Gen = 9', 'VGC Timer', 'Force Open Team Sheets', 'Best of = 3', 'Limit Two Restricted'], restricted: ['Restricted Legendary', 'Mythical'], }, + { + name: "[Gen 9] Terastal Crescendo", + mod: 'gen9', + gameType: 'doubles', + ruleset: ['Flat Rules', '!! Picked Team Size = 2', 'Min Team Size = 4', '!! Adjust Level = 50', 'Min Source Gen = 9', 'VGC Timer', 'Limit One Restricted', 'Force Select = Koraidon | Miraidon'], + unbanlist: ['Koraidon', 'Miraidon'], + restricted: ['Koraidon', 'Miraidon'], + }, { name: "[Gen 9] Doubles Custom Game", mod: 'gen9', diff --git a/data/rulesets.ts b/data/rulesets.ts index 1e43f0b63d..eeabd803f4 100644 --- a/data/rulesets.ts +++ b/data/rulesets.ts @@ -566,22 +566,26 @@ export const Rulesets: import('../sim/dex-formats').FormatDataTable = { forceselect: { effectType: 'ValidatorRule', name: 'Force Select', - desc: `Forces a Pokemon to be on the team and selected at Team Preview. Usage: Force Select = [Pokemon], e.g. "Force Select = Magikarp"`, + desc: `Forces a Pokemon to be on the team and selected at Team Preview. Usage: Force Select = [Pokemon], e.g. "Force Select = Magikarp" or "Force Select = Koraidon | Miraidon"`, hasValue: true, onValidateRule(value) { - if (!this.dex.species.get(value).exists) throw new Error(`Misspelled Pokemon "${value}"`); + const values = value.split('|'); + if (values.some(v => !this.dex.species.get(v).exists)) throw new Error(`Misspelled Pokemon provided in "${value}"`); }, onValidateTeam(team) { let hasSelection = false; - const species = this.dex.species.get(this.ruleTable.valueRules.get('forceselect')); + const speciesNameList = this.ruleTable.valueRules.get('forceselect')!.split('|') + .map(value => this.dex.species.get(value).name); for (const set of team) { - if (species.name === set.species) { + if (speciesNameList.includes(set.species)) { hasSelection = true; break; } } if (!hasSelection) { - return [`Your team must contain ${species.name}.`]; + return [ + `Your team must contain ${speciesNameList.length > 1 ? `one of: ${speciesNameList.join(', ')}` : speciesNameList[0]}.`, + ]; } }, // hardcoded in sim/side diff --git a/sim/side.ts b/sim/side.ts index 643c884bcb..13fda89134 100644 --- a/sim/side.ts +++ b/sim/side.ts @@ -1023,22 +1023,23 @@ export class Side { } } if (ruleTable.valueRules.has('forceselect')) { - const species = this.battle.dex.species.get(ruleTable.valueRules.get('forceselect')); + const speciesList = ruleTable.valueRules.get('forceselect')!.split('|') + .map(entry => this.battle.dex.species.get(entry).name); if (!data) { // autoChoose - positions = [...this.pokemon.keys()].filter(pos => this.pokemon[pos].species.name === species.name) - .concat([...this.pokemon.keys()].filter(pos => this.pokemon[pos].species.name !== species.name)) + positions = [...this.pokemon.keys()].filter(pos => speciesList.includes(this.pokemon[pos].species.name)) + .concat([...this.pokemon.keys()].filter(pos => !speciesList.includes(this.pokemon[pos].species.name))) .slice(0, pickedTeamSize); } else { let hasSelection = false; for (const pos of positions) { - if (this.pokemon[pos].species.name === species.name) { + if (speciesList.includes(this.pokemon[pos].species.name)) { hasSelection = true; break; } } if (!hasSelection) { - return this.emitChoiceError(`You must bring ${species.name} to the battle.`); + return this.emitChoiceError(`You must bring ${speciesList.length > 1 ? `one of ${speciesList.join(', ')}` : speciesList[0]} to the battle.`); } } }