Add teambuilder ban support for more formats

This commit is contained in:
Kris Johnson 2026-01-09 13:38:19 -07:00
parent 987cdc7faf
commit 56df608ba8
2 changed files with 64 additions and 13 deletions

View File

@ -430,13 +430,41 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
if (!tierTable[speciesTier]) tierTable[speciesTier] = [];
tierTable[speciesTier].push(id);
if (genNum === 9) {
if (genNum >= 6) {
for (const meta of [
'ubersuu', 'almostanyability', 'balancedhackmons', 'godlygift', 'mixandmega', 'sharedpower', 'stabmons',
'1v1', '2v2doubles', 'lcuu', 'freeforall', 'ubersuu', 'almostanyability', 'balancedhackmons', 'godlygift', 'mixandmega', 'sharedpower', 'stabmons',
'12switch', '350cup', 'alphabetcup', 'badnboosted', 'battlefields', 'biomechmons', 'camomons', 'categoryswap',
'convergence', 'crossevolution', 'fervetimpersonation', 'foresighters', 'formemons', 'fortemons', 'franticfusions',
'fullpotential', 'inheritance', 'inverse', 'natureswap', 'partnersincrime', 'passiveaggressive', 'pokebilities',
'pokemoves', 'relayrace', 'revelationmons', 'sharingiscaring', 'teradonation', 'teraoverride', 'thecardgame',
'thelosersgame', 'trademarked', 'triples', 'typesplit', 'voltturnmayhem', 'nationaldexubersuu', 'nationaldex1v1',
'nationaldexaaa', 'nationaldexbh', 'nationaldexgodlygift', 'nationaldexstabmons', 'tiershift',
]) {
const format = Dex.formats.get(gen + meta);
if (format.exists && Dex.formats.getRuleTable(format).isBannedSpecies(species)) {
if (!metagameBans[meta]) metagameBans[meta] = {};
if (Dex.formats.getRuleTable(format).has('megarayquazaclause')) {
metagameBans[meta]['megarayquazaclause'] = 1;
}
if (species.requiredItems && species.requiredItems.length) {
for (const itemName of species.requiredItems) {
const item = Dex.items.get(itemName);
if (item.itemUser && item.itemUser.includes(species.name) &&
Dex.formats.getRuleTable(format).isBanned('item:' + item.id)) {
metagameBans[meta][species.id] = 1;
}
if (item.megaStone && Object.values(item.megaStone).includes(species.name) &&
Dex.formats.getRuleTable(format).isBanned('item:' + item.id)) {
metagameBans[meta][species.id] = 1;
}
}
}
if (species.requiredAbility) {
const ability = Dex.items.get(species.requiredAbility);
if (Dex.formats.getRuleTable(format).isBanned('ability:' + ability.id)) {
metagameBans[meta][species.id] = 1;
}
}
metagameBans[meta][species.id] = 1;
}
}
@ -507,6 +535,7 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
BattleTeambuilderTable[gen + 'lc'] = {};
BattleTeambuilderTable[gen + 'lc'].tiers = tiers;
BattleTeambuilderTable[gen + 'lc'].overrideTier = overrideTier;
BattleTeambuilderTable[gen + 'lc'].metagameBans = metagameBans;
BattleTeambuilderTable[gen + 'lc'].formatSlices = formatSlices;
} else if (isLetsGo) {
BattleTeambuilderTable['gen7letsgo'] = {};
@ -531,6 +560,7 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
BattleTeambuilderTable[gen + 'doubles'].tiers = tiers;
BattleTeambuilderTable[gen + 'doubles'].items = items;
BattleTeambuilderTable[gen + 'doubles'].overrideTier = overrideTier;
BattleTeambuilderTable[gen + 'doubles'].metagameBans = metagameBans;
BattleTeambuilderTable[gen + 'doubles'].formatSlices = formatSlices;
} else if (isGen9BH) {
BattleTeambuilderTable['bh'] = {};

View File

@ -698,7 +698,6 @@ abstract class BattleTypedSearch<T extends SearchType> {
}
if ((format.endsWith('lc') || format.startsWith('lc')) && format !== 'caplc' && !this.formatType) {
this.formatType = 'lc';
format = 'lc' as ID;
}
if (format.endsWith('draft')) {
format = format.slice(0, -5) as ID;
@ -1156,17 +1155,39 @@ class BattlePokemonSearch extends BattleTypedSearch<'pokemon'> {
];
}
const customBanlists = [
'ubersuu', 'almostanyability', 'balancedhackmons', 'godlygift', 'mixandmega', 'sharedpower', 'stabmons',
'1v1', '2v2doubles', 'lcuu', 'freeforall', 'ubersuu', 'almostanyability', 'balancedhackmons', 'godlygift', 'mixandmega',
'sharedpower', 'stabmons', '12switch', '350cup', 'alphabetcup', 'badnboosted', 'battlefields', 'biomechmons', 'camomons',
'categoryswap', 'convergence', 'crossevolution', 'fervetimpersonation', 'foresighters', 'formemons', 'fortemons',
'franticfusions', 'fullpotential', 'inheritance', 'inverse', 'natureswap', 'partnersincrime', 'passiveaggressive',
'pokebilities', 'pokemoves', 'relayrace', 'revelationmons', 'sharingiscaring', 'teradonation', 'teraoverride', 'thecardgame',
'thelosersgame', 'trademarked', 'triples', 'typesplit', 'voltturnmayhem', 'nationaldexubersuu', 'nationaldex1v1',
'nationaldexaaa', 'nationaldexbh', 'nationaldexgodlygift', 'nationaldexstabmons', 'tiershift',
];
if (customBanlists.includes(format) && table.metagameBans?.[format]) {
tierSet = tierSet.filter(([type, id]) => {
if (id in table.metagameBans[format]) return false;
if ('miraidon' in table.metagameBans[format] && 'calyrexshadow' in table.metagameBans[format] &&
type === 'header' && id === 'AG') return false;
return true;
});
}
if (dex.gen >= 8) {
if (dex.gen >= 6) {
if (
(customBanlists.includes(format) && table.metagameBans?.[format]) ||
(this.formatType === 'natdex' && customBanlists.includes('nationaldex' + format) &&
table.metagameBans?.['nationaldex' + format])) {
tierSet = tierSet.filter(([type, id]) => {
if (id in table.metagameBans[format]) return false;
if (this.formatType === 'natdex' && id in table.metagameBans['nationaldex' + format]) return false;
if (!this.formatType && dex.gen === 9 &&
'miraidon' in table.metagameBans[format] &&
'calyrexshadow' in table.metagameBans[format] &&
type === 'header' && id === 'AG'
) return false;
if (!this.formatType && dex.gen === 8 &&
'zacian' in table.metagameBans[format] &&
'zaciancrowned' in table.metagameBans[format] &&
type === 'header' && id === 'AG'
) return false;
if ((dex.gen === 7 || dex.gen === 6) &&
(id === 'AG' || id === 'rayquazamega') &&
'megarayquazaclause' in table.metagameBans[format]
) return false;
return true;
});
}
if ((format === 'doubles' || format === 'monotype') && this.formatType === 'natdex' && table.metagameBans?.[format]) {
tierSet = tierSet.filter(([type, id]) => {
if (id in table.metagameBans[format]) return false;