Skip to content

Commit

Permalink
Add Gen 5 ZU Support (smogon#2262)
Browse files Browse the repository at this point in the history
* Attempt to add teambuilder support for Gen 5 ZU

* Add teambuilder support for Gen 5 ZU

* Update play.pokemonshowdown.com/src/battle-dex-search.ts

* Update build-tools/build-indexes

* Add proper showdown filter for Gen 5 ZU

* Fix Lint issue with ZU tierset creation

---------

Co-authored-by: Kris Johnson <[email protected]>
  • Loading branch information
AlexMMcConnell and KrisXV authored Jul 22, 2024
1 parent d812f06 commit 2cfbc35
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
10 changes: 10 additions & 0 deletions build-tools/build-indexes
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
const ndDoublesBans = {};
const monotypeBans = {};
const nonstandardMoves = [];
const gen5zuBans = {};
for (const id of pokemon) {
const species = Dex.mod(gen).species.get(id);
const baseSpecies = Dex.mod(gen).species.get(species.baseSpecies);
Expand Down Expand Up @@ -479,6 +480,12 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
}
}
if (genNum >= 5) {
if (genNum === 5) {
const gen5zu = Dex.formats.get(gen + 'zu');
if (gen5zu.exists && Dex.formats.getRuleTable(gen5zu).isBannedSpecies(species)) {
gen5zuBans[species.id] = 1;
}
}
const mono = Dex.formats.get(gen + (isNatDex ? 'nationaldex' : '') + 'monotype');
if (mono.exists && Dex.formats.getRuleTable(mono).isBannedSpecies(species)) {
monotypeBans[species.id] = 1;
Expand Down Expand Up @@ -569,6 +576,9 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
BattleTeambuilderTable[gen].learnsets = {};
} else {
BattleTeambuilderTable[gen] = {};
if (genNum === 5) {
BattleTeambuilderTable[gen].gen5zuBans = gen5zuBans;
}
BattleTeambuilderTable[gen].overrideTier = overrideTier;
BattleTeambuilderTable[gen].tiers = tiers;
BattleTeambuilderTable[gen].items = items;
Expand Down
8 changes: 7 additions & 1 deletion play.pokemonshowdown.com/src/battle-dex-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,7 @@ class BattlePokemonSearch extends BattleTypedSearch<'pokemon'> {
else if (format === 'ru') tierSet = tierSet.slice(slices.RU || slices.UU);
else if (format === 'nu') tierSet = tierSet.slice(slices.NU || slices.RU || slices.UU);
else if (format === 'pu') tierSet = tierSet.slice(slices.PU || slices.NU);
else if (format === 'zu' && dex.gen === 5) tierSet = tierSet.slice(slices.PU || slices.NU);
else if (format === 'zu') tierSet = tierSet.slice(slices.ZU || slices.PU || slices.NU);
else if (format === 'lc' || format === 'lcuu' || format.startsWith('lc') || (format !== 'caplc' && format.endsWith('lc'))) tierSet = tierSet.slice(slices.LC);
else if (format === 'cap' || format.endsWith('cap')) {
Expand Down Expand Up @@ -1058,7 +1059,6 @@ class BattlePokemonSearch extends BattleTypedSearch<'pokemon'> {
...tierSet.slice(slices.DUU),
];
}

if (format === 'ubersuu' && table.ubersUUBans) {
tierSet = tierSet.filter(([type, id]) => {
if (id in table.ubersUUBans) return false;
Expand All @@ -1079,6 +1079,12 @@ class BattlePokemonSearch extends BattleTypedSearch<'pokemon'> {
});
}
}
if (format === 'zu' && dex.gen === 5 && table.gen5zuBans) {
tierSet = tierSet.filter(([type, id]) => {
if (id in table.gen5zuBans) return false;
return true;
});
}

// Filter out Gmax Pokemon from standard tier selection
if (!/^(battlestadium|vgc|doublesubers)/g.test(format)) {
Expand Down

0 comments on commit 2cfbc35

Please sign in to comment.