From 9f892b906ca6020d3e9c21cfdbe3e6242732a994 Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Mon, 2 Jun 2025 07:59:10 -0500 Subject: [PATCH] [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 --- src/ui/battle-info/battle-info.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ui/battle-info/battle-info.ts b/src/ui/battle-info/battle-info.ts index 7e6cc12bd3d..e67000bb243 100644 --- a/src/ui/battle-info/battle-info.ts +++ b/src/ui/battle-info/battle-info.ts @@ -447,12 +447,14 @@ export default abstract class BattleInfo extends Phaser.GameObjects.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) { 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; } @@ -572,7 +574,7 @@ export default abstract class BattleInfo extends Phaser.GameObjects.Container { 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); @@ -584,6 +586,8 @@ export default abstract class BattleInfo extends Phaser.GameObjects.Container { this.updateStatusIcon(pokemon); + this.setTypes(pokemon.getTypes(true, false, undefined, true)); + if (this.lastHp !== pokemon.hp || this.lastMaxHp !== pokemon.getMaxHp()) { return this.updatePokemonHp(pokemon, resolve, instant); }