Fix ability description text wrapping improperly

This commit is contained in:
Flashfyre 2023-04-26 00:16:00 -04:00
parent 714e6408f5
commit bb86ab6250
2 changed files with 12 additions and 20 deletions

View File

@ -160,6 +160,14 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
this.ownedIcon.setAlpha(this.statusIndicator.visible ? 0 : 1); 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 updatePokemonHp = () => {
const duration = !instant ? Utils.clampInt(Math.abs((this.lastHp) - pokemon.hp) * 5, 250, 5000) : 0; const duration = !instant ? Utils.clampInt(Math.abs((this.lastHp) - pokemon.hp) * 5, 250, 5000) : 0;
this.scene.tweens.add({ this.scene.tweens.add({
@ -174,13 +182,10 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
this.lastHp = tweenHp; this.lastHp = tweenHp;
} }
const hpFrame = this.hpBar.scaleX > 0.5 ? 'high' : this.hpBar.scaleX > 0.25 ? 'medium' : 'low'; updateHpFrame();
if (hpFrame !== this.lastHpFrame) {
this.hpBar.setFrame(hpFrame);
this.lastHpFrame = hpFrame;
}
}, },
onComplete: () => { onComplete: () => {
updateHpFrame();
resolve(); resolve();
} }
}); });
@ -225,19 +230,6 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
ease: 'Sine.easeIn', ease: 'Sine.easeIn',
scaleX: ratio, scaleX: ratio,
duration: duration, 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: () => { onComplete: () => {
if (!this.scene) { if (!this.scene) {
resolve(); resolve();

View File

@ -441,8 +441,8 @@ export default class SummaryUiHandler extends UiHandler {
abilityNameText.setOrigin(0, 1); abilityNameText.setOrigin(0, 1);
profileContainer.add(abilityNameText); profileContainer.add(abilityNameText);
const abilityDescriptionText = addTextObject(this.scene, 7, 82, ability.description, TextStyle.WINDOW, { wordWrap: { width: 1212 } }); const abilityDescriptionText = addTextObject(this.scene, 7, 69, ability.description, TextStyle.WINDOW, { maxLines: 2, wordWrap: { width: 1212 } });
abilityDescriptionText.setOrigin(0, 1); abilityDescriptionText.setOrigin(0, 0);
profileContainer.add(abilityDescriptionText); profileContainer.add(abilityDescriptionText);
break; break;
case Page.STATS: case Page.STATS: