2025-01-12 15:33:05 -08:00
|
|
|
import { globalScene } from "#app/global-scene";
|
2024-06-13 18:44:23 -04:00
|
|
|
import { BattleSpec } from "#enums/battle-spec";
|
2025-01-12 15:33:05 -08:00
|
|
|
import type Pokemon from "./field/pokemon";
|
2024-06-17 17:05:33 -04:00
|
|
|
import i18next from "i18next";
|
2023-04-15 01:32:16 -04:00
|
|
|
|
2024-06-06 15:36:12 +02:00
|
|
|
/**
|
|
|
|
* 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"
|
|
|
|
*/
|
2024-08-07 09:23:12 -07:00
|
|
|
export function getPokemonNameWithAffix(pokemon: Pokemon | undefined): string {
|
|
|
|
if (!pokemon) {
|
|
|
|
return "Missigno";
|
2024-08-13 23:12:42 +02:00
|
|
|
}
|
|
|
|
|
2025-01-12 15:33:05 -08:00
|
|
|
switch (globalScene.currentBattle.battleSpec) {
|
2024-10-19 18:44:36 -07:00
|
|
|
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();
|
2024-01-13 12:24:24 -05:00
|
|
|
}
|
2024-05-23 17:03:10 +02:00
|
|
|
}
|