pub struct PhaseHandler {
pub n_upkeeps_this_turn: i32,
pub n_upkeeps_this_game: i32,
pub n_combats_this_turn: i32,
pub n_mains_this_turn: i32,
pub n_end_of_turns_this_turn: i32,
pub planar_dice_special_action_this_turn: i32,
pub skip_damage_steps: bool,
pub repeat_cleanup: bool,
pub give_priority_to_player: bool,
/* private fields */
}Expand description
Tracks phase-specific state for a game.
Mirrors Java’s PhaseHandler fields.
Fields§
§n_upkeeps_this_turn: i32§n_upkeeps_this_game: i32§n_combats_this_turn: i32§n_mains_this_turn: i32§n_end_of_turns_this_turn: i32§planar_dice_special_action_this_turn: i32§skip_damage_steps: bool§repeat_cleanup: bool§give_priority_to_player: boolImplementations§
Source§impl PhaseHandler
impl PhaseHandler
pub fn new() -> Self
pub fn get_phase(&self) -> Option<PhaseType>
pub fn set_phase(&mut self, phase: PhaseType)
pub fn get_turn(&self) -> i32
pub fn is_player_turn(&self, player: PlayerId) -> bool
pub fn get_player_turn(&self) -> Option<PlayerId>
pub fn set_player_turn(&mut self, player: PlayerId)
pub fn get_previous_player_turn(&self) -> Option<PlayerId>
pub fn get_priority_player(&self) -> Option<PlayerId>
pub fn set_priority(&mut self, player: PlayerId)
pub fn reset_priority(&mut self)
pub fn is_first_combat(&self) -> bool
pub fn get_num_combat(&self) -> i32
pub fn get_num_upkeep(&self) -> i32
pub fn is_first_upkeep(&self) -> bool
pub fn is_first_upkeep_this_game(&self) -> bool
pub fn get_num_main(&self) -> i32
pub fn before_first_post_combat_main_end(&self) -> bool
pub fn skipped_declare_blockers(&self) -> bool
pub fn get_num_end_of_turn(&self) -> i32
pub fn is(&self, phase: PhaseType) -> bool
pub fn is_phase_player(&self, phase: PhaseType, player: PlayerId) -> bool
Sourcepub fn add_extra_turn(
&mut self,
player: PlayerId,
player_order: &[PlayerId],
) -> &ExtraTurn
pub fn add_extra_turn( &mut self, player: PlayerId, player_order: &[PlayerId], ) -> &ExtraTurn
Add an extra turn for the given player.
Mirrors Java’s PhaseHandler.addExtraTurn().
Sourcepub fn add_extra_phase(
&mut self,
after_phase: PhaseType,
extra_phase_list: &[PhaseType],
next_phase: PhaseType,
)
pub fn add_extra_phase( &mut self, after_phase: PhaseType, extra_phase_list: &[PhaseType], next_phase: PhaseType, )
Add extra phase(s) after the given phase.
Mirrors Java’s PhaseHandler.addExtraPhase().
pub fn get_next_turn(&self, player_order: &[PlayerId]) -> Option<PlayerId>
Sourcepub fn restart(&mut self)
pub fn restart(&mut self)
Reset the phase handler for a game restart (e.g. Karn Liberated).
Mirrors Java’s PhaseHandler.restart().
Sourcepub fn on_stack_resolved(&mut self)
pub fn on_stack_resolved(&mut self)
Called when the stack resolves — re-enable priority.
Mirrors Java’s PhaseHandler.onStackResolved().
pub fn get_planar_dice_special_action_this_turn(&self) -> i32
pub fn inc_planar_dice_special_action_this_turn(&mut self)
Sourcepub fn get_extra_turn_for_player(&self, player: PlayerId) -> i32
pub fn get_extra_turn_for_player(&self, player: PlayerId) -> i32
Get the continuous extra turn count for a player.
Mirrors Java’s PhaseHandler.getExtraTurnForPlayer().
Sourcepub fn handle_next_turn(&mut self, player_order: &[PlayerId]) -> PlayerId
pub fn handle_next_turn(&mut self, player_order: &[PlayerId]) -> PlayerId
Advance to the next turn. Returns the player who gets the next turn.
Mirrors Java’s PhaseHandler.handleNextTurn().
pub fn end_combat_phase_by_effect(&mut self)
pub fn end_turn_by_effect(&mut self)
pub fn debug_print_state(&self, has_priority: bool) -> String
Sourcepub fn in_combat(&self) -> bool
pub fn in_combat(&self) -> bool
Returns true if a combat is currently in progress.
Mirrors Java’s PhaseHandler.inCombat().
Sourcepub fn end_combat(&mut self)
pub fn end_combat(&mut self)
End the current combat.
Mirrors Java’s PhaseHandler.endCombat().
Sourcepub fn setup_first_turn(&mut self, goes_first: PlayerId)
pub fn setup_first_turn(&mut self, goes_first: PlayerId)
Set up the first turn of the game for the given player.
Mirrors Java’s PhaseHandler.setupFirstTurn().
Sourcepub fn start_first_turn(&mut self, goes_first: PlayerId)
pub fn start_first_turn(&mut self, goes_first: PlayerId)
Start the first turn and enter the main game loop.
Mirrors Java’s PhaseHandler.startFirstTurn().
In Rust, the actual loop is driven by GameLoop::run_turn_state_machine().
Sourcepub fn dev_advance_to_phase(&mut self, target_phase: PhaseType) -> bool
pub fn dev_advance_to_phase(&mut self, target_phase: PhaseType) -> bool
Dev mode: advance to a target phase, running phase transitions.
Mirrors Java’s PhaseHandler.devAdvanceToPhase().
Trait Implementations§
Source§impl Clone for PhaseHandler
impl Clone for PhaseHandler
Source§fn clone(&self) -> PhaseHandler
fn clone(&self) -> PhaseHandler
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more