Fix egg hatch screen issues

This commit is contained in:
Flashfyre 2024-04-06 21:48:48 -04:00
parent 70ce649eec
commit 9ee9a0a86b
3 changed files with 17 additions and 8 deletions

View File

@ -1640,6 +1640,10 @@ export default class BattleScene extends SceneBase {
this.updateModifiers(false).then(() => this.updateUIPositions()); this.updateModifiers(false).then(() => this.updateUIPositions());
} }
setModifiersVisible(visible: boolean) {
[ this.modifierBar, this.enemyModifierBar ].map(m => m.setVisible(visible));
}
updateModifiers(player?: boolean, instant?: boolean): Promise<void> { updateModifiers(player?: boolean, instant?: boolean): Promise<void> {
if (player === undefined) if (player === undefined)
player = true; player = true;

View File

@ -113,36 +113,36 @@ export class EggHatchPhase extends Phase {
this.canSkip = true; this.canSkip = true;
this.scene.time.delayedCall(1000, () => { this.scene.time.delayedCall(1000, () => {
if (!this.skipped) if (!this.hatched)
this.evolutionBgm = this.scene.playSoundWithoutBgm('evolution'); this.evolutionBgm = this.scene.playSoundWithoutBgm('evolution');
}); });
this.scene.time.delayedCall(2000, () => { this.scene.time.delayedCall(2000, () => {
if (this.skipped) if (this.hatched)
return; return;
this.eggCrackSprite.setVisible(true); this.eggCrackSprite.setVisible(true);
this.doSpray(1, this.eggSprite.displayHeight / -2); this.doSpray(1, this.eggSprite.displayHeight / -2);
this.doEggShake(2).then(() => { this.doEggShake(2).then(() => {
if (this.skipped) if (this.hatched)
return; return;
this.scene.time.delayedCall(1000, () => { this.scene.time.delayedCall(1000, () => {
if (this.skipped) if (this.hatched)
return; return;
this.doSpray(2, this.eggSprite.displayHeight / -4); this.doSpray(2, this.eggSprite.displayHeight / -4);
this.eggCrackSprite.setFrame('1'); this.eggCrackSprite.setFrame('1');
this.scene.time.delayedCall(125, () => this.eggCrackSprite.setFrame('2')); this.scene.time.delayedCall(125, () => this.eggCrackSprite.setFrame('2'));
this.doEggShake(4).then(() => { this.doEggShake(4).then(() => {
if (this.skipped) if (this.hatched)
return; return;
this.scene.time.delayedCall(1000, () => { this.scene.time.delayedCall(1000, () => {
if (this.skipped) if (this.hatched)
return; return;
this.scene.playSound('egg_crack'); this.scene.playSound('egg_crack');
this.doSpray(4); this.doSpray(4);
this.eggCrackSprite.setFrame('3'); this.eggCrackSprite.setFrame('3');
this.scene.time.delayedCall(125, () => this.eggCrackSprite.setFrame('4')); this.scene.time.delayedCall(125, () => this.eggCrackSprite.setFrame('4'));
this.doEggShake(8, 2).then(() => { this.doEggShake(8, 2).then(() => {
if (!this.skipped) if (!this.hatched)
this.doHatch(); this.doHatch();
}); });
}); });
@ -153,9 +153,12 @@ export class EggHatchPhase extends Phase {
}); });
}); });
} }
end() { end() {
if (this.scene.findPhase((p) => p instanceof EggHatchPhase)) if (this.scene.findPhase((p) => p instanceof EggHatchPhase))
this.eggHatchHandler.clear(); this.eggHatchHandler.clear();
else
this.scene.time.delayedCall(250, () => this.scene.setModifiersVisible(true));
super.end(); super.end();
} }

View File

@ -27,6 +27,8 @@ export default class EggHatchSceneHandler extends UiHandler {
this.getUi().showText(null, 0); this.getUi().showText(null, 0);
this.scene.setModifiersVisible(false);
return true; return true;
} }