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);
}
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();

View File

@ -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: