wip: relevé

This commit is contained in:
Henri Bourcereau 2024-09-26 17:41:03 +02:00
parent fc58768006
commit 18bd87e68f
2 changed files with 58 additions and 2 deletions

View file

@ -105,6 +105,7 @@ impl App {
"history" => self.show_history(),
"quit" => self.quit(),
"roll" => self.roll_dice(),
"go" => self.go(),
_ => self.add_move(input),
}
println!("{}", self.display());
@ -152,6 +153,20 @@ impl App {
});
}
fn go(&mut self) {
if self.game.player_id.is_none() {
println!("player_id not set ");
return;
}
if self.game.state.turn_stage != TurnStage::HoldOrGoChoice {
println!("Not in position to go");
return;
}
self.game.handle_event(&GameEvent::Go {
player_id: self.game.player_id.unwrap(),
});
}
fn add_move(&mut self, input: &str) {
if self.game.player_id.is_none() {
println!("player_id not set ");