Compare commits

..

2 commits

3 changed files with 33 additions and 17 deletions

View file

@ -5,16 +5,16 @@
"connecting": "Connexion en cours…",
"game_over": "Partie terminée",
"waiting_for_opponent": "En attente de l'adversaire…",
"your_turn_roll": "Votre tour — lancez les dés",
"hold_or_go": "Tenir ou aller ?",
"your_turn_roll": "À votre tour — lancez les dés",
"hold_or_go": "Tenir ou s'en aller ?",
"select_move": "Sélectionner le coup {{ n }} sur 2",
"your_turn": "Votre tour",
"opponent_turn": "Tour de l'adversaire",
"room_label": "Salle : {{ id }}",
"quit": "Quitter",
"roll_dice": "Lancer les dés",
"go": "Aller",
"empty_move": "Coup vide",
"go": "S'en aller",
"empty_move": "Mouvement impossible",
"you_suffix": " (vous)",
"points_label": "Points",
"holes_label": "Trous",
@ -26,17 +26,17 @@
"jan_true_hit_big": "Battage à vrai (grand jan)",
"jan_true_hit_corner": "Battage coin adverse",
"jan_first_exit": "Premier sorti",
"jan_six_tables": "Six tables",
"jan_two_tables": "Deux tables",
"jan_mezeas": "Mezeas",
"jan_six_tables": "Jan de six tables",
"jan_two_tables": "Jan de deux tables",
"jan_mezeas": "Jan de mézéas",
"jan_false_hit_small": "Battage à faux (petit jan)",
"jan_false_hit_big": "Battage à faux (grand jan)",
"jan_contre_two": "Contre deux tables",
"jan_contre_mezeas": "Contre mezeas",
"jan_contre_two": "Contre jan de deux tables",
"jan_contre_mezeas": "Contre jan de mezeas",
"jan_helpless_man": "Dame impuissante",
"play_vs_bot": "Jouer contre le bot",
"vs_bot_label": "contre le bot",
"you_win": "Vous gagnez !",
"you_win": "Vous avez gagné !",
"opp_wins": "{{ name }} gagne !",
"play_again": "Rejouer"
}

View file

@ -35,10 +35,7 @@ fn matched_dice_used(staged: &[(u8, u8)], dice: (u8, u8)) -> (bool, bool) {
}
/// Split `dice_jans` into (viewer_jans, opponent_jans).
fn split_jans(
dice_jans: &[JanEntry],
viewer_is_active: bool,
) -> (Vec<JanEntry>, Vec<JanEntry>) {
fn split_jans(dice_jans: &[JanEntry], viewer_is_active: bool) -> (Vec<JanEntry>, Vec<JanEntry>) {
let mut mine = Vec::new();
let mut theirs = Vec::new();
for e in dice_jans {
@ -46,12 +43,20 @@ fn split_jans(
if e.total >= 0 {
mine.push(e.clone());
} else {
theirs.push(JanEntry { total: -e.total, points_per: -e.points_per, ..e.clone() });
theirs.push(JanEntry {
total: -e.total,
points_per: -e.points_per,
..e.clone()
});
}
} else if e.total >= 0 {
theirs.push(e.clone());
} else {
mine.push(JanEntry { total: -e.total, points_per: -e.points_per, ..e.clone() });
mine.push(JanEntry {
total: -e.total,
points_per: -e.points_per,
..e.clone()
});
}
}
(mine, theirs)
@ -107,7 +112,7 @@ pub fn GameScreen(state: GameUiState) -> impl IntoView {
let show_hold_go = is_my_turn && vs.turn_stage == SerTurnStage::HoldOrGoChoice;
// ── Jan split: viewer_jans / opponent_jans ─────────────────────────────────
let (my_jans, opp_jans) = split_jans(&vs.dice_jans, is_my_turn);
let (my_jans, opp_jans) = split_jans(&vs.dice_jans, is_my_turn && !show_roll);
// ── Scores ─────────────────────────────────────────────────────────────────
let my_score = vs.scores[player_id as usize].clone();

View file

@ -591,6 +591,17 @@ mod tests {
let jans = get_jans_by_ordered_dice(&rules.board, &[3, 3], None, false);
assert_eq!(1, jans.len());
// case intermédiaire dans son coin de repos vide : peut tout de même battre à vrai
rules.board.set_positions(
&Color::White,
[
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, -2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
],
);
let jans = get_jans_by_ordered_dice(&rules.board, &[1, 4], None, false);
assert_eq!(1, jans.len());
assert_eq!(1, jans.get(&Jan::TrueHitBigJan).unwrap().len());
// premier dé bloqué, mais tout d'une possible en commençant par le second
rules.board.set_positions(
&Color::White,