Fix duplicate transition at the end of batch hatching

This commit is contained in:
Matthew 2024-04-05 17:50:01 -04:00 committed by Samuel H
parent 77e8ff3785
commit 6b5bc5b830
2 changed files with 12 additions and 13 deletions

View File

@ -154,8 +154,9 @@ export class EggHatchPhase extends Phase {
});
}
end() {
this.eggHatchHandler.clear()
super.end()
if (this.scene.findPhase((p) => p instanceof EggHatchPhase))
this.eggHatchHandler.clear();
super.end();
}
doEggShake(intensity: number, repeatCount?: integer, count?: integer): Promise<void> {

View File

@ -4090,19 +4090,17 @@ export class EggLapsePhase extends Phase {
start() {
super.start();
const eggsToHatch: Egg[] = [];
const eggsToHatch: Egg[] = this.scene.gameData.eggs.filter((egg: Egg) => {
return --egg.hatchWaves < 1
})
for (let egg of this.scene.gameData.eggs) {
if (--egg.hatchWaves < 1)
eggsToHatch.push(egg);
}
if (eggsToHatch.length)
if (eggsToHatch.length) {
this.scene.queueMessage('Oh?');
for (let egg of eggsToHatch)
this.scene.unshiftPhase(new EggHatchPhase(this.scene, egg));
for (let egg of eggsToHatch)
this.scene.unshiftPhase(new EggHatchPhase(this.scene, egg));
}
this.end();
}
}