diff --git a/build-tools/build-indexes b/build-tools/build-indexes index 0ebdcbf08..006ad6d76 100755 --- a/build-tools/build-indexes +++ b/build-tools/build-indexes @@ -286,9 +286,10 @@ process.stdout.write("Building `data/teambuilder-tables.js`... "); let buf = '// DO NOT EDIT - automatically built with build-tools/build-indexes\n\n'; // process.stdout.write("\n "); - for (const genIdent of [8.2, 8.1, 8, -8, 7.1, 7, -7.5, -7, 6, -6, 5, -5, 4, -4, 3, 2, 1]) { + for (const genIdent of [8.3, 8.2, 8.1, 8, -8, 7.1, 7, -7.5, -7, 6, -6, 5, -5, 4, -4, 3, 2, 1]) { const isLetsGo = (genIdent === 7.1); const isMetBattle = (genIdent === 8.2); + const isNFE = (('' + genIdent).endsWith('.3')); const isNatDex = (genIdent === 8.1); const isDoubles = (genIdent < 0); const isVGC = (genIdent === -7.5); @@ -300,7 +301,6 @@ process.stdout.write("Building `data/teambuilder-tables.js`... "); const tierTable = {}; const overrideTier = {}; const zuBans = {}; - const nfeBans = {}; for (const id of pokemon) { const species = Dex.mod(gen).getSpecies(id); if (species.gen > genNum) continue; @@ -347,6 +347,17 @@ process.stdout.write("Building `data/teambuilder-tables.js`... "); if (species.types.includes('Steel')) tier = 'Illegal'; return tier; } + if (isNFE) { + let tier = species.tier; + const feInCurrentGen = species.evos && Dex.getSpecies(species.evos[0]).gen > genNum; + if (!species.nfe || feInCurrentGen) tier = 'Illegal'; + const format = Dex.getFormat(gen + 'nfe'); + const banlist = format.exists ? format.banlist : []; + if (banlist.includes(species.name) || banlist.includes(species.name + '-Base')) { + tier = 'Uber'; + } + return tier; + } if (isLetsGo) { let baseSpecies = Dex.mod(gen).getSpecies(species.baseSpecies); let validNum = (baseSpecies.num <= 151 && species.num >= 1) || [808, 809].includes(baseSpecies.num); @@ -413,18 +424,6 @@ process.stdout.write("Building `data/teambuilder-tables.js`... "); zuBans[baseSpecies.id] = 1; } } - - if (genNum >= 8) { - let banlist = Dex.getFormat(gen + 'nfe').banlist; - for (const ban of banlist) { - let baseSpecies = Dex.mod(gen).getSpecies(ban.endsWith('-Base') ? ban.slice(0, -5) : ban); - if (!baseSpecies.exists) continue; - const tierRank = {AG:1, Uber:1, OU:1, UUBL:1, UU:1, RUBL:1, RU:1, NUBL:1, NU:1, PUBL:1, PU:1, "(PU)":1, NFE:0, "LC Uber":0, LC:0}; - let baseTier = baseSpecies.tier; - if (!['NFE', 'LC Uber', 'LC'].includes(baseTier) && baseTier in tierRank && tierRank[baseTier] > 0) continue; - nfeBans[baseSpecies.id] = 1; - } - } } const tiers = []; @@ -441,6 +440,11 @@ process.stdout.write("Building `data/teambuilder-tables.js`... "); BattleTeambuilderTable['metronome'].tiers = tiers; BattleTeambuilderTable['metronome'].items = items; BattleTeambuilderTable['metronome'].formatSlices = formatSlices; + } else if (isNFE) { + BattleTeambuilderTable[gen + 'nfe'] = {}; + BattleTeambuilderTable[gen + 'nfe'].tiers = tiers; + BattleTeambuilderTable[gen + 'nfe'].overrideTier = overrideTier; + BattleTeambuilderTable[gen + 'nfe'].formatSlices = formatSlices; } else if (isLetsGo) { BattleTeambuilderTable['letsgo'] = {}; BattleTeambuilderTable['letsgo'].learnsets = {}; @@ -461,7 +465,6 @@ process.stdout.write("Building `data/teambuilder-tables.js`... "); BattleTeambuilderTable.items = items; BattleTeambuilderTable.overrideTier = overrideTier; BattleTeambuilderTable.zuBans = zuBans; - BattleTeambuilderTable.nfeBans = nfeBans; BattleTeambuilderTable.formatSlices = formatSlices; } else { BattleTeambuilderTable[gen] = {}; diff --git a/src/battle-dex-search.ts b/src/battle-dex-search.ts index 1a6fe8172..9f831a455 100644 --- a/src/battle-dex-search.ts +++ b/src/battle-dex-search.ts @@ -543,7 +543,7 @@ abstract class BattleTypedSearch { */ set: PokemonSet | null = null; - protected formatType: 'metronome' | 'natdex' | 'letsgo' | 'doubles' | null = null; + protected formatType: 'doubles' | 'letsgo' | 'metronome' | 'natdex' | 'nfe' | null = null; /** * Cached copy of what the results list would be with only base filters @@ -585,6 +585,7 @@ abstract class BattleTypedSearch { if (format.includes('metronome')) { this.formatType = 'metronome'; } + if (format.endsWith('nfe')) this.formatType = 'nfe'; this.format = format; this.species = '' as ID; @@ -732,7 +733,8 @@ abstract class BattleTypedSearch { } let table = window.BattleTeambuilderTable; const tableKey = this.formatType === 'doubles' ? `gen${this.dex.gen}doubles` : - this.formatType === 'letsgo' ? 'letsgo' : `gen${this.dex.gen}`; + this.formatType === 'letsgo' ? 'letsgo' : + this.formatType === 'nfe' ? `gen${this.dex.gen}nfe` : `gen${this.dex.gen}`; if (table && table[tableKey]) { table = table[tableKey]; } @@ -835,6 +837,8 @@ class BattlePokemonSearch extends BattleTypedSearch<'pokemon'> { table = table['natdex']; } else if (this.formatType === 'metronome') { table = table['metronome']; + } else if (this.formatType === 'nfe') { + table = table['gen' + dex.gen + 'nfe']; } if (!table.tierSet) { @@ -858,7 +862,6 @@ class BattlePokemonSearch extends BattleTypedSearch<'pokemon'> { else if (format === 'nu') tierSet = tierSet.slice(slices.NU); else if (format === 'pu') tierSet = tierSet.slice(slices.PU || slices.NU); else if (format === 'zu') tierSet = tierSet.slice(slices.ZU || slices.PU || slices.NU); - else if (format === 'nfe') tierSet = tierSet.slice(slices.NFE); else if (format === 'lc' || format === 'lcuu') tierSet = tierSet.slice(slices.LC); else if (format === 'cap') tierSet = tierSet.slice(0, slices.Uber).concat(tierSet.slice(slices.OU)); else if (format === 'caplc') tierSet = tierSet.slice(slices['CAP LC'], slices.Uber).concat(tierSet.slice(slices.LC)); @@ -886,13 +889,6 @@ class BattlePokemonSearch extends BattleTypedSearch<'pokemon'> { }); } - if (format === 'nfe' && dex.gen >= 8) { - tierSet = tierSet.filter(function (r) { - if (r[1] in table.nfeBans) return false; - return true; - }); - } - if (format === 'vgc2016') { tierSet = tierSet.filter(([type, id]) => { let banned = [