mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-04-08 02:43:26 +01:00
* Create Getters, Setters, and Types * Work on `pokemon.ts` * Adjust Types, Refactor `White Herb` Modifier * Migrate `TempBattleStat` Usage * Refactor `PokemonBaseStatModifier` Slightly * Remove `BattleStat`, Use "Stat Stages" & New Names * Address Phase `integers` * Finalize `BattleStat` Removal * Address Minor Manual NITs * Apply Own Review Suggestions * Fix Syntax Error * Add Docs * Overhaul X Items * Implement Guard and Power Split with Unit Tests * Add Several Unit Tests and Fixes * Implement Speed Swap with Unit Tests * Fix Keys in Summary Menu * Fix Starf Berry Raising EVA and ACC * Fix Contrary & Simple, Verify with Unit Tests * Implement Power & Guard Swap with Unit Tests * Add Move Effect Message to Speed Swap * Add Move Effect Message to Power & Guard Split * Add Localization Entries * Adjust Last X Item Unit Test * Overhaul X Items Unit Tests * Finish Missing Docs * Revamp Crit-Based Unit Tests & Dire Hit * Address Initial NITs * Apply NIT Batch Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Fix Moody Test * Address Multiple Messages for `ProtectStatAbAttr` * Change `ignoreOverride` to `bypassSummonData` * Adjust Italian Localization Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Fix Moody --------- Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com>
76 lines
3.3 KiB
TypeScript
76 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";
|
|
} else if (stages === 2) {
|
|
return isIncrease ? "battle:statSharplyRose" : "battle:statHarshlyFell";
|
|
} else if (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]}`;
|
|
}
|
|
|
|
/**
|
|
* 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]}shortened`;
|
|
}
|