mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-04-02 16:08:48 +01:00
* Added basic temp renaming * Made nickname persistant after reloading * Localization and cancel button * Fixed instant rename on active pokemon * Small bugfix to prevent console errors * Changed logic to use the new nickname field. Replaced most .name with getNameToRender() for display. * Changed evolution message. Removed log messagesc * Added localization keys for other languages * Removed empty lines * French translation Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> * Chinese translation Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Portuguese (Brazil) translation Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> * Korean translation Co-authored-by: Enoch <enoch.jwsong@gmail.com> * Update menu.ts * Update menu.ts [Localization(it)] * Changed most .getNameToRender() instance to getPokemonNameWithAffix() * Changed wild encounter messages back to just use the name without affix. * Added localization for the party ui rename selection * Escaping nickname characters to support all characters * Better Error handling * Update src/field/pokemon.ts Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> --------- Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr> Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com>
41 lines
1.7 KiB
TypeScript
41 lines
1.7 KiB
TypeScript
import { BattleSpec } from "#enums/battle-spec";
|
|
import Pokemon from "./field/pokemon";
|
|
import i18next from "i18next";
|
|
|
|
/**
|
|
* Builds a message by concatenating the Pokemon name with its potential affix and the given text
|
|
* @param pokemon {@linkcode Pokemon} name and battle context will be retrieved from this instance for {@linkcode getPokemonNameWithAffix}
|
|
* @param {string} content any text
|
|
* @returns {string} ex: "Wild Gengar fainted!", "Ectoplasma sauvage est K.O!"
|
|
* @see {@linkcode getPokemonNameWithAffix} for the Pokemon's name and potentiel affix
|
|
*/
|
|
export function getPokemonMessage(pokemon: Pokemon, content: string): string {
|
|
return `${getPokemonNameWithAffix(pokemon)}${content}`;
|
|
}
|
|
|
|
/**
|
|
* Retrieves the Pokemon's name, potentially with an affix indicating its role (wild or foe) in the current battle context, translated
|
|
* @param pokemon {@linkcode Pokemon} name and battle context will be retrieved from this instance
|
|
* @returns {string} ex: "Wild Gengar", "Ectoplasma sauvage"
|
|
*/
|
|
export function getPokemonNameWithAffix(pokemon: Pokemon): string {
|
|
switch (pokemon.scene.currentBattle.battleSpec) {
|
|
case BattleSpec.DEFAULT:
|
|
return !pokemon.isPlayer()
|
|
? pokemon.hasTrainer()
|
|
? i18next.t("battle:foePokemonWithAffix", {
|
|
pokemonName: pokemon.getNameToRender(),
|
|
})
|
|
: i18next.t("battle:wildPokemonWithAffix", {
|
|
pokemonName: pokemon.getNameToRender(),
|
|
})
|
|
: pokemon.getNameToRender();
|
|
case BattleSpec.FINAL_BOSS:
|
|
return !pokemon.isPlayer()
|
|
? i18next.t("battle:foePokemonWithAffix", { pokemonName: pokemon.getNameToRender() })
|
|
: pokemon.getNameToRender();
|
|
default:
|
|
return pokemon.getNameToRender();
|
|
}
|
|
}
|