mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-16 14:55:22 +01:00
* Replace `@return` with `@returns`
* Remove extends tags
* Remove `@overrides` tag
* Remove `@abstract` tags
* Remove `@overload` tags
* Remove `@description` tags
* Remove `@static` tags
* Remove `@private` tags
* Remove `@warning`
* Remove `@PokemonSpecies`
* Remove {} appearing after `@returns`
* Remove {} appearing after `@param`
* Bump typedoc version
* Remove ...args in `@param` and replace with args
* Cleanup docs in challenge.ts
* Adjust hyphens
* Remove parenthesis in `@see` tags
* Remove old `@see` references
36 lines
1.4 KiB
TypeScript
36 lines
1.4 KiB
TypeScript
import { globalScene } from "#app/global-scene";
|
|
import { BattleSpec } from "#enums/battle-spec";
|
|
import type { Pokemon } from "#field/pokemon";
|
|
import i18next from "i18next";
|
|
|
|
/**
|
|
* 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
|
|
* @param useIllusion - Whether we want the name of the illusion or not. Default value : true
|
|
* @returns ex: "Wild Gengar", "Ectoplasma sauvage"
|
|
*/
|
|
export function getPokemonNameWithAffix(pokemon: Pokemon | undefined, useIllusion = true): string {
|
|
if (!pokemon) {
|
|
return "Missigno";
|
|
}
|
|
|
|
switch (globalScene.currentBattle.battleSpec) {
|
|
case BattleSpec.DEFAULT:
|
|
return pokemon.isEnemy()
|
|
? pokemon.hasTrainer()
|
|
? i18next.t("battle:foePokemonWithAffix", {
|
|
pokemonName: pokemon.getNameToRender(useIllusion),
|
|
})
|
|
: i18next.t("battle:wildPokemonWithAffix", {
|
|
pokemonName: pokemon.getNameToRender(useIllusion),
|
|
})
|
|
: pokemon.getNameToRender(useIllusion);
|
|
case BattleSpec.FINAL_BOSS:
|
|
return pokemon.isEnemy()
|
|
? i18next.t("battle:foePokemonWithAffix", { pokemonName: pokemon.getNameToRender(useIllusion) })
|
|
: pokemon.getNameToRender(useIllusion);
|
|
default:
|
|
return pokemon.getNameToRender(useIllusion);
|
|
}
|
|
}
|