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

Fix teambuilder for Gen 9 Hackmons #2133

Merged
merged 4 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
24 changes: 22 additions & 2 deletions build-tools/build-indexes
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
const LC = GENS.map(num => num + 0.7);
const STADIUM = [2.04, 1.04];
const NATDEX = [9.1, 8.1];
const OTHER = [9.2, 8.6, 8.4, 8.2, 8.1, -8.4, -8.6, 7.1];
const OTHER = [9.9, 9.2, 8.6, 8.4, 8.2, 8.1, -8.4, -8.6, 7.1];

// process.stdout.write("\n ");
for (const genIdent of [...GENS, ...DOUBLES, ...VGC, ...NFE, ...STADIUM, ...OTHER, ...NATDEX, ...LC]) {
Expand All @@ -336,6 +336,7 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
const isStadium = ('' + genIdent).endsWith('.04');
const isDoubles = (genIdent < 0);
const isVGC = ('' + genIdent).endsWith('.5');
const isGen9BH = genIdent === 9.9;
const genNum = Math.floor(isDoubles ? -genIdent : genIdent);
const gen = (() => {
let genStr = 'gen' + genNum;
Expand Down Expand Up @@ -418,6 +419,20 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
if (species.tier === 'LC') return 'LC';
return 'Regular';
}
if (isGen9BH) {
if ((species.natDexTier === 'Illegal' || species.forme.includes('Totem')) &&
!['Floette-Eternal', 'Greninja-Ash', 'Xerneas-Neutral'].includes(species.name)) {
return 'Illegal';
}
if ((species.name === 'Xerneas' || species.battleOnly || species.forme === 'Eternamax') &&
!(species.isMega || species.isPrimal || ['Greninja-Ash', 'Necrozma-Ultra'].includes(species.name))) {
return 'Illegal';
}
if (species.isNonstandard && ['LGPE', 'CAP', 'Future'].includes(species.isNonstandard)) return 'Illegal';
return species.tags.includes('Mythical') ? 'Mythical' :
species.tags.includes('Restricted Legendary') ? 'Restricted Legendary' :
species.nfe ? (species.prevo ? 'NFE' : 'LC') : 'Regular';
}
if (species.tier === 'CAP' || species.tier === 'CAP NFE' || species.tier === 'CAP LC') {
return species.tier;
}
Expand Down Expand Up @@ -511,6 +526,11 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
BattleTeambuilderTable[gen + 'doubles'].tiers = tiers;
BattleTeambuilderTable[gen + 'doubles'].overrideTier = overrideTier;
BattleTeambuilderTable[gen + 'doubles'].formatSlices = formatSlices;
} else if (isGen9BH) {
BattleTeambuilderTable['bh'] = {};
BattleTeambuilderTable['bh'].tiers = tiers;
BattleTeambuilderTable['bh'].overrideTier = overrideTier;
BattleTeambuilderTable['bh'].formatSlices = formatSlices;
} else if (gen === 'gen9') {
BattleTeambuilderTable.tiers = tiers;
BattleTeambuilderTable.items = items;
Expand All @@ -535,7 +555,7 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
}

const tierOrder = (() => {
if (isVGC) {
if (isVGC || isGen9BH) {
return ["Mythical", "Restricted Legendary", "Regular", "NFE", "LC"];
}
if (isDoubles && genNum > 4) {
Expand Down
14 changes: 9 additions & 5 deletions src/battle-dex-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,7 @@ class BattlePokemonSearch extends BattleTypedSearch<'pokemon'> {
const format = this.format;
if (!format) return this.getDefaultResults();
const isVGCOrBS = format.startsWith('battlespot') || format.startsWith('battlestadium') || format.startsWith('vgc');
const isHackmons = format.includes('hackmons') || format.endsWith('bh');
let isDoublesOrBS = isVGCOrBS || this.formatType?.includes('doubles');
const dex = this.dex;

Expand All @@ -893,6 +894,8 @@ class BattlePokemonSearch extends BattleTypedSearch<'pokemon'> {
table = table['gen' + dex.gen];
} else if (isVGCOrBS) {
table = table['gen' + dex.gen + 'vgc'];
} else if (dex.gen === 9 && isHackmons && !this.formatType) {
table = table['bh'];
} else if (
table['gen' + dex.gen + 'doubles'] && dex.gen > 4 &&
this.formatType !== 'letsgo' && this.formatType !== 'bdspdoubles' && this.formatType !== 'dlc1doubles' &&
Expand All @@ -911,7 +914,7 @@ class BattlePokemonSearch extends BattleTypedSearch<'pokemon'> {
} else if (this.formatType === 'letsgo') {
table = table['gen7letsgo'];
} else if (this.formatType === 'natdex') {
table = table['gen' + this.dex.gen + 'natdex'];
table = table['gen' + dex.gen + 'natdex'];
} else if (this.formatType === 'metronome') {
table = table['gen' + dex.gen + 'metronome'];
} else if (this.formatType === 'nfe') {
Expand All @@ -938,8 +941,8 @@ class BattlePokemonSearch extends BattleTypedSearch<'pokemon'> {
let tierSet: SearchRow[] = table.tierSet;
let slices: {[k: string]: number} = table.formatSlices;
if (format === 'ubers' || format === 'uber') tierSet = tierSet.slice(slices.Uber);
else if (isVGCOrBS) {
if (format.endsWith('series13')) {
else if (isVGCOrBS || (isHackmons && dex.gen === 9 && !this.formatType)) {
if (format.endsWith('series13') || isHackmons) {
// Show Mythicals
} else if (
format === 'vgc2010' || format === 'vgc2016' || format.startsWith('vgc2019') ||
Expand All @@ -961,8 +964,9 @@ class BattlePokemonSearch extends BattleTypedSearch<'pokemon'> {
tierSet = tierSet.slice(slices['CAP LC'], slices.AG || slices.Uber).concat(tierSet.slice(slices.LC));
} else if (format === 'anythinggoes' || format.endsWith('ag') || format.startsWith('ag')) {
tierSet = tierSet.slice(slices.AG);
} else if (format.includes('hackmons') || format.endsWith('bh')) tierSet = tierSet.slice(slices.AG || slices.Uber);
else if (format === 'monotype') tierSet = tierSet.slice(slices.Uber);
} else if (isHackmons && (dex.gen < 9 || this.formatType === 'natdex')) {
tierSet = tierSet.slice(slices.AG || slices.Uber);
} else if (format === 'monotype') tierSet = tierSet.slice(slices.Uber);
else if (format === 'doublesubers') tierSet = tierSet.slice(slices.DUber);
else if (format === 'doublesou' && dex.gen > 4) tierSet = tierSet.slice(slices.DOU);
else if (format === 'doublesuu') tierSet = tierSet.slice(slices.DUU);
Expand Down
Loading