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() { end() {
this.eggHatchHandler.clear() if (this.scene.findPhase((p) => p instanceof EggHatchPhase))
super.end() this.eggHatchHandler.clear();
super.end();
} }
doEggShake(intensity: number, repeatCount?: integer, count?: integer): Promise<void> { doEggShake(intensity: number, repeatCount?: integer, count?: integer): Promise<void> {

View File

@ -4090,19 +4090,17 @@ export class EggLapsePhase extends Phase {
start() { start() {
super.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 (eggsToHatch.length) {
if (--egg.hatchWaves < 1)
eggsToHatch.push(egg);
}
if (eggsToHatch.length)
this.scene.queueMessage('Oh?'); this.scene.queueMessage('Oh?');
for (let egg of eggsToHatch) for (let egg of eggsToHatch)
this.scene.unshiftPhase(new EggHatchPhase(this.scene, egg)); this.scene.unshiftPhase(new EggHatchPhase(this.scene, egg));
}
this.end(); this.end();
} }
} }