mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-20 16:42:45 +02:00
[Bug][UI/UX] Update battle-info inside pokemon#damageAndUpdate (#5778)
* Update battle-info inside pokemon#damageAndUpdate * Ensure updatePokemonHp does not skip last hp number
This commit is contained in:
parent
92f1cfdd50
commit
3161461b6c
@ -4764,6 +4764,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
isIndirectDamage,
|
||||
ignoreFaintPhase,
|
||||
);
|
||||
// Ensure the battle-info bar's HP is updated, though only if the battle info is visible
|
||||
// TODO: When battle-info UI is refactored, make this only update the HP bar
|
||||
if (this.battleInfo.visible) {
|
||||
this.updateInfo();
|
||||
}
|
||||
// Damage amount may have changed, but needed to be queued before calling damage function
|
||||
damagePhase.updateAmount(damage);
|
||||
/**
|
||||
|
@ -727,6 +727,12 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
|
||||
},
|
||||
onComplete: () => {
|
||||
updateHpFrame();
|
||||
// If, after tweening, the hp is different from the original (due to rounding), force the hp number display
|
||||
// to update to the correct value.
|
||||
if (this.player && this.lastHp !== pokemon.hp) {
|
||||
this.setHpNumbers(pokemon.hp, pokemon.getMaxHp());
|
||||
this.lastHp = pokemon.hp;
|
||||
}
|
||||
resolve();
|
||||
},
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user