Skip to content

Commit

Permalink
Fix Zygarde-Complete validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Zarel committed May 1, 2020
1 parent 6d5ea45 commit 56f6ab5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
5 changes: 5 additions & 0 deletions server/chat-plugins/random-battles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
20 changes: 12 additions & 8 deletions sim/team-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/set-import/importer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 56f6ab5

Please sign in to comment.