feat: relevé

This commit is contained in:
Henri Bourcereau 2024-09-27 15:31:14 +02:00
parent 5741a6894b
commit fb3e2678fc

View file

@ -301,8 +301,8 @@ impl GameState {
return false; return false;
} }
// Check the turn stage // Check the turn stage
if self.turn_stage != TurnStage::HoldOrGoChoice if self.turn_stage != TurnStage::Move
|| self.turn_stage != TurnStage::Move && self.turn_stage != TurnStage::HoldOrGoChoice
{ {
return false; return false;
} }
@ -453,15 +453,20 @@ impl GameState {
/// Set a new pick up ('relevé') after a player won a hole and choose to 'go', /// Set a new pick up ('relevé') after a player won a hole and choose to 'go',
/// or after a player has bore off (took of his men off the board) /// or after a player has bore off (took of his men off the board)
fn new_pick_up(&mut self) { fn new_pick_up(&mut self) {
// réinitialisation dice_roll_count self.players.iter_mut().for_each(|(_id, p)| {
self.players.iter_mut().map(|(id, p)| p.dice_roll_count = 0); // reset points
// joueur actif = joueur ayant sorti ses dames (donc deux jeux successifs) p.points = 0;
// reset dice_roll_count
p.dice_roll_count = 0;
// reset bredouille
p.can_bredouille = true;
// switch colors
p.color = p.color.opponent_color();
});
// joueur actif = joueur ayant sorti ses dames ou est parti (donc deux jeux successifs)
self.turn_stage = TurnStage::RollDice; self.turn_stage = TurnStage::RollDice;
// reset board
// TODO: self.board = Board::new();
// - échanger les couleurs
// - remettre les dames des deux joueurs aux talons
// - jeton bredouille replaçé sur joueur actif (?)
} }
fn get_rollresult_points(&self, dice: &Dice) -> (u8, u8) { fn get_rollresult_points(&self, dice: &Dice) -> (u8, u8) {