mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-30 05:22:44 +02:00
Fixed bugs (hopefully)
This commit is contained in:
parent
3ed587de6d
commit
59152d0c6c
@ -72,13 +72,12 @@ export default class PhaseInterceptor {
|
|||||||
* Method to transition to a target phase.
|
* Method to transition to a target phase.
|
||||||
* @param targetPhase - The name of the phase to transition to.
|
* @param targetPhase - The name of the phase to transition to.
|
||||||
* @param runTarget - Whether or not to run the target phase; default `true`.
|
* @param runTarget - Whether or not to run the target phase; default `true`.
|
||||||
* @returns A promise that resolves when the transition is complete.
|
* @returns A Promise that resolves when the target phase is reached.
|
||||||
*/
|
*/
|
||||||
// TODO: Does this need to be asynchronous?
|
|
||||||
public async to(targetPhase: PhaseString, runTarget = true): Promise<void> {
|
public async to(targetPhase: PhaseString, runTarget = true): Promise<void> {
|
||||||
let currentPhase = this.scene.phaseManager.getCurrentPhase();
|
const pm = this.scene.phaseManager;
|
||||||
|
let currentPhase = pm.getCurrentPhase();
|
||||||
while (!currentPhase?.is(targetPhase)) {
|
while (!currentPhase?.is(targetPhase)) {
|
||||||
currentPhase = this.scene.phaseManager.getCurrentPhase();
|
|
||||||
if (!currentPhase) {
|
if (!currentPhase) {
|
||||||
console.log("Reached end of phases without hitting target; resolving.");
|
console.log("Reached end of phases without hitting target; resolving.");
|
||||||
return;
|
return;
|
||||||
@ -86,6 +85,7 @@ export default class PhaseInterceptor {
|
|||||||
|
|
||||||
// Current phase is different; run and wait for it to finish
|
// Current phase is different; run and wait for it to finish
|
||||||
await this.run(currentPhase);
|
await this.run(currentPhase);
|
||||||
|
currentPhase = pm.getCurrentPhase();
|
||||||
}
|
}
|
||||||
|
|
||||||
// We hit the target; run as applicable and wrap up.
|
// We hit the target; run as applicable and wrap up.
|
||||||
@ -94,7 +94,6 @@ export default class PhaseInterceptor {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`PhaseInterceptor.to: Running target ${targetPhase}`);
|
|
||||||
await this.run(currentPhase);
|
await this.run(currentPhase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ abstract class mockPhase extends Phase {
|
|||||||
public override readonly phaseName: any;
|
public override readonly phaseName: any;
|
||||||
|
|
||||||
override start() {
|
override start() {
|
||||||
console.log(this.phaseName);
|
|
||||||
this.end();
|
this.end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user