From 56f6ab54897d890b31699243ae3362fb3ea84ddc Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Fri, 1 May 2020 12:52:58 -0700 Subject: [PATCH] Fix Zygarde-Complete validation --- server/chat-plugins/random-battles.ts | 5 +++++ sim/team-validator.ts | 20 ++++++++++++-------- tools/set-import/importer.ts | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/server/chat-plugins/random-battles.ts b/server/chat-plugins/random-battles.ts index 8cb70489c389d..8b15550cedbcc 100644 --- a/server/chat-plugins/random-battles.ts +++ b/server/chat-plugins/random-battles.ts @@ -379,6 +379,11 @@ export const commands: ChatCommands = { if (typeof bfSets === 'string') { bfSets += battleFactorySets(Dex.getSpecies('necrozma-duskmane'), tier, mod); } + } else if (species.name === 'Zygarde-Complete') { + bfSets = battleFactorySets(Dex.getSpecies('zygarde'), tier, mod); + if (typeof bfSets === 'string') { + bfSets += battleFactorySets(Dex.getSpecies('zygarde-10'), tier, mod); + } } else { bfSets = battleFactorySets(species, tier, mod); } diff --git a/sim/team-validator.ts b/sim/team-validator.ts index 42e9e8457d4f9..df89aa85c35ad 100644 --- a/sim/team-validator.ts +++ b/sim/team-validator.ts @@ -1125,34 +1125,38 @@ export class TeamValidator { const species = dex.getSpecies(set.species); if (species.name === 'Necrozma-Ultra') { + const whichMoves = (set.moves.includes('Sunsteel Strike') ? 1 : 0) + + (set.moves.includes('Moongeist Beam') ? 2 : 0); if (item.name !== 'Ultranecrozium Z') { // Necrozma-Ultra transforms from one of two formes, and neither one is the base forme problems.push(`Necrozma-Ultra must start the battle holding Ultranecrozium Z.`); - } else if (set.moves.includes('Sunsteel Strike')) { + } else if (whichMoves === 1) { set.species = 'Necrozma-Dusk-Mane'; - } else if (set.moves.includes('Moongeist Beam')) { + } else if (whichMoves === 2) { set.species = 'Necrozma-Dawn-Wings'; } else { - problems.push(`Necrozma-Ultra must start the battle as Necrozma-Dusk-Mane or Necrozma-Dawn-Wings holding Ultranecrozium Z.`); + problems.push(`Necrozma-Ultra must start the battle as Necrozma-Dusk-Mane or Necrozma-Dawn-Wings holding Ultranecrozium Z. Please specify which Necrozma it should start as.`); } + } else if (species.name === 'Zygarde-Complete') { + problems.push(`Zygarde-Complete must start the battle as Zygarde or Zygarde-10% with Power Construct. Please specify which Zygarde it should start as.`); } else if (species.battleOnly) { if (species.requiredAbility && set.ability !== species.requiredAbility) { - // Darmanitan-Zen, Zygarde-Complete - problems.push(`${species.name} transforms in-battle with ${species.requiredAbility}.`); + // Darmanitan-Zen + problems.push(`${species.name} transforms in-battle with ${species.requiredAbility}, please fix its ability.`); } if (species.requiredItems) { if (!species.requiredItems.includes(item.name)) { // Mega or Primal - problems.push(`${species.name} transforms in-battle with ${species.requiredItem}.`); + problems.push(`${species.name} transforms in-battle with ${species.requiredItem}, please fix its item.`); } } if (species.requiredMove && !set.moves.includes(toID(species.requiredMove))) { // Meloetta-Pirouette, Rayquaza-Mega - problems.push(`${species.name} transforms in-battle with ${species.requiredMove}.`); + problems.push(`${species.name} transforms in-battle with ${species.requiredMove}, please fix its moves.`); } if (!species.isGigantamax) { if (typeof species.battleOnly !== 'string') { - // Ultra Necrozma is already checked above + // Ultra Necrozma and Complete Zygarde are already checked above throw new Error(`${species.name} should have a string battleOnly`); } // Set to out-of-battle forme diff --git a/tools/set-import/importer.ts b/tools/set-import/importer.ts index 417804eed3b91..63312797976bf 100644 --- a/tools/set-import/importer.ts +++ b/tools/set-import/importer.ts @@ -360,7 +360,7 @@ function toPokemonSet(dex: ModdedDex, format: Format, pokemon: string, set: Deep const species = dex.getSpecies(pokemon); if (species.battleOnly && !format.id.includes('balancedhackmons')) { if (typeof species.battleOnly !== 'string') { - throw new Error(`Got an Ultra Necrozma outside of BH`); + throw new Error(`Got an Ultra Necrozma or Complete Zygarde outside of BH`); } copy.species = species.battleOnly; copy.ability = dex.getSpecies(copy.species).abilities[0];