From bb86ab6250ebe1db2df4ff5f6ecaf055cd33e8f0 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Wed, 26 Apr 2023 00:16:00 -0400 Subject: [PATCH] Fix ability description text wrapping improperly --- src/ui/battle-info.ts | 28 ++++++++++------------------ src/ui/summary-ui-handler.ts | 4 ++-- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/ui/battle-info.ts b/src/ui/battle-info.ts index febe3ca8a..556db7b88 100644 --- a/src/ui/battle-info.ts +++ b/src/ui/battle-info.ts @@ -160,6 +160,14 @@ export default class BattleInfo extends Phaser.GameObjects.Container { this.ownedIcon.setAlpha(this.statusIndicator.visible ? 0 : 1); } + const updateHpFrame = () => { + const hpFrame = this.hpBar.scaleX > 0.5 ? 'high' : this.hpBar.scaleX > 0.25 ? 'medium' : 'low'; + if (hpFrame !== this.lastHpFrame) { + this.hpBar.setFrame(hpFrame); + this.lastHpFrame = hpFrame; + }; + }; + const updatePokemonHp = () => { const duration = !instant ? Utils.clampInt(Math.abs((this.lastHp) - pokemon.hp) * 5, 250, 5000) : 0; this.scene.tweens.add({ @@ -174,13 +182,10 @@ export default class BattleInfo extends Phaser.GameObjects.Container { this.lastHp = tweenHp; } - const hpFrame = this.hpBar.scaleX > 0.5 ? 'high' : this.hpBar.scaleX > 0.25 ? 'medium' : 'low'; - if (hpFrame !== this.lastHpFrame) { - this.hpBar.setFrame(hpFrame); - this.lastHpFrame = hpFrame; - } + updateHpFrame(); }, onComplete: () => { + updateHpFrame(); resolve(); } }); @@ -225,19 +230,6 @@ export default class BattleInfo extends Phaser.GameObjects.Container { ease: 'Sine.easeIn', scaleX: ratio, duration: duration, - onUpdate: () => { - if (this.player && this.lastHp !== battler.hp) { - const tweenHp = Math.ceil(this.hpBar.scaleX * battler.getMaxHp()); - this.setHpNumbers(tweenHp, battler.getMaxHp()); - this.lastHp = tweenHp; - } - - const hpFrame = this.hpBar.scaleX > 0.5 ? 'high' : this.hpBar.scaleX > 0.25 ? 'medium' : 'low'; - if (hpFrame !== this.lastHpFrame) { - this.hpBar.setFrame(hpFrame); - this.lastHpFrame = hpFrame; - } - }, onComplete: () => { if (!this.scene) { resolve(); diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index 800c77162..6c04ac29d 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -441,8 +441,8 @@ export default class SummaryUiHandler extends UiHandler { abilityNameText.setOrigin(0, 1); profileContainer.add(abilityNameText); - const abilityDescriptionText = addTextObject(this.scene, 7, 82, ability.description, TextStyle.WINDOW, { wordWrap: { width: 1212 } }); - abilityDescriptionText.setOrigin(0, 1); + const abilityDescriptionText = addTextObject(this.scene, 7, 69, ability.description, TextStyle.WINDOW, { maxLines: 2, wordWrap: { width: 1212 } }); + abilityDescriptionText.setOrigin(0, 0); profileContainer.add(abilityDescriptionText); break; case Page.STATS: