sprites/ps-pokemon.sheet.mjs
Christopher Monsanto d9d55465b4 ps sheet: disable some gen 9 mons
until i can fix whatever problem this is
2023-01-22 11:06:10 -05:00

611 lines
15 KiB
JavaScript

import fs from 'fs';
import path from 'path';
import * as spritedata from '@smogon/sprite-data';
import root from '@smogon/sprite-root';
const srcDir = path.join(root, "src");
const spritesDir = path.join(srcDir, "minisprites/pokemon/gen6");
function toPSID(name) {
return name.toLowerCase().replace(/[^a-z0-9]+/g, '');
}
// Derived from pokemon-showdown-client/src/battle-dex-data.ts
const BattlePokemonIconIndexes = {
unknown: 0,
egg: 1020 + 1,
pikachubelle: 1020 + 2,
pikachulibre: 1020 + 3,
pikachuphd: 1020 + 4,
pikachupopstar: 1020 + 5,
pikachurockstar: 1020 + 6,
pikachucosplay: 1020 + 7,
unownexclamation: 1020 + 8,
unownquestion: 1020 + 9,
unownb: 1020 + 10,
unownc: 1020 + 11,
unownd: 1020 + 12,
unowne: 1020 + 13,
unownf: 1020 + 14,
unowng: 1020 + 15,
unownh: 1020 + 16,
unowni: 1020 + 17,
unownj: 1020 + 18,
unownk: 1020 + 19,
unownl: 1020 + 20,
unownm: 1020 + 21,
unownn: 1020 + 22,
unowno: 1020 + 23,
unownp: 1020 + 24,
unownq: 1020 + 25,
unownr: 1020 + 26,
unowns: 1020 + 27,
unownt: 1020 + 28,
unownu: 1020 + 29,
unownv: 1020 + 30,
unownw: 1020 + 31,
unownx: 1020 + 32,
unowny: 1020 + 33,
unownz: 1020 + 34,
castformrainy: 1020 + 35,
castformsnowy: 1020 + 36,
castformsunny: 1020 + 37,
deoxysattack: 1020 + 38,
deoxysdefense: 1020 + 39,
deoxysspeed: 1020 + 40,
burmysandy: 1020 + 41,
burmytrash: 1020 + 42,
wormadamsandy: 1020 + 43,
wormadamtrash: 1020 + 44,
cherrimsunshine: 1020 + 45,
shelloseast: 1020 + 46,
gastrodoneast: 1020 + 47,
rotomfan: 1020 + 48,
rotomfrost: 1020 + 49,
rotomheat: 1020 + 50,
rotommow: 1020 + 51,
rotomwash: 1020 + 52,
giratinaorigin: 1020 + 53,
shayminsky: 1020 + 54,
unfezantf: 1020 + 55,
basculinbluestriped: 1020 + 56,
darmanitanzen: 1020 + 57,
deerlingautumn: 1020 + 58,
deerlingsummer: 1020 + 59,
deerlingwinter: 1020 + 60,
sawsbuckautumn: 1020 + 61,
sawsbucksummer: 1020 + 62,
sawsbuckwinter: 1020 + 63,
frillishf: 1020 + 64,
jellicentf: 1020 + 65,
tornadustherian: 1020 + 66,
thundurustherian: 1020 + 67,
landorustherian: 1020 + 68,
kyuremblack: 1020 + 69,
kyuremwhite: 1020 + 70,
keldeoresolute: 1020 + 71,
meloettapirouette: 1020 + 72,
vivillonarchipelago: 1020 + 73,
vivilloncontinental: 1020 + 74,
vivillonelegant: 1020 + 75,
vivillonfancy: 1020 + 76,
vivillongarden: 1020 + 77,
vivillonhighplains: 1020 + 78,
vivillonicysnow: 1020 + 79,
vivillonjungle: 1020 + 80,
vivillonmarine: 1020 + 81,
vivillonmodern: 1020 + 82,
vivillonmonsoon: 1020 + 83,
vivillonocean: 1020 + 84,
vivillonpokeball: 1020 + 85,
vivillonpolar: 1020 + 86,
vivillonriver: 1020 + 87,
vivillonsandstorm: 1020 + 88,
vivillonsavanna: 1020 + 89,
vivillonsun: 1020 + 90,
vivillontundra: 1020 + 91,
pyroarf: 1020 + 92,
flabebeblue: 1020 + 93,
flabebeorange: 1020 + 94,
flabebewhite: 1020 + 95,
flabebeyellow: 1020 + 96,
floetteblue: 1020 + 97,
floetteeternal: 1020 + 98,
floetteorange: 1020 + 99,
floettewhite: 1020 + 100,
floetteyellow: 1020 + 101,
florgesblue: 1020 + 102,
florgesorange: 1020 + 103,
florgeswhite: 1020 + 104,
florgesyellow: 1020 + 105,
furfroudandy: 1020 + 106,
furfroudebutante: 1020 + 107,
furfroudiamond: 1020 + 108,
furfrouheart: 1020 + 109,
furfroukabuki: 1020 + 110,
furfroulareine: 1020 + 111,
furfroumatron: 1020 + 112,
furfroupharaoh: 1020 + 113,
furfroustar: 1020 + 114,
meowsticf: 1020 + 115,
aegislashblade: 1020 + 116,
// Added
xerneasneutral: 1020 + 117,
hoopaunbound: 1020 + 118,
rattataalola: 1020 + 119,
raticatealola: 1020 + 120,
raichualola: 1020 + 121,
sandshrewalola: 1020 + 122,
sandslashalola: 1020 + 123,
vulpixalola: 1020 + 124,
ninetalesalola: 1020 + 125,
diglettalola: 1020 + 126,
dugtrioalola: 1020 + 127,
meowthalola: 1020 + 128,
persianalola: 1020 + 129,
geodudealola: 1020 + 130,
graveleralola: 1020 + 131,
golemalola: 1020 + 132,
grimeralola: 1020 + 133,
mukalola: 1020 + 134,
exeggutoralola: 1020 + 135,
marowakalola: 1020 + 136,
greninjaash: 1020 + 137,
zygarde10: 1020 + 138,
zygardecomplete: 1020 + 139,
oricoriopompom: 1020 + 140,
oricoriopau: 1020 + 141,
oricoriosensu: 1020 + 142,
lycanrocmidnight: 1020 + 143,
wishiwashischool: 1020 + 144,
miniormeteor: 1020 + 145,
miniororange: 1020 + 146,
minioryellow: 1020 + 147,
miniorgreen: 1020 + 148,
miniorblue: 1020 + 149,
miniorindigo: 1020 + 150,
miniorviolet: 1020 + 151,
magearnaoriginal: 1020 + 152,
pikachuoriginal: 1020 + 153,
pikachuhoenn: 1020 + 154,
pikachusinnoh: 1020 + 155,
pikachuunova: 1020 + 156,
pikachukalos: 1020 + 157,
pikachualola: 1020 + 158,
pikachupartner: 1020 + 159,
lycanrocdusk: 1020 + 160,
necrozmaduskmane: 1020 + 161,
necrozmadawnwings: 1020 + 162,
necrozmaultra: 1020 + 163,
pikachustarter: 1020 + 164,
eeveestarter: 1020 + 165,
meowthgalar: 1020 + 166,
ponytagalar: 1020 + 167,
rapidashgalar: 1020 + 168,
farfetchdgalar: 1020 + 169,
weezinggalar: 1020 + 170,
mrmimegalar: 1020 + 171,
corsolagalar: 1020 + 172,
zigzagoongalar: 1020 + 173,
linoonegalar: 1020 + 174,
darumakagalar: 1020 + 175,
darmanitangalar: 1020 + 176,
darmanitangalarzen: 1020 + 177,
yamaskgalar: 1020 + 178,
stunfiskgalar: 1020 + 179,
cramorantgulping: 1020 + 180,
cramorantgorging: 1020 + 181,
toxtricitylowkey: 1020 + 182,
//sinisteaantique: 854,
//polteageistantique: 855,
alcremierubycream: 1020 + 183,
alcremiematchacream: 1020 + 184,
alcremiemintcream: 1020 + 185,
alcremielemoncream: 1020 + 186,
alcremiesaltedcream: 1020 + 187,
alcremierubyswirl: 1020 + 188,
alcremiecaramelswirl: 1020 + 189,
alcremierainbowswirl: 1020 + 190,
eiscuenoice: 1020 + 191,
indeedeef: 1020 + 192,
morpekohangry: 1020 + 193,
zaciancrowned: 1020 + 194,
zamazentacrowned: 1020 + 195,
slowpokegalar: 1020 + 196,
slowbrogalar: 1020 + 197,
zarudedada: 1020 + 198,
pikachuworld: 1020 + 199,
articunogalar: 1020 + 200,
zapdosgalar: 1020 + 201,
moltresgalar: 1020 + 202,
slowkinggalar: 1020 + 203,
calyrexice: 1020 + 204,
calyrexshadow: 1020 + 205,
// growlithehisui: 1020 + 206,
// arcaninehisui: 1020 + 207,
// voltorbhisui: 1020 + 208,
// electrodehisui: 1020 + 209,
// typhlosionhisui: 1020 + 210,
// qwilfishhisui: 1020 + 211,
// sneaselhisui: 1020 + 212,
// samurotthisui: 1020 + 213,
// lilliganthisui: 1020 + 214,
// zoruahisui: 1020 + 215,
// zoroarkhisui: 1020 + 216,
// braviaryhisui: 1020 + 217,
// sliggoohisui: 1020 + 218,
// goodrahisui: 1020 + 219,
// avalugghisui: 1020 + 220,
// decidueyehisui: 1020 + 221,
// basculegionf: 1020 + 222,
// enamorustherian: 1020 + 223,
// taurospaldea: 1020 + 224,
// taurospaldeafire: 1020 + 225,
// taurospaldeawater: 1020 + 226,
// wooperpaldea: 1020 + 227,
// oinkolognef: 1020 + 228,
// palafinhero: 1020 + 229,
// mausholdfour: 1020 + 230,
// tatsugiridroopy: 1020 + 231,
// tatsugiristretchy: 1020 + 232,
// squawkabillyblue: 1020 + 233,
// squawkabillyyellow: 1020 + 234,
// squawkabillywhite: 1020 + 235,
// gimmighoulroaming: 1020 + 236,
// dialgaorigin: 1020 + 237,
// palkiaorigin: 1020 + 238,
//basculinwhitestriped: 1020 + 239,
//gumshoostotem: 735,
//raticatealolatotem: 900 + 120,
//marowakalolatotem: 900 + 136,
//araquanidtotem: 752,
//lurantistotem: 754,
//salazzletotem: 758,
//vikavolttotem: 738,
//togedemarutotem: 777,
//mimikyutotem: 778,
//mimikyubustedtotem: 778,
//ribombeetotem: 743,
//kommoototem: 784,
venusaurmega: 1260 + 0,
charizardmegax: 1260 + 1,
charizardmegay: 1260 + 2,
blastoisemega: 1260 + 3,
beedrillmega: 1260 + 4,
pidgeotmega: 1260 + 5,
alakazammega: 1260 + 6,
slowbromega: 1260 + 7,
gengarmega: 1260 + 8,
kangaskhanmega: 1260 + 9,
pinsirmega: 1260 + 10,
gyaradosmega: 1260 + 11,
aerodactylmega: 1260 + 12,
mewtwomegax: 1260 + 13,
mewtwomegay: 1260 + 14,
ampharosmega: 1260 + 15,
steelixmega: 1260 + 16,
scizormega: 1260 + 17,
heracrossmega: 1260 + 18,
houndoommega: 1260 + 19,
tyranitarmega: 1260 + 20,
sceptilemega: 1260 + 21,
blazikenmega: 1260 + 22,
swampertmega: 1260 + 23,
gardevoirmega: 1260 + 24,
sableyemega: 1260 + 25,
mawilemega: 1260 + 26,
aggronmega: 1260 + 27,
medichammega: 1260 + 28,
manectricmega: 1260 + 29,
sharpedomega: 1260 + 30,
cameruptmega: 1260 + 31,
altariamega: 1260 + 32,
banettemega: 1260 + 33,
absolmega: 1260 + 34,
glaliemega: 1260 + 35,
salamencemega: 1260 + 36,
metagrossmega: 1260 + 37,
latiasmega: 1260 + 38,
latiosmega: 1260 + 39,
kyogreprimal: 1260 + 40,
groudonprimal: 1260 + 41,
rayquazamega: 1260 + 42,
lopunnymega: 1260 + 43,
garchompmega: 1260 + 44,
lucariomega: 1260 + 45,
abomasnowmega: 1260 + 46,
gallademega: 1260 + 47,
audinomega: 1260 + 48,
dianciemega: 1260 + 49,
charizardgmax: 1260 + 50,
butterfreegmax: 1260 + 51,
pikachugmax: 1260 + 52,
meowthgmax: 1260 + 53,
machampgmax: 1260 + 54,
gengargmax: 1260 + 55,
kinglergmax: 1260 + 56,
laprasgmax: 1260 + 57,
eeveegmax: 1260 + 58,
snorlaxgmax: 1260 + 59,
garbodorgmax: 1260 + 60,
melmetalgmax: 1260 + 61,
corviknightgmax: 1260 + 62,
orbeetlegmax: 1260 + 63,
drednawgmax: 1260 + 64,
coalossalgmax: 1260 + 65,
flapplegmax: 1260 + 66,
appletungmax: 1260 + 67,
sandacondagmax: 1260 + 68,
toxtricitygmax: 1260 + 69,
//toxtricitylowkeygmax: 1260 + 69,
centiskorchgmax: 1260 + 70,
hatterenegmax: 1260 + 71,
grimmsnarlgmax: 1260 + 72,
alcremiegmax: 1260 + 73,
copperajahgmax: 1260 + 74,
duraludongmax: 1260 + 75,
eternatuseternamax: 1260 + 76,
venusaurgmax: 1260 + 77,
blastoisegmax: 1260 + 78,
rillaboomgmax: 1260 + 79,
cinderacegmax: 1260 + 80,
inteleongmax: 1260 + 81,
urshifugmax: 1260 + 82,
urshifurapidstrikegmax: 1260 + 83,
syclant: 1452 + 0,
revenankh: 1452 + 1,
pyroak: 1452 + 2,
fidgit: 1452 + 3,
stratagem: 1452 + 4,
arghonaut: 1452 + 5,
kitsunoh: 1452 + 6,
cyclohm: 1452 + 7,
colossoil: 1452 + 8,
krilowatt: 1452 + 9,
voodoom: 1452 + 10,
tomohawk: 1452 + 11,
necturna: 1452 + 12,
mollux: 1452 + 13,
aurumoth: 1452 + 14,
malaconda: 1452 + 15,
cawmodore: 1452 + 16,
volkraken: 1452 + 17,
plasmanta: 1452 + 18,
naviathan: 1452 + 19,
crucibelle: 1452 + 20,
crucibellemega: 1452 + 21,
kerfluffle: 1452 + 22,
pajantom: 1452 + 23,
jumbao: 1452 + 24,
caribolt: 1452 + 25,
smokomodo: 1452 + 26,
snaelstrom: 1452 + 27,
equilibra: 1452 + 28,
astrolotl: 1452 + 29,
miasmaw: 1452 + 30,
chromera: 1452 + 31,
venomicon: 1452 + 32,
venomiconepilogue: 1452 + 33,
saharaja: 1452 + 34,
syclar: 1488 + 0,
embirch: 1488 + 1,
flarelm: 1488 + 2,
breezi: 1488 + 3,
scratchet: 1488 + 4,
necturine: 1488 + 5,
cupra: 1488 + 6,
argalis: 1488 + 7,
brattler: 1488 + 8,
cawdet: 1488 + 9,
volkritter: 1488 + 10,
snugglow: 1488 + 11,
floatoy: 1488 + 12,
caimanoe: 1488 + 13,
pluffle: 1488 + 14,
rebble: 1488 + 15,
tactite: 1488 + 16,
privatyke: 1488 + 17,
nohface: 1488 + 18,
monohm: 1488 + 19,
duohm: 1488 + 20,
protowatt: 1488 + 21,
voodoll: 1488 + 22,
mumbao: 1488 + 23,
fawnifer: 1488 + 24,
electrelk: 1488 + 25,
smogecko: 1488 + 26,
smoguana: 1488 + 27,
swirlpool: 1488 + 28,
coribalis: 1488 + 29,
justyke: 1488 + 30,
solotl: 1488 + 31,
miasmite: 1488 + 32,
dorsoil: 1488 + 33,
//saharascal: 1488 + 34,
};
const BattlePokemonIconIndexesLeft = {
pikachubelle: 1344 + 0,
pikachupopstar: 1344 + 1,
clefairy: 1344 + 2,
clefable: 1344 + 3,
jigglypuff: 1344 + 4,
wigglytuff: 1344 + 5,
dugtrioalola: 1344 + 6,
poliwhirl: 1344 + 7,
poliwrath: 1344 + 8,
mukalola: 1344 + 9,
kingler: 1344 + 10,
croconaw: 1344 + 11,
cleffa: 1344 + 12,
igglybuff: 1344 + 13,
politoed: 1344 + 14,
unownb: 1344 + 15,
unownc: 1344 + 16,
unownd: 1344 + 17,
unowne: 1344 + 18,
unownf: 1344 + 19,
unowng: 1344 + 20,
unownh: 1344 + 21,
unownj: 1344 + 22,
unownk: 1344 + 23,
unownl: 1344 + 24,
unownm: 1344 + 25,
unownn: 1344 + 26,
unownp: 1344 + 27,
unownq: 1344 + 28,
unownquestion: 1344 + 29,
unownr: 1344 + 30,
unowns: 1344 + 31,
unownt: 1344 + 32,
unownv: 1344 + 33,
unownz: 1344 + 34,
sneasel: 1344 + 35,
teddiursa: 1344 + 36,
roselia: 1344 + 37,
zangoose: 1344 + 38,
seviper: 1344 + 39,
castformsnowy: 1344 + 40,
absolmega: 1344 + 41,
absol: 1344 + 42,
regirock: 1344 + 43,
torterra: 1344 + 44,
budew: 1344 + 45,
roserade: 1344 + 46,
magmortar: 1344 + 47,
togekiss: 1344 + 48,
rotomwash: 1344 + 49,
shayminsky: 1344 + 50,
emboar: 1344 + 51,
pansear: 1344 + 52,
simisear: 1344 + 53,
drilbur: 1344 + 54,
excadrill: 1344 + 55,
sawk: 1344 + 56,
lilligant: 1344 + 57,
garbodor: 1344 + 58,
solosis: 1344 + 59,
vanilluxe: 1344 + 60,
amoonguss: 1344 + 61,
klink: 1344 + 62,
klang: 1344 + 63,
klinklang: 1344 + 64,
litwick: 1344 + 65,
golett: 1344 + 66,
golurk: 1344 + 67,
kyuremblack: 1344 + 68,
kyuremwhite: 1344 + 69,
kyurem: 1344 + 70,
keldeoresolute: 1344 + 71,
meloetta: 1344 + 72,
greninja: 1344 + 73,
greninjaash: 1344 + 74,
furfroudebutante: 1344 + 75,
barbaracle: 1344 + 76,
clauncher: 1344 + 77,
clawitzer: 1344 + 78,
sylveon: 1344 + 79,
klefki: 1344 + 80,
zygarde: 1344 + 81,
zygarde10: 1344 + 82,
zygardecomplete: 1344 + 83,
dartrix: 1344 + 84,
steenee: 1344 + 85,
tsareena: 1344 + 86,
comfey: 1344 + 87,
miniormeteor: 1344 + 88,
minior: 1344 + 89,
miniororange: 1344 + 90,
minioryellow: 1344 + 91,
miniorgreen: 1344 + 92,
miniorblue: 1344 + 93,
miniorviolet: 1344 + 94,
miniorindigo: 1344 + 95,
dhelmise: 1344 + 96,
necrozma: 1344 + 97,
marshadow: 1344 + 98,
pikachuoriginal: 1344 + 99,
pikachupartner: 1344 + 100,
necrozmaduskmane: 1344 + 101,
necrozmadawnwings: 1344 + 102,
necrozmaultra: 1344 + 103,
stakataka: 1344 + 104,
blacephalon: 1344 + 105,
};
const entries = [];
let errors = [];
// Need to figure out how to remove this readdir; tup doesn't like it
for (const name of fs.readdirSync(spritesDir)) {
const parsed = path.parse(name);
const sn = spritedata.parseFilename(parsed.name);
let entry;
if (!sn.extension) {
entry = spritedata.get(sn.id);
}
let id = toPSID(entry ? entry.base + entry.forme : sn.name);
if (sn.extra.has("f")) id += 'f';
if (sn.extra.has("g")) id += 'gmax';
let index;
if (sn.extra.has("a")) {
index = BattlePokemonIconIndexesLeft[id];
BattlePokemonIconIndexesLeft[id] = 'found';
} else {
index = BattlePokemonIconIndexes[id];
BattlePokemonIconIndexes[id] = 'found';
}
if (index === undefined) {
if (entry) {
index = entry.num;
} else {
errors.push(`can't find ${name}`);
continue;
}
}
entries[index] = path.join(spritesDir, name);
}
for (const [id, num] of Object.entries(BattlePokemonIconIndexes)) {
if (num !== 'found') {
errors.push(`didn't find ${id}`);
}
}
for (const [id, num] of Object.entries(BattlePokemonIconIndexesLeft)) {
if (num !== 'found') {
errors.push(`didn't find left ${id}`);
}
}
if (errors.length) {
for (let error of errors) {
console.error(error);
}
process.exit(1);
}
for (let i = 0; i < entries.length; i++) {
if (entries[i] === undefined)
entries[i] = null;
}
export default {
width: 40,
height: 30,
tile: 12,
entries
};