Skip to content

Commit

Permalink
fix natdex
Browse files Browse the repository at this point in the history
  • Loading branch information
scheibo committed Sep 22, 2024
1 parent d74ac5f commit 1ad02c6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 65 deletions.
21 changes: 8 additions & 13 deletions stats/src/reports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ const TIERS = {
'Uber', 'OU', 'UUBL', 'UU', 'RUBL', 'RU', 'NUBL', 'NU', 'PUBL', 'PU', 'ZUBL', 'ZU',
] as Tier[],
doubles: ['DUber', 'DOU', 'DUU', 'DNU'] as DoublesTier[],
nationaldex: ['OU', 'UUBL', 'UU'] as NationalDexTier[],
nationaldex: [
'Uber', 'OU', 'UUBL', 'UU', 'RUBL', 'RU', 'NUBL', 'NU', 'PUBL', 'PU', 'ZUBL', 'ZU',
] as NationalDexTier[],
littlecup: ['LC', 'LCBL', 'LCUU'] as LittleCupTier[],
};

Expand Down Expand Up @@ -420,12 +422,7 @@ export const Reports = new class {
}
}

const tiers:
UsageTiers<Array<[ID, number]>> |
DoublesUsageTiers<Array<[ID, number]>> |
NationalDexUsageTiers<Array<[ID, number]>> |
LittleCupUsageTiers<Array<[ID, number]>> = usageTiers(type, () => []);

const tiers: CombinedUsageTiers<Array<[ID, number]>> = usageTiers(type, () => []);
for (const [species, usage] of pokemon.entries()) {
for (const tier of USAGE_TIERS[type]) {
const ut: number = (usage as any)[tier];
Expand Down Expand Up @@ -533,15 +530,12 @@ function updateTiers(
const NFE = new Set<ID>();
for (const species of gen.species) {
const doubles = type === 'doubles';
// let tier: string = (doubles
// ? species.doublesTier : type === 'nationaldex'
// ? species.natDexTier : undefined) ?? species.tier;
let tier: string = (doubles
? species.doublesTier : type === 'nationaldex'
? undefined : undefined) ?? species.tier;
? species.natDexTier : undefined) ?? species.tier;

if (SKIP.has(species.id) ||
species.isNonstandard ||
(type !== 'nationaldex' && species.isNonstandard) ||
!tier ||
tier === 'Illegal' ||
tier === 'Unreleased') {
Expand Down Expand Up @@ -572,6 +566,7 @@ function updateTiers(
updated.set(species.id, tier as CombinedTier);
continue;
}

if (updated.has(species.id)) continue;

const riseAndDrop =
Expand Down Expand Up @@ -710,7 +705,7 @@ function toMovesetStatistics(
return movesets;
}

// NOTE: https://www.smogon.com/forums/threads/gen-8-smogon-university-usage-statistics-discussion-thread.3657197/post-8841061
// NOTE: https://www.smogon.com/forums/posts/8841061
function getTeammates(
gen: Generation,
teammates: {[id: string /* ID */]: number},
Expand Down
3 changes: 1 addition & 2 deletions stats/src/test/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ export async function process() {

const gen = override(gens.get(9)); // NB: same as DEFAULT from newGenerations
const tiers: {[type: string]: string} = {};
// for (const type of ['singles', 'doubles', 'nationaldex', 'littlecup'] as const) {
for (const type of ['doubles'] as const) {
for (const type of ['singles', 'doubles', 'nationaldex', 'littlecup'] as const) {
tiers[type] = await stats.Reports.tierUpdateReport(gen, MONTHS, (month, format) => {
const baseline = ['ou', 'doublesou'].includes(format.slice(4)) ? 1695 : 1630;
const file = path.resolve(`${month}`, `${format}-${baseline}.txt`);
Expand Down
56 changes: 6 additions & 50 deletions stats/src/test/testdata/stats/update/nationaldex.txt
Original file line number Diff line number Diff line change
Expand Up @@ -539,54 +539,10 @@ Combined usage for National Dex UU (1630 stats)
+ ---- + ------------------ + ------- +
[/CODE][/HIDE]

Amoonguss moved from NDRU to NDUU
Arcanine-Hisui moved from NDUU to NDRU
Bisharp moved from NDRU to NDUU
Blissey moved from NDOU to NDUU
Ceruledge moved from NDUUBL to NDOU
Chansey moved from NDRU to NDUU
Cinderace moved from NDOU to NDUU
Clefable moved from NDOU to NDUU
Dondozo moved from NDOU to NDUU
Donphan moved from NDUU to NDRU
Enamorus moved from NDOU to NDUU
Garchomp moved from NDUUBL to NDOU
Goodra-Hisui moved from NDUU to NDRU
Hawlucha moved from NDUU to NDRU
Hippowdon moved from NDRU to NDUU
Hydreigon moved from NDRUBL to NDUU
Indeedee moved from NDUU to NDRU
Iron Crown moved from NDUU to NDOU
Iron Moth moved from NDOU to NDUU
Kleavor moved from NDRU to NDUU
Latios moved from NDUU to NDRU
Lokix moved from NDUU to NDRU
Magnezone moved from NDNU to NDUU
Mamoswine moved from NDUU to NDRU
Mandibuzz moved from NDUU to NDRU
Meowscarada moved from NDOU to NDUU
Metagross moved from NDUU to NDRU
Moltres moved from NDRU to NDOU
Ninetales-Alola moved from NDUU to NDRU
Ogerpon moved from NDUU to NDRU
Ogerpon-Cornerstone moved from NDUU to NDRU
Pecharunt moved from NDUU to NDRU
Pelipper moved from NDUUBL to NDOU
Primarina moved from NDOU to NDUU
Ribombee moved from NDOU to NDUU
Sandy Shocks moved from NDUU to NDRU
Buzzwole moved from NDRUBL to NDUU
Dracozolt moved from NDUU to NDRU
Haxorus moved from NDUU to NDRU
Hoopa-Unbound moved from NDOU to NDUU
Sinistcha moved from NDUU to NDRU
Skarmory moved from NDOU to NDUU
Slowbro moved from NDNU to NDUU
Slowking moved from NDUU to NDRU
Ting-Lu moved from NDOU to NDUU
Tinkaton moved from NDUU to NDRU
Torkoal moved from NDOU to NDUU
Tornadus-Therian moved from NDUU to NDRU
Toxapex moved from NDUU to NDOU
Tyranitar moved from NDUU to NDRU
Ursaluna moved from NDUU to NDOU
Weavile moved from NDOU to NDUU
Weezing-Galar moved from NDUU to NDRU
Zapdos moved from NDUU to NDOU
Zapdos-Galar moved from NDRU to NDUU
Swampert-Mega moved from NDRU to NDOU
Tyranitar-Mega moved from NDUU to NDOU

0 comments on commit 1ad02c6

Please sign in to comment.