PhaseQueue: dequeue/remove the first element to get the next phase
Create a new phase and immediately append it to an existing phase the phase queue.
Equivalent to calling create
followed by appendToPhase
.
The phase to search for in phaseQueue
The name of the phase to create
The arguments to pass to the phase constructor
true
if a targetPhase
was found to append to
Tries to add the input phase(s) to index after target phase in the phaseQueue
, else simply calls ()
Phase
the phase(s) to be added
Phase
the type of phase to search for in phaseQueue
Optional
condition: (p: Phase) => booleanCondition the target phase must meet to be appended to
true
if a targetPhase
was found to append to
Clears all phase-related stuff, including all phase queues, the current and standby phases, and a splice index
Clears the phaseQueue
Resets phaseQueuePrependSpliceIndex to -1, implies that calls to unshiftPhase will insert at end of phaseQueuePrepend
Dynamically create the named phase from the provided arguments
The name of the phase to create.
The arguments to pass to the phase constructor.
The requested phase instance
Checks a phase and returns the matching DynamicPhaseType
, or undefined if it does not match one
The phase to check
The corresponding DynamicPhaseType
or undefined
Hides the ability bar if it is currently visible
Prevents end of turn effects from triggering when transitioning to a new biome on a X0 wave
Create a new phase and immediately prepend it to an existing phase in the phase queue.
Equivalent to calling create
followed by prependToPhase
.
The phase to search for in phaseQueue
The name of the phase to create
The arguments to pass to the phase constructor
true
if a targetPhase
was found to prepend to
Tries to add the input phase to index before target phase in the phaseQueue, else simply calls unshiftPhase()
The phase to be added
The phase to search for in phaseQueue
boolean if a targetPhase was found and added
Adds a phase to the conditional queue and ensures it is executed only when the specified condition is met.
This method allows deferring the execution of a phase until certain conditions are met, which is useful for handling situations like abilities and entry hazards that depend on specific game states.
The phase to be added to the conditional queue.
A function that returns a boolean indicating whether the phase should be executed.
Pushes a phase onto its corresponding dynamic queue and marks the activation point in phaseQueue
The ActivatePriorityQueuePhase
will run the top phase in the dynamic queue (not necessarily phase
)
The phase to push
Create a new phase and immediately push it to the phase queue. Equivalent to calling create
followed by pushPhase
.
The name of the phase to create
The arguments to pass to the phase constructor
Adds a MessagePhase, either to PhaseQueuePrepend or nextCommandPhaseQueue
string for MessagePhase
Optional
callbackDelay: null | numberoptional param for MessagePhase constructor
Optional
prompt: null | booleanoptional param for MessagePhase constructor
Optional
promptDelay: null | numberoptional param for MessagePhase constructor
Optional
defer: null | booleanWhether to allow the phase to be deferred
MessagePhase
for more details on the parameters
Used by function unshiftPhase(), sets index to start inserting at current length instead of the end of the array, useful if phaseQueuePrepend gets longer with Phases
Is called by each Phase implementations "end()" by default We dump everything from phaseQueuePrepend to the start of of phaseQueue then removes first Phase and starts it
Unshifts an ActivatePriorityQueuePhase
for phase
, then pushes phase
to its dynamic queue
This is the same as pushDynamicPhase
, except the activation phase is unshifted
phase
is not guaranteed to be the next phase from the queue to run (if the queue is not empty)
The phase to add
Unshifts the top phase from the corresponding dynamic queue onto phaseQueue
DynamicPhaseType
The type of dynamic phase to start
Clear all previously set phases, then add a new TitlePhase
to transition to the title screen.
Whether to add a new LoginPhase
before the TitlePhase
(but reset everything else).
Default false
Will search for a specific phase in phaseQueuePrepend via filter, and remove the first result if a match is found.
filter function
Create a new phase and immediately unshift it to the phase queue. Equivalent to calling create
followed by unshiftPhase
.
The name of the phase to create
The arguments to pass to the phase constructor
PhaseManager is responsible for managing the phases in the battle scene