mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-17 07:15:22 +01:00
* Added more biome rules * Fixes * Added a few more rules * Added global phaser to biome * Fix tpyo * Updated biome to 2.1.4; improved docs on linting/localization; added vcs support Also added `.build` to gitignore cuz reasons * Fixed tpyo * dd * Applied linter fixes * Partially fixed some private property issues * Upgraded to Biome 2.2.0; added `operatorLinebreak` and a few new rules * Moved operator linebreaks before lines * Applied kev's suggestions * Update biome.jsonc Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * added like all the rules and then some * modify biome.jsonc * apply biome formatting * Reverted changes to balance folder * fixed stuff * Fixed biome stripping trailing globstars from everything * made `noInvertedElse` an error rule * Add & apply fixes for `useExplicitLengthCheck`, `useAtIndex` and `noNonNullAssertedOptionalChain` * Bumped biome to 2.2.3 * Fixed a few syntax errors * Removed trailing globstars since biome actually fixed their shit * Final clean up * foobarbaz * Fixed remaining issues * Fixed a few errors in SSUI * fixed rounding issue * Fixed test to not round funky * Fixed biome false positive for vitest hooks * Apply biome:all --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
78 lines
3.3 KiB
TypeScript
78 lines
3.3 KiB
TypeScript
/** Enum that comprises all possible stat-related attributes, in-battle and permanent, of a Pokemon. */
|
|
export enum Stat {
|
|
/** Hit Points */
|
|
HP = 0,
|
|
/** Attack */
|
|
ATK,
|
|
/** Defense */
|
|
DEF,
|
|
/** Special Attack */
|
|
SPATK,
|
|
/** Special Defense */
|
|
SPDEF,
|
|
/** Speed */
|
|
SPD,
|
|
/** Accuracy */
|
|
ACC,
|
|
/** Evasiveness */
|
|
EVA,
|
|
}
|
|
|
|
/** A constant array comprised of the {@linkcode Stat} values that make up {@linkcode PermanentStat}. */
|
|
export const PERMANENT_STATS = [Stat.HP, Stat.ATK, Stat.DEF, Stat.SPATK, Stat.SPDEF, Stat.SPD] as const;
|
|
/** Type used to describe the core, permanent stats of a Pokemon. */
|
|
export type PermanentStat = (typeof PERMANENT_STATS)[number];
|
|
|
|
/** A constant array comprised of the {@linkcode Stat} values that make up {@linkcode EFfectiveStat}. */
|
|
export const EFFECTIVE_STATS = [Stat.ATK, Stat.DEF, Stat.SPATK, Stat.SPDEF, Stat.SPD] as const;
|
|
/** Type used to describe the intersection of core stats and stats that have stages in battle. */
|
|
export type EffectiveStat = (typeof EFFECTIVE_STATS)[number];
|
|
|
|
/** A constant array comprised of {@linkcode Stat} the values that make up {@linkcode BattleStat}. */
|
|
export const BATTLE_STATS = [Stat.ATK, Stat.DEF, Stat.SPATK, Stat.SPDEF, Stat.SPD, Stat.ACC, Stat.EVA] as const;
|
|
/** Type used to describe the stats that have stages which can be incremented and decremented in battle. */
|
|
export type BattleStat = (typeof BATTLE_STATS)[number];
|
|
|
|
/** A constant array comprised of {@linkcode Stat} the values that make up {@linkcode TempBattleStat}. */
|
|
export const TEMP_BATTLE_STATS = [Stat.ATK, Stat.DEF, Stat.SPATK, Stat.SPDEF, Stat.SPD, Stat.ACC] as const;
|
|
/** Type used to describe the stats that have X item (`TEMP_STAT_STAGE_BOOSTER`) equivalents. */
|
|
export type TempBattleStat = (typeof TEMP_BATTLE_STATS)[number];
|
|
|
|
/**
|
|
* Provides the translation key corresponding to the amount of stat stages and whether those stat stages
|
|
* are positive or negative.
|
|
* @param stages the amount of stages
|
|
* @param isIncrease dictates a negative (`false`) or a positive (`true`) stat stage change
|
|
* @returns the translation key fitting the conditions described by {@linkcode stages} and {@linkcode isIncrease}
|
|
*/
|
|
export function getStatStageChangeDescriptionKey(stages: number, isIncrease: boolean) {
|
|
if (stages === 1) {
|
|
return isIncrease ? "battle:statRose" : "battle:statFell";
|
|
}
|
|
if (stages === 2) {
|
|
return isIncrease ? "battle:statSharplyRose" : "battle:statHarshlyFell";
|
|
}
|
|
if (stages > 2 && stages <= 6) {
|
|
return isIncrease ? "battle:statRoseDrastically" : "battle:statSeverelyFell";
|
|
}
|
|
return isIncrease ? "battle:statWontGoAnyHigher" : "battle:statWontGoAnyLower";
|
|
}
|
|
|
|
/**
|
|
* Provides the translation key corresponding to a given stat which can be translated into its full name.
|
|
* @param stat the {@linkcode Stat} to be translated
|
|
* @returns the translation key corresponding to the given {@linkcode Stat}
|
|
*/
|
|
export function getStatKey(stat: Stat) {
|
|
return `pokemonInfo:stat.${Stat[stat].toLowerCase()}`;
|
|
}
|
|
|
|
/**
|
|
* Provides the translation key corresponding to a given stat which can be translated into its shortened name.
|
|
* @param stat the {@linkcode Stat} to be translated
|
|
* @returns the translation key corresponding to the given {@linkcode Stat}
|
|
*/
|
|
export function getShortenedStatKey(stat: PermanentStat) {
|
|
return `pokemonInfo:stat.${Stat[stat].toLowerCase()}Shortened`;
|
|
}
|