[Beta][Bug][UI/UX] Fix name position and types not being updated in battle info (#5913)

Fix name position and types not being updated in battle info
This commit is contained in:
Sirz Benjie 2025-06-02 07:59:10 -05:00 committed by GitHub
parent 88b8e05ee8
commit 9f892b906c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -447,12 +447,14 @@ export default abstract class BattleInfo extends Phaser.GameObjects.Container {
} }
/** Update the pokemon name inside the container */ /** Update the pokemon name inside the container */
protected updateName(name: string): boolean { protected updateName(pokemon: Pokemon): boolean {
const name = pokemon.getNameToRender();
if (this.lastName === name) { if (this.lastName === name) {
return false; return false;
} }
this.nameText.setText(name).setPositionRelative(this.box, -this.nameText.displayWidth, 0);
this.lastName = name; this.updateNameText(pokemon);
this.genderText.setPositionRelative(this.nameText, this.nameText.displayWidth, 0);
return true; return true;
} }
@ -572,7 +574,7 @@ export default abstract class BattleInfo extends Phaser.GameObjects.Container {
this.genderText.setText(getGenderSymbol(gender)).setColor(getGenderColor(gender)); this.genderText.setText(getGenderSymbol(gender)).setColor(getGenderColor(gender));
const nameUpdated = this.updateName(pokemon.getNameToRender()); const nameUpdated = this.updateName(pokemon);
const teraTypeUpdated = this.updateTeraType(pokemon.isTerastallized ? pokemon.getTeraType() : PokemonType.UNKNOWN); const teraTypeUpdated = this.updateTeraType(pokemon.isTerastallized ? pokemon.getTeraType() : PokemonType.UNKNOWN);
@ -584,6 +586,8 @@ export default abstract class BattleInfo extends Phaser.GameObjects.Container {
this.updateStatusIcon(pokemon); this.updateStatusIcon(pokemon);
this.setTypes(pokemon.getTypes(true, false, undefined, true));
if (this.lastHp !== pokemon.hp || this.lastMaxHp !== pokemon.getMaxHp()) { if (this.lastHp !== pokemon.hp || this.lastMaxHp !== pokemon.getMaxHp()) {
return this.updatePokemonHp(pokemon, resolve, instant); return this.updatePokemonHp(pokemon, resolve, instant);
} }