mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-16 14:55:22 +01:00
* Removed deprecated functions from phase interceptor * Added minor docs to the phase manager + renamed `shift` to `shiftPhase` * Added `selectStarterPhase` to the end by set mode collection * Fixed issues and syntax errors * somehow fixed reload bug by making things actively worse * Perhaps fixed things? * maybe fixed? * Fixed tests * fixed another dumb error bc me big dumb bozo * dddddd * Update phase-interceptor.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Re-add `!` and add `TODO` comment instead --------- Co-authored-by: Wlowscha <54003515+Wlowscha@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { globalScene } from "#app/global-scene";
|
|
import type { PhaseMap, PhaseString } from "#types/phase-types";
|
|
|
|
export abstract class Phase {
|
|
/** Start the current phase. */
|
|
start() {}
|
|
|
|
/** End the current phase and start a new one. */
|
|
end() {
|
|
globalScene.phaseManager.shiftPhase();
|
|
}
|
|
|
|
/**
|
|
* The string name of the phase, used to identify the phase type for {@linkcode is}
|
|
*
|
|
* @privateRemarks
|
|
*
|
|
* When implementing a phase, you must set the `phaseName` property to the name of the phase.
|
|
*/
|
|
public abstract readonly phaseName: PhaseString;
|
|
|
|
/**
|
|
* Check if the phase is of the given type without requiring `instanceof`.
|
|
*
|
|
* @param phase - The string name of the phase to check.
|
|
* @returns Whether this phase is of the provided type.
|
|
*
|
|
* @remarks
|
|
* This does not check for subclasses! It only checks if the phase is *exactly* the given type.
|
|
* This method exists to avoid circular import issues, as using `instanceof` would require importing each phase.
|
|
*/
|
|
is<K extends keyof PhaseMap>(phase: K): this is PhaseMap[K] {
|
|
return this.phaseName === phase;
|
|
}
|
|
}
|