diff --git a/build-tools/build-indexes b/build-tools/build-indexes index 48babbe43..4cd43a59f 100755 --- a/build-tools/build-indexes +++ b/build-tools/build-indexes @@ -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'] = {}; diff --git a/play.pokemonshowdown.com/src/battle-dex-search.ts b/play.pokemonshowdown.com/src/battle-dex-search.ts index 2475e1398..a9d89e193 100644 --- a/play.pokemonshowdown.com/src/battle-dex-search.ts +++ b/play.pokemonshowdown.com/src/battle-dex-search.ts @@ -698,7 +698,6 @@ abstract class BattleTypedSearch { } 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;