mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-07 07:59:26 +02:00
[Refactor] Mark nickname in pokemon as optional (#6168)
Mark nickname in pokemon as optional
This commit is contained in:
parent
48db9491c6
commit
0517d5704a
@ -11,7 +11,7 @@ export interface IllusionData {
|
|||||||
/** The name of pokemon featured in the illusion */
|
/** The name of pokemon featured in the illusion */
|
||||||
name: string;
|
name: string;
|
||||||
/** The nickname of the pokemon featured in the illusion */
|
/** The nickname of the pokemon featured in the illusion */
|
||||||
nickname: string;
|
nickname?: string;
|
||||||
/** Whether the pokemon featured in the illusion is shiny or not */
|
/** Whether the pokemon featured in the illusion is shiny or not */
|
||||||
shiny: boolean;
|
shiny: boolean;
|
||||||
/** The variant of the pokemon featured in the illusion */
|
/** The variant of the pokemon featured in the illusion */
|
||||||
|
@ -213,7 +213,11 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* TODO: Stop treating this like a unique ID and stop treating 0 as no pokemon
|
* TODO: Stop treating this like a unique ID and stop treating 0 as no pokemon
|
||||||
*/
|
*/
|
||||||
public id: number;
|
public id: number;
|
||||||
public nickname: string;
|
/**
|
||||||
|
* The Pokemon's current nickname, or `undefined` if it currently lacks one.
|
||||||
|
* If omitted, references to this should refer to the default name for this Pokemon's species.
|
||||||
|
*/
|
||||||
|
public nickname?: string;
|
||||||
public species: PokemonSpecies;
|
public species: PokemonSpecies;
|
||||||
public formIndex: number;
|
public formIndex: number;
|
||||||
public abilityIndex: number;
|
public abilityIndex: number;
|
||||||
@ -443,7 +447,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
getNameToRender(useIllusion = true) {
|
getNameToRender(useIllusion = true) {
|
||||||
const illusion = this.summonData.illusion;
|
const illusion = this.summonData.illusion;
|
||||||
const name = useIllusion ? (illusion?.name ?? this.name) : this.name;
|
const name = useIllusion ? (illusion?.name ?? this.name) : this.name;
|
||||||
const nickname: string = useIllusion ? (illusion?.nickname ?? this.nickname) : this.nickname;
|
const nickname: string | undefined = useIllusion ? illusion?.nickname : this.nickname;
|
||||||
try {
|
try {
|
||||||
if (nickname) {
|
if (nickname) {
|
||||||
return decodeURIComponent(escape(atob(nickname))); // TODO: Remove `atob` and `escape`... eventually...
|
return decodeURIComponent(escape(atob(nickname))); // TODO: Remove `atob` and `escape`... eventually...
|
||||||
|
Loading…
Reference in New Issue
Block a user