mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-03-21 17:50:29 -05:00
Use ruleTable to assign tiers in the teambuilder (#1586)
This commit is contained in:
parent
49ef0a3a8d
commit
bfbdf8ca62
|
|
@ -286,7 +286,7 @@ 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.3, 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.3, 7.1, 7, -7.5, -7, 6.3, 6, -6, 5.3, 5, -5, 5.3, 4, -4, 3.3, 3, 2.3, 2, 1.3, 1]) {
|
||||
const isLetsGo = (genIdent === 7.1);
|
||||
const isMetBattle = (genIdent === 8.2);
|
||||
const isNFE = (('' + genIdent).endsWith('.3'));
|
||||
|
|
@ -306,63 +306,31 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
|
|||
if (species.gen > genNum) continue;
|
||||
const tier = (() => {
|
||||
if (isNatDex) {
|
||||
let tier = species.tier;
|
||||
const unobtainables = [
|
||||
'Eevee-Starter', 'Floette-Eternal', 'Pichu-Spiky-eared', 'Pikachu-Belle', 'Pikachu-Cosplay', 'Pikachu-Libre', 'Pikachu-PhD', 'Pikachu-Pop-Star', 'Pikachu-Rock-Star', 'Pikachu-Starter', 'Eternatus-Eternamax',
|
||||
].map(toID);
|
||||
if (species.isNonstandard && !['Past'].includes(species.isNonstandard)) return 'Illegal';
|
||||
if (species.isNonstandard && !['Past', 'Gigantamax'].includes(species.isNonstandard)) return 'Illegal';
|
||||
if (unobtainables.includes(species.id)) return 'Illegal';
|
||||
const uuBanlist = Dex.getFormat('gen8nationaldexuu').banlist.map(toID);
|
||||
const ouBanlist = Dex.getFormat('gen8nationaldex').banlist.map(toID);
|
||||
const uublIndex = uuBanlist.map(toID).indexOf('nduubl');
|
||||
let hasBase = uuBanlist.includes(species.id + 'base');
|
||||
if (!uuBanlist.includes(species.id)) {
|
||||
tier = 'UU';
|
||||
} else {
|
||||
if (hasBase) {
|
||||
if (uuBanlist.indexOf(species.id + 'base') >= uublIndex) {
|
||||
tier = 'UUBL';
|
||||
} else {
|
||||
tier = 'OU';
|
||||
}
|
||||
const uu = Dex.getFormat('gen8nationaldexuu');
|
||||
const ou = Dex.getFormat('gen8nationaldex');
|
||||
const uublIndex = uu.banlist.map(toID).indexOf('nduubl');
|
||||
if (Dex.getRuleTable(ou).isBannedSpecies(species) || species.id === 'zygardecomplete' || species.id === 'necrozmaultra') return 'Uber';
|
||||
if (Dex.getRuleTable(ou).has('dynamaxclause') && species.name.endsWith('Gmax')) return '(Uber)';
|
||||
if (Dex.getRuleTable(uu).isBannedSpecies(species)) {
|
||||
if (uu.banlist.map(toID).indexOf(species.id) >= uublIndex || uu.banlist.map(toID).indexOf(species.id + 'base') >= uublIndex) {
|
||||
return 'UUBL';
|
||||
} else {
|
||||
if (uuBanlist.indexOf(species.id) >= uublIndex) {
|
||||
tier = 'UUBL';
|
||||
} else {
|
||||
tier = 'OU';
|
||||
}
|
||||
}
|
||||
}
|
||||
hasBase = ouBanlist.includes(species.id + 'base');
|
||||
if (ouBanlist.includes(species.id)) {
|
||||
tier = 'Uber';
|
||||
} else if (species.name.includes('-Gmax')) {
|
||||
return '(Uber)';
|
||||
} else {
|
||||
if (hasBase) {
|
||||
tier = 'Uber';
|
||||
} else {
|
||||
if (ouBanlist.includes(toID(species.baseSpecies)) ||
|
||||
['zygardecomplete', 'necrozmaultra'].includes(species.id)) {
|
||||
tier = 'Uber';
|
||||
}
|
||||
if (species.id.includes('eternamax')) tier = 'Illegal';
|
||||
return 'OU';
|
||||
}
|
||||
}
|
||||
if (species.nfe) {
|
||||
if (
|
||||
ouBanlist.includes(species.id) || ouBanlist.includes(species.id + 'base') || ouBanlist.includes(toID(species.baseSpecies)) ||
|
||||
uuBanlist.includes(species.id) || uuBanlist.includes(species.id + 'base')
|
||||
) {
|
||||
return tier;
|
||||
}
|
||||
if (species.prevo) {
|
||||
tier = 'NFE';
|
||||
return 'NFE';
|
||||
} else {
|
||||
tier = 'LC';
|
||||
return 'LC';
|
||||
}
|
||||
}
|
||||
return tier;
|
||||
return 'UU';
|
||||
}
|
||||
if (isMetBattle) {
|
||||
let tier = species.tier;
|
||||
|
|
@ -373,26 +341,26 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
|
|||
tier = 'OU';
|
||||
}
|
||||
}
|
||||
if (species.isNonstandard === 'Gigantamax') tier = '(Uber)';
|
||||
if (species.tier === 'CAP LC') tier = 'LC';
|
||||
if (species.tier === 'CAP NFE') tier = 'NFE';
|
||||
if (species.tier === 'CAP') tier = 'OU';
|
||||
let banlist = Dex.getFormat('gen8metronomebattle').banlist;
|
||||
const format = Dex.getFormat('gen8metronomebattle');
|
||||
let bst = 0;
|
||||
for (const stat of Object.values(species.baseStats)) {
|
||||
bst += stat;
|
||||
}
|
||||
if (bst > 625) tier = 'Illegal';
|
||||
if (banlist.includes(species.name) || banlist.includes(species.name + '-Base')) tier = 'Illegal';
|
||||
if (Dex.getRuleTable(format).isBannedSpecies(species)) tier = 'Illegal';
|
||||
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';
|
||||
if (!species.nfe) tier = 'Illegal';
|
||||
const format = Dex.getFormat(gen + 'nfe');
|
||||
const banlist = format.exists ? format.banlist : [];
|
||||
if (banlist.includes(species.name) || banlist.includes(species.name + '-Base')) {
|
||||
const banlist = Dex.getRuleTable(format);
|
||||
if (banlist.isBannedSpecies(species)) {
|
||||
tier = 'Uber';
|
||||
}
|
||||
return tier;
|
||||
|
|
@ -453,14 +421,9 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
|
|||
}
|
||||
|
||||
if (genNum >= 7) {
|
||||
let banlist = Dex.getFormat(gen + 'zu').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)":0, NFE:0, "LC Uber":0, LC:0};
|
||||
let baseTier = baseSpecies.tier;
|
||||
if (baseTier !== "(PU)" && baseTier in tierRank && tierRank[baseTier] > 0) continue;
|
||||
zuBans[baseSpecies.id] = 1;
|
||||
const format = Dex.getFormat(gen + 'zu');
|
||||
if (Dex.getRuleTable(format).isBannedSpecies(species) && ["(PU)", "NFE", "LC Uber", "LC"].includes(species.tier)) {
|
||||
zuBans[species.id] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -585,7 +585,11 @@ abstract class BattleTypedSearch<T extends SearchType> {
|
|||
if (format.includes('metronome')) {
|
||||
this.formatType = 'metronome';
|
||||
}
|
||||
if (format.endsWith('nfe')) this.formatType = 'nfe';
|
||||
if (format.endsWith('nfe')) {
|
||||
format = format.slice(3) as ID;
|
||||
this.formatType = 'nfe';
|
||||
if (!format) format = 'ou' as ID;
|
||||
}
|
||||
this.format = format;
|
||||
|
||||
this.species = '' as ID;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user