Create getShinyDescriptor function in utils

This commit is contained in:
Sirz Benjie 2025-04-23 09:54:39 -05:00
parent d69fc04188
commit 438c2cba39
No known key found for this signature in database
GPG Key ID: 4A524B4D196C759E

View File

@ -2,6 +2,7 @@ import { MoneyFormat } from "#enums/money-format";
import { Moves } from "#enums/moves";
import i18next from "i18next";
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
import type { Variant } from "#app/sprites/variant";
export type nil = null | undefined;
@ -576,3 +577,18 @@ export function animationFileName(move: Moves): string {
export function camelCaseToKebabCase(str: string): string {
return str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (s, o) => (o ? "-" : "") + s.toLowerCase());
}
/** Get the localized shiny descriptor for the provided variant
* @param variant - The variant to get the shiny descriptor for
* @returns The localized shiny descriptor
*/
export function getShinyDescriptor(variant: Variant): string {
switch (variant) {
case 2:
return i18next.t("common:epicShiny");
case 1:
return i18next.t("common:shiny");
case 0:
return i18next.t("common:normal");
}
}