diff --git a/client/src/components/GameBoard.tsx b/client/src/components/GameBoard.tsx index 1de4642..e7b9f56 100644 --- a/client/src/components/GameBoard.tsx +++ b/client/src/components/GameBoard.tsx @@ -26,7 +26,7 @@ export default function GameBoard({ gameState, currentPlayerId, actions }: GameB }, [gameState.phase, actions]); const currentPlayer = gameState.players.find(p => p.id === currentPlayerId); - const isLeader = currentPlayer?.isLeader; + const isLeader = gameState.currentLeaderId === currentPlayerId; // FIX: Usar currentLeaderId del estado const config = GAME_CONFIG[gameState.players.length as keyof typeof GAME_CONFIG]; const currentQuestSize = config?.quests[gameState.currentRound - 1]; @@ -370,24 +370,56 @@ export default function GameBoard({ gameState, currentPlayerId, actions }: GameB initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -20 }} - className="bg-paper-bg text-black p-6 rounded shadow-2xl rotate-1 max-w-md w-full text-center" + className="flex flex-col items-center gap-6 w-full max-w-4xl" > -

- {isLeader ? 'TU TURNO: ELIGE EQUIPO' : `ESPERANDO AL LÍDER...`} -

-

- Se necesitan {currentQuestSize} agentes para esta misión. -

+ {/* Información del líder */} +
+
+ Leader +
+
Líder Actual
+
+ {gameState.players.find(p => p.id === gameState.currentLeaderId)?.name || 'Desconocido'} +
+
+ Leader +
+
- {isLeader && ( - - )} + {/* Mensaje para el líder o para los demás */} +
+

+ {isLeader ? '🎯 TU TURNO: ELIGE TU EQUIPO' : '⏳ ESPERANDO AL LÍDER...'} +

+

+ Se necesitan {currentQuestSize} agentes para la misión #{gameState.currentRound}. +

+ + {/* Contador de seleccionados */} + {isLeader && ( +
+ Seleccionados: + {selectedTeam.length} / {currentQuestSize} + +
+ )} + + {isLeader && ( + + )} + + {!isLeader && ( +
+ El líder está seleccionando el equipo de misión... +
+ )} +
)} @@ -437,44 +469,103 @@ export default function GameBoard({ gameState, currentPlayerId, actions }: GameB )} {/* FASE: MISIÓN */} - {gameState.phase === GamePhase.MISSION && ( - - {gameState.proposedTeam.includes(currentPlayerId) ? ( -
-

¡ESTÁS EN LA MISIÓN!

-
- + {gameState.phase === GamePhase.MISSION && (() => { + // Generar orden aleatorio de cartas (solo una vez por jugador) + const [cardOrder] = useState(() => Math.random() > 0.5); + const successFirst = cardOrder; - {/* Solo los malos pueden sabotear */} - {currentPlayer?.faction === 'spies' && ( - - )} + return ( + + {gameState.proposedTeam.includes(currentPlayerId) ? ( +
+

+ 🎯 ¡ESTÁS EN LA MISIÓN! +

+

+ Elige el resultado de tu participación +

+ + {/* Cartas en orden aleatorio */} +
+ {successFirst ? ( + <> + {/* Carta de Éxito primero */} + + + {/* Carta de Sabotaje segundo (solo para espías) */} + {currentPlayer?.faction === 'spies' && ( + + )} + + ) : ( + <> + {/* Carta de Sabotaje primero (solo para espías) */} + {currentPlayer?.faction === 'spies' && ( + + )} + + {/* Carta de Éxito segundo */} + + + )} +
-
- ) : ( -
- La misión está en curso...
- Rezando por el éxito. -
- )} - - )} + ) : ( +
+
+ La misión está en curso...
+ Esperando a que el equipo complete su votación. +
+ )} + + ); + })()} {/* FASE: REVELACIÓN DE CARTAS */} {gameState.phase === 'mission_reveal' as any && ( isHost && actions.finishMissionReveal()} /> )}