Skip to content

Commit

Permalink
Programatically update cosmetic formes
Browse files Browse the repository at this point in the history
  • Loading branch information
shrianshChari committed Sep 17, 2024
1 parent eaf3cf5 commit 41ca79f
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions stats/src/reports.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Generation, ID, toID} from '@pkmn/data';
import {Generation, ID, Specie, StatID, toID} from '@pkmn/data';

import {Statistics} from './stats';
import * as util from './util';
Expand Down Expand Up @@ -480,17 +480,6 @@ export const Reports = new class {
}
};

const SKIP = new Set([
'pichuspikyeared', 'unownb', 'unownc', 'unownd', 'unowne', 'unownf', 'unowng', 'unownh',
'unowni', 'unownj', 'unownk', 'unownl', 'unownm', 'unownn', 'unowno', 'unownp', 'unownq',
'unownr', 'unowns', 'unownt', 'unownu', 'unownv', 'unownw', 'unownx', 'unowny', 'unownz',
'unownem', 'unownqm', 'burmysandy', 'burmytrash', 'cherrimsunshine', 'shelloseast',
'gastrodoneast', 'deerlingsummer', 'deerlingautumn', 'deerlingwinter', 'sawsbucksummer',
'sawsbuckautumn', 'sawsbuckwinter', 'keldeoresolution', 'genesectdouse', 'genesectburn',
'genesectshock', 'genesectchill', 'basculinbluestriped', 'darmanitanzen', 'keldeoresolute',
'pikachucosplay',
]);

const BL: {[tier in Tier]?: Set<string>} = {
UU: new Set([
'hawlucha', 'dracozolt', 'diggersby', 'durant', 'weavile', 'ninetalesalola', 'gyarados',
Expand Down Expand Up @@ -547,6 +536,28 @@ function updateTiers(
const current: Map<ID, Tier | DoublesTier> = new Map();
const updated: Map<ID, Tier | DoublesTier> = new Map();
const NFE = new Set<ID>();

const compareArrays = (x: string[], y: string[]) => x.length === y.length &&
x.every((type, index) => type === y[index]);

const compareBaseStats = (a: Specie, b: Specie) => (['hp', 'atk', 'def', 'spa', 'spd', 'spe'] as StatID[])
.every(stat => a.baseStats[stat] === b.baseStats[stat]);

const SKIP = new Set(Array.from(gen.species).map(specie => {
let cosmeticFormes: ID[] = [];
if (specie.formes) {
for (let forme of specie.formes) {
const FORME_DATA = gen.species.get(forme);
if (FORME_DATA && forme !== specie.baseSpecies &&
compareBaseStats(FORME_DATA, specie) &&
compareArrays(FORME_DATA.types, specie.types)) {
cosmeticFormes = [...cosmeticFormes, FORME_DATA.id];
}
}
}
return cosmeticFormes;
}).flat());

for (const species of gen.species) {
if (SKIP.has(species.id) ||
species.isNonstandard ||
Expand Down

0 comments on commit 41ca79f

Please sign in to comment.