Compare commits
2 commits
8fd5b87c95
...
39dd2cacc4
| Author | SHA1 | Date | |
|---|---|---|---|
| 39dd2cacc4 | |||
| 7383b7d5e8 |
3 changed files with 33 additions and 17 deletions
|
|
@ -5,16 +5,16 @@
|
||||||
"connecting": "Connexion en cours…",
|
"connecting": "Connexion en cours…",
|
||||||
"game_over": "Partie terminée",
|
"game_over": "Partie terminée",
|
||||||
"waiting_for_opponent": "En attente de l'adversaire…",
|
"waiting_for_opponent": "En attente de l'adversaire…",
|
||||||
"your_turn_roll": "Votre tour — lancez les dés",
|
"your_turn_roll": "À votre tour — lancez les dés",
|
||||||
"hold_or_go": "Tenir ou aller ?",
|
"hold_or_go": "Tenir ou s'en aller ?",
|
||||||
"select_move": "Sélectionner le coup {{ n }} sur 2",
|
"select_move": "Sélectionner le coup {{ n }} sur 2",
|
||||||
"your_turn": "Votre tour",
|
"your_turn": "Votre tour",
|
||||||
"opponent_turn": "Tour de l'adversaire",
|
"opponent_turn": "Tour de l'adversaire",
|
||||||
"room_label": "Salle : {{ id }}",
|
"room_label": "Salle : {{ id }}",
|
||||||
"quit": "Quitter",
|
"quit": "Quitter",
|
||||||
"roll_dice": "Lancer les dés",
|
"roll_dice": "Lancer les dés",
|
||||||
"go": "Aller",
|
"go": "S'en aller",
|
||||||
"empty_move": "Coup vide",
|
"empty_move": "Mouvement impossible",
|
||||||
"you_suffix": " (vous)",
|
"you_suffix": " (vous)",
|
||||||
"points_label": "Points",
|
"points_label": "Points",
|
||||||
"holes_label": "Trous",
|
"holes_label": "Trous",
|
||||||
|
|
@ -26,17 +26,17 @@
|
||||||
"jan_true_hit_big": "Battage à vrai (grand jan)",
|
"jan_true_hit_big": "Battage à vrai (grand jan)",
|
||||||
"jan_true_hit_corner": "Battage coin adverse",
|
"jan_true_hit_corner": "Battage coin adverse",
|
||||||
"jan_first_exit": "Premier sorti",
|
"jan_first_exit": "Premier sorti",
|
||||||
"jan_six_tables": "Six tables",
|
"jan_six_tables": "Jan de six tables",
|
||||||
"jan_two_tables": "Deux tables",
|
"jan_two_tables": "Jan de deux tables",
|
||||||
"jan_mezeas": "Mezeas",
|
"jan_mezeas": "Jan de mézéas",
|
||||||
"jan_false_hit_small": "Battage à faux (petit jan)",
|
"jan_false_hit_small": "Battage à faux (petit jan)",
|
||||||
"jan_false_hit_big": "Battage à faux (grand jan)",
|
"jan_false_hit_big": "Battage à faux (grand jan)",
|
||||||
"jan_contre_two": "Contre deux tables",
|
"jan_contre_two": "Contre jan de deux tables",
|
||||||
"jan_contre_mezeas": "Contre mezeas",
|
"jan_contre_mezeas": "Contre jan de mezeas",
|
||||||
"jan_helpless_man": "Dame impuissante",
|
"jan_helpless_man": "Dame impuissante",
|
||||||
"play_vs_bot": "Jouer contre le bot",
|
"play_vs_bot": "Jouer contre le bot",
|
||||||
"vs_bot_label": "contre le bot",
|
"vs_bot_label": "contre le bot",
|
||||||
"you_win": "Vous gagnez !",
|
"you_win": "Vous avez gagné !",
|
||||||
"opp_wins": "{{ name }} gagne !",
|
"opp_wins": "{{ name }} gagne !",
|
||||||
"play_again": "Rejouer"
|
"play_again": "Rejouer"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,7 @@ fn matched_dice_used(staged: &[(u8, u8)], dice: (u8, u8)) -> (bool, bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Split `dice_jans` into (viewer_jans, opponent_jans).
|
/// Split `dice_jans` into (viewer_jans, opponent_jans).
|
||||||
fn split_jans(
|
fn split_jans(dice_jans: &[JanEntry], viewer_is_active: bool) -> (Vec<JanEntry>, Vec<JanEntry>) {
|
||||||
dice_jans: &[JanEntry],
|
|
||||||
viewer_is_active: bool,
|
|
||||||
) -> (Vec<JanEntry>, Vec<JanEntry>) {
|
|
||||||
let mut mine = Vec::new();
|
let mut mine = Vec::new();
|
||||||
let mut theirs = Vec::new();
|
let mut theirs = Vec::new();
|
||||||
for e in dice_jans {
|
for e in dice_jans {
|
||||||
|
|
@ -46,12 +43,20 @@ fn split_jans(
|
||||||
if e.total >= 0 {
|
if e.total >= 0 {
|
||||||
mine.push(e.clone());
|
mine.push(e.clone());
|
||||||
} else {
|
} 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 {
|
} else if e.total >= 0 {
|
||||||
theirs.push(e.clone());
|
theirs.push(e.clone());
|
||||||
} else {
|
} 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)
|
(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;
|
let show_hold_go = is_my_turn && vs.turn_stage == SerTurnStage::HoldOrGoChoice;
|
||||||
|
|
||||||
// ── Jan split: viewer_jans / opponent_jans ─────────────────────────────────
|
// ── 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 ─────────────────────────────────────────────────────────────────
|
// ── Scores ─────────────────────────────────────────────────────────────────
|
||||||
let my_score = vs.scores[player_id as usize].clone();
|
let my_score = vs.scores[player_id as usize].clone();
|
||||||
|
|
|
||||||
|
|
@ -591,6 +591,17 @@ mod tests {
|
||||||
let jans = get_jans_by_ordered_dice(&rules.board, &[3, 3], None, false);
|
let jans = get_jans_by_ordered_dice(&rules.board, &[3, 3], None, false);
|
||||||
assert_eq!(1, jans.len());
|
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
|
// premier dé bloqué, mais tout d'une possible en commençant par le second
|
||||||
rules.board.set_positions(
|
rules.board.set_positions(
|
||||||
&Color::White,
|
&Color::White,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue