pokerogue/src/@types/stat-types.ts
2025-06-15 09:56:31 -04:00

61 lines
1.1 KiB
TypeScript

import type { Head, Tail } from "#app/@types/utility-types/tuple";
// biome-ignore lint/correctness/noUnusedImports: Type Imports
import type { PermanentStat, BattleStat } from "#enums/stat";
type StatTuple = [
hp: number,
atk: number,
def: number,
spAtk: number,
spDef: number,
spd: number,
acc: number,
eva: number,
];
/** Tuple containing all {@linkcode PermanentStat}s of a Pokemon. */
export type PermanentStatTuple = Head<Head<StatTuple>>;
/** Tuple containing all {@linkcode BattleStat}s of a Pokemon. */
export type BattleStatTuple = Tail<PermanentStatTuple>;
/** Integer literal union containing all numbers from 0-31 inclusive; used to strongly type Pokemon IVs. */
export type IVType =
| 0
| 1
| 2
| 3
| 4
| 5
| 6
| 7
| 8
| 9
| 10
| 11
| 12
| 13
| 14
| 15
| 16
| 17
| 18
| 19
| 20
| 21
| 22
| 23
| 24
| 25
| 26
| 27
| 28
| 29
| 30
| 31;
type toIvTuple<T extends [...any]> = { [k in keyof T]: IVType };
/** A 6-length tuple of integers in the range [0-31]; used to strongly type Pokemon IVs. */
export type IVTuple = toIvTuple<PermanentStatTuple>;