Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better support for challenge codes for past 35 Pokes metagames #10772

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix dexited mons broken validation
swordfishtr authored Dec 23, 2024
commit c6029be518a9def46a0b28536f2cff7d275cb9c4
27 changes: 20 additions & 7 deletions config/formats.ts
Original file line number Diff line number Diff line change
@@ -2289,8 +2289,8 @@ export const Formats: import('../sim/dex-formats').FormatList = [
'Battle Bond', 'Moody', 'Shadow Tag', 'Berserk Gene', 'King\'s Rock', 'Quick Claw', 'Razor Fang', 'Acupressure', 'Last Respects',
],
// Stupid hardcode
onValidateSet(set) {
const allowedPokemon: string[] = [
validateSet(set, teamHas) {
const allowedPokemonCurrent: string[] = [
'Appletun', 'Aurorus', 'Avalugg', 'Banette', 'Cacturne', 'Carracosta', 'Celebi', 'Cetitan', 'Chandelure', 'Cryogonal', 'Dipplin',
'Garbodor', 'Golem-Alola', 'Guzzlord', 'Jumpluff', 'Luvdisc', 'Magmortar', 'Mawile', 'Milotic', 'Morpeko', 'Pachirisu', 'Perrserker',
'Primarina', 'Pupitar', 'Pyukumuku', 'Ribombee', 'Roserade', 'Rotom-Frost', 'Scovillain', 'Toxicroak', 'Walrein', 'Wo-Chien', 'Wugtrio',
@@ -2299,24 +2299,37 @@ export const Formats: import('../sim/dex-formats').FormatList = [
const problems: string[] = [];
// To be called by the client build script.
if(this.gen === 0) {
if(!allowedPokemon.includes(set.species)) problems.push('bad');
return problems.length ? problems : undefined;
if(!allowedPokemonCurrent.includes(set.species)) problems.push('bad');
return problems.length ? problems : null;
}
const species = this.dex.species.get(set.species);
if(!this.ruleTable.has('-pokemontag:allpokemon')) {
if(!allowedPokemon.includes(set.species)) problems.push(`${set.species} is not part of this month's roster.`);
if(this.ruleTable.has('-pokemontag:allpokemon') && this.format.customRules) {
const allowedPokemonCustom: string[] = [];
for(const tmpName of this.format.customRules) {
const tmpSpecies = this.dex.species.get(tmpName);
if(tmpSpecies.exists) allowedPokemonCustom.push(tmpSpecies.id);
}
if(!allowedPokemonCustom.includes(this.toID(set.species))) {
problems.push(`${set.species} is not part of this roster.`);
}
}
else if(!allowedPokemonCurrent.includes(set.species)) {
problems.push(`${set.species} is not part of this month's roster.`);
}
if (set.item) {
const item = this.dex.items.get(set.item);
if (item.megaEvolves && !(this.ruleTable.has(`+item:${item.id}`) || this.ruleTable.has(`+pokemontag:mega`))) {
problems.push(`Mega Evolution is banned.`);
}
}
const species = this.dex.species.get(set.species);
if (set.moves.map(x => this.toID(this.dex.moves.get(x).realMove) || x).includes('hiddenpower') &&
species.baseSpecies !== 'Unown' && !this.ruleTable.has(`+move:hiddenpower`)) {
problems.push(`Hidden Power is banned.`);
}
if(problems.length) return problems;
const problemsMore = this.validateSet.call(this, set, teamHas);
if(problemsMore) problems.push(...problemsMore);
return problems.length ? problems : null;
},
},
{