diff --git a/lucky7-app/frontend/src/app/components/GameScreen.tsx b/lucky7-app/frontend/src/app/components/GameScreen.tsx index e65c9b6..8a62d15 100644 --- a/lucky7-app/frontend/src/app/components/GameScreen.tsx +++ b/lucky7-app/frontend/src/app/components/GameScreen.tsx @@ -106,6 +106,7 @@ export interface RulesConfig { double: boolean; relance: boolean; marchandSable: boolean; + legende: boolean; } // ---- Rules Dialog ---- @@ -165,6 +166,11 @@ function RulesDialog({ rules, onClose }: { rules: RulesConfig; onClose: () => vo active={rules.marchandSable} desc="Score de 3 → immunité ce tour" /> + @@ -243,6 +249,9 @@ export default function GameScreen({ players: initialPlayers, rules, onEnd }: Ga const [result, setResult] = useState(null); const [luckyProlongations, setLuckyProlongations] = useState(0); const [looserProlongations, setLooserProlongations] = useState(0); + // Cumulative sip bonus from prolongations (sum of participants−1 per round) + const [luckyProlongBonus, setLuckyProlongBonus] = useState(0); + const [looserProlongBonus, setLooserProlongBonus] = useState(0); // Prolongation state const [prolongation, setProlongation] = useState(null); @@ -462,7 +471,7 @@ export default function GameScreen({ players: initialPlayers, rules, onEnd }: Ga ? ` (+${luckyProlongations} prolongation${luckyProlongations > 1 ? 's' : ''})` : ''; msgs.push( - `🏆 ${luckyPlayers[0].name} distribue ${drinks} gorgée${drinks > 1 ? 's' : ''}${ls.score === ann ? ' — score exact !' : ''}${extra}` + `🏆 ${luckyPlayers[0].name} distribue ${drinks} ${drinks > 1 ? 's' : ''}${ls.score === ann ? ' — score exact !' : ''}${extra}` ); } @@ -473,9 +482,7 @@ export default function GameScreen({ players: initialPlayers, rules, onEnd }: Ga looserProlongations > 0 ? ` (+${looserProlongations} prolongation${looserProlongations > 1 ? 's' : ''})` : ''; - msgs.push( - `💀 ${looserPlayers[0].name} boit ${drinks} gorgée${drinks > 1 ? 's' : ''}${extra}` - ); + msgs.push(`💀 ${looserPlayers[0].name} boit ${drinks} ${drinks > 1 ? 's' : ''}${extra}`); } // Double — optionnel, suspendu pendant les prolongations (déjà géré : on affiche à la fin) @@ -485,12 +492,10 @@ export default function GameScreen({ players: initialPlayers, rules, onEnd }: Ga .forEach(s => { const diceVal = s.dice1; if (diceVal === 1) { - msgs.push( - `🎲 ${s.player.name} — Double 1 : distribue 1 gorgée ou fait relancer un joueur` - ); + msgs.push(`🎲 ${s.player.name} — Double 1 : distribue 1 ou fait relancer un joueur`); } else { msgs.push( - `🎲 ${s.player.name} — Double ${diceVal} : distribue ${diceVal} gorgée${diceVal > 1 ? 's' : ''}` + `🎲 ${s.player.name} — Double ${diceVal} : distribue ${diceVal} ${diceVal > 1 ? 's' : ''}` ); } }); @@ -505,6 +510,22 @@ export default function GameScreen({ players: initialPlayers, rules, onEnd }: Ga }); } + // Légende — optionnel + if (rules.legende) { + const legendeTriggered = playerScores.some(s => s.score === 11); + if (legendeTriggered) { + const affected = playerScores.filter( + s => s.dice1 === 5 || s.dice1 === 6 || s.dice2 === 5 || s.dice2 === 6 + ); + if (affected.length > 0) { + const names = affected.map(s => s.player.name).join(', '); + msgs.push( + `⭐ Légende ! ${names} boi${affected.length > 1 ? 'vent' : 't'} 1 (dé à 5 ou 6)` + ); + } + } + } + return msgs; } @@ -720,12 +741,12 @@ export default function GameScreen({ players: initialPlayers, rules, onEnd }: Ga )} {roll && !showAnim && roll.score === 3 && rules.marchandSable && ( - Marchand + Marchand de sable )} {relancedPlayerIds.has(player.id) && ( - Relancé + Relance )} @@ -810,7 +831,8 @@ export default function GameScreen({ players: initialPlayers, rules, onEnd }: Ga const completedProlongations = prolongation.type === 'lucky' ? luckyProlongations : looserProlongations; const prolNumber = completedProlongations + 1; - const drinkStake = 1 + prolNumber; + const accumulatedBonus = prolongation.type === 'lucky' ? luckyProlongBonus : looserProlongBonus; + const drinkStake = 1 + accumulatedBonus + (prolongation.players.length - 1); const isLuckyType = prolongation.type === 'lucky'; return ( @@ -837,7 +859,7 @@ export default function GameScreen({ players: initialPlayers, rules, onEnd }: Ga

Enjeu :{' '} - {drinkStake} gorgée{drinkStake > 1 ? 's' : ''} + {drinkStake} {drinkStake > 1 ? 's' : ''} {' · '}Annonce : {announcement}

diff --git a/lucky7-app/frontend/src/app/components/RulesPage.tsx b/lucky7-app/frontend/src/app/components/RulesPage.tsx index edb91ce..8c7f0a0 100644 --- a/lucky7-app/frontend/src/app/components/RulesPage.tsx +++ b/lucky7-app/frontend/src/app/components/RulesPage.tsx @@ -83,12 +83,12 @@ export default function RulesPage({ onBack }: RulesPageProps) { diff --git a/lucky7-app/frontend/src/app/components/SingleDeviceLobby.tsx b/lucky7-app/frontend/src/app/components/SingleDeviceLobby.tsx index 870737c..f19799d 100644 --- a/lucky7-app/frontend/src/app/components/SingleDeviceLobby.tsx +++ b/lucky7-app/frontend/src/app/components/SingleDeviceLobby.tsx @@ -33,20 +33,24 @@ const TOGGLEABLE_RULES: ToggleableRule[] = [ }, { key: 'relance', - label: 'Relance (Double 1)', + label: 'Relance', desc: 'Score 1•1 → le joueur peut relancer ses dés une fois', }, { key: 'marchandSable', label: 'Marchand de sable', - desc: 'Score de 3 (1+2) → immunité contre les gorgées ce tour', + desc: 'Score de 3 (1•2) → immunité contre les gorgées ce tour', + }, + { + key: 'legende', + label: 'Légende', + desc: 'Score de 11 (5•6) → tous les joueurs avec un dé à 5 ou 6 boivent 1 gorgée', }, ]; const DISABLED_RULES: DisabledRule[] = [ { label: 'Jeton', desc: 'Score de 7 → boit 1 gorgée' }, { label: 'Jackpot', desc: 'Trois joueurs à 7 → relance pour distribuer un pot' }, - { label: 'Légende', desc: 'Score de 11 (5+6) → joueurs avec dé à 5 ou 6 boivent' }, { label: 'Démon', desc: 'Trois joueurs à 6 → relance pour distribuer un pot' }, ]; @@ -59,6 +63,7 @@ const DEFAULT_RULES: RulesConfig = { double: true, relance: false, marchandSable: true, + legende: false, }; // ---- Rules Config Dialog ---- @@ -95,55 +100,72 @@ function RulesConfigDialog({
{/* Règles activables */} -
+

Règles optionnelles

{TOGGLEABLE_RULES.map(rule => ( -