pub struct Phase { /* private fields */ }Expand description
Phase instance — stores commands that execute at phase boundaries.
Mirrors Java’s Phase class. Each Phase in Java holds lists of
GameCommand callbacks for “at
Implementations§
Source§impl Phase
impl Phase
pub fn new(phase_type: PhaseType) -> Self
Sourcepub fn clear_commands(&mut self)
pub fn clear_commands(&mut self)
Clear all commands from this phase.
Mirrors Java’s Phase.clearCommands().
Sourcepub fn add_at(&mut self, cmd: PhaseCommand)
pub fn add_at(&mut self, cmd: PhaseCommand)
Add a command to execute “at” this phase.
Mirrors Java’s Phase.addAt().
Sourcepub fn execute_at(&mut self) -> Vec<PhaseCommand>
pub fn execute_at(&mut self) -> Vec<PhaseCommand>
Execute all “at” commands, draining the list.
Mirrors Java’s Phase.executeAt().
Sourcepub fn add_until(&mut self, player: Option<PlayerId>, cmd: PhaseCommand)
pub fn add_until(&mut self, player: Option<PlayerId>, cmd: PhaseCommand)
Add a command to execute “until” this phase (global or per-player).
When called without a player, adds to the global until list.
When called with a player, adds to the per-player until map.
Mirrors Java’s Phase.addUntil() (both overloads).
Sourcepub fn execute_until(&mut self, player: Option<PlayerId>) -> Vec<PhaseCommand>
pub fn execute_until(&mut self, player: Option<PlayerId>) -> Vec<PhaseCommand>
Execute “until” commands, draining the list.
When called without a player, executes global until commands.
When called with a player, executes per-player until commands.
Mirrors Java’s Phase.executeUntil() (both overloads).
Sourcepub fn register_until_end(&mut self, player: PlayerId, cmd: PhaseCommand)
pub fn register_until_end(&mut self, player: PlayerId, cmd: PhaseCommand)
Register a command for end-of-phase execution for a player.
Mirrors Java’s Phase.registerUntilEnd().
Sourcepub fn add_until_end(&mut self, player: PlayerId, cmd: PhaseCommand)
pub fn add_until_end(&mut self, player: PlayerId, cmd: PhaseCommand)
Add a command to the end-of-phase map for a player.
Mirrors Java’s Phase.addUntilEnd().
Sourcepub fn register_until_end_command(&mut self, player: PlayerId)
pub fn register_until_end_command(&mut self, player: PlayerId)
Move registered commands to the until-end map.
Mirrors Java’s Phase.registerUntilEndCommand().
Sourcepub fn execute_until_end_of_phase(
&mut self,
player: PlayerId,
) -> Vec<PhaseCommand>
pub fn execute_until_end_of_phase( &mut self, player: PlayerId, ) -> Vec<PhaseCommand>
Execute end-of-phase commands for a player.
Mirrors Java’s Phase.executeUntilEndOfPhase().