Estado actual con errores de sintaxis en GameBoard.tsx
This commit is contained in:
127
shared/types.ts
Normal file
127
shared/types.ts
Normal file
@@ -0,0 +1,127 @@
|
||||
export enum Role {
|
||||
// Bando del Bien (Resistencia Francesa)
|
||||
MERLIN = 'merlin', // Marlenne
|
||||
PERCIVAL = 'percival',
|
||||
LOYAL_SERVANT = 'loyal_servant', // Soldado Resistencia
|
||||
|
||||
// Bando del Mal (Ocupación Alemana)
|
||||
MORDRED = 'mordred',
|
||||
ASSASSIN = 'assassin',
|
||||
MORGANA = 'morgana',
|
||||
OBERON = 'oberon',
|
||||
MINION = 'minion', // Soldado Alemán
|
||||
}
|
||||
|
||||
export enum Faction {
|
||||
RESISTANCE = 'resistance',
|
||||
SPIES = 'spies',
|
||||
}
|
||||
|
||||
export enum GamePhase {
|
||||
LOBBY = 'lobby',
|
||||
INTRO = 'intro',
|
||||
REVEAL_ROLE = 'reveal_role',
|
||||
ROLL_CALL = 'roll_call',
|
||||
VOTE_LEADER = 'vote_leader', // Votar si se acepta al líder
|
||||
TEAM_BUILDING = 'team_building', // Líder propone equipo
|
||||
VOTING_TEAM = 'voting_team', // Todos votan si aprueban el equipo
|
||||
MISSION = 'mission', // Los elegidos votan éxito/fracaso
|
||||
MISSION_REVEAL = 'mission_reveal', // Mostrar cartas una a una
|
||||
MISSION_RESULT = 'mission_result', // Pantalla de resumen
|
||||
ASSASSIN_PHASE = 'assassin_phase', // Si gana el bien, el asesino intenta matar a Merlín
|
||||
GAME_OVER = 'game_over',
|
||||
}
|
||||
|
||||
export interface Player {
|
||||
id: string;
|
||||
name: string;
|
||||
avatar: string; // Avatar persistente
|
||||
role?: Role;
|
||||
faction?: Faction;
|
||||
isLeader: boolean;
|
||||
}
|
||||
|
||||
export interface MissionResult {
|
||||
successes: number;
|
||||
fails: number;
|
||||
isSuccess: boolean;
|
||||
}
|
||||
|
||||
// Registro de una misión completada
|
||||
export interface MissionRecord {
|
||||
round: number;
|
||||
team: string[]; // IDs de los participantes
|
||||
votes: boolean[]; // Votos (barajados)
|
||||
successes: number;
|
||||
fails: number;
|
||||
isSuccess: boolean;
|
||||
leaderId: string;
|
||||
}
|
||||
|
||||
export interface GameState {
|
||||
roomId: string;
|
||||
phase: GamePhase;
|
||||
players: Player[];
|
||||
hostId: string;
|
||||
|
||||
currentRound: number;
|
||||
failedVotesCount: number;
|
||||
questResults: (boolean | null)[];
|
||||
|
||||
currentLeaderId: string;
|
||||
|
||||
// Votación de Líder
|
||||
leaderVotes: Record<string, boolean | null>;
|
||||
|
||||
// Selección de Equipo (Misión)
|
||||
proposedTeam: string[];
|
||||
teamVotes: Record<string, boolean>; // Votos de aprobación del equipo (idJugador -> aprueba/rechaza)
|
||||
missionVotes: boolean[]; // Votos anónimos de la misión (éxito/fracaso)
|
||||
|
||||
// Histórico de misiones
|
||||
missionHistory: MissionRecord[];
|
||||
|
||||
// Para la animación de revelación de cartas
|
||||
revealedVotes: boolean[]; // Votos que se van mostrando uno a uno
|
||||
|
||||
winner?: Faction;
|
||||
history: string[]; // Log de acciones para mostrar en pantalla
|
||||
}
|
||||
|
||||
// Configuración de jugadores por partida (según tus reglas)
|
||||
export const GAME_CONFIG = {
|
||||
5: { good: 3, evil: 2, quests: [2, 3, 2, 3, 3] },
|
||||
6: { good: 4, evil: 2, quests: [2, 3, 4, 3, 4] },
|
||||
7: { good: 4, evil: 3, quests: [2, 3, 3, 4, 4] }, // Nota: 4ta misión requiere 2 fallos
|
||||
8: { good: 5, evil: 3, quests: [3, 4, 4, 5, 5] },
|
||||
9: { good: 6, evil: 3, quests: [3, 4, 4, 5, 5] },
|
||||
10: { good: 6, evil: 4, quests: [3, 4, 4, 5, 5] },
|
||||
};
|
||||
|
||||
// --- NUEVOS TIPOS PARA EL LOBBY ---
|
||||
|
||||
export interface GameRoom {
|
||||
id: string; // ID interno único (uuid)
|
||||
name: string; // Nombre de misión (ej: Operación Overlord)
|
||||
hostId: string; // ID del creador
|
||||
currentPlayers: number;
|
||||
maxPlayers: number;
|
||||
isPrivate: boolean; // Si tiene contraseña
|
||||
status: 'waiting' | 'playing' | 'finished';
|
||||
}
|
||||
|
||||
export interface CreateGamePayload {
|
||||
hostName: string;
|
||||
maxPlayers: number;
|
||||
password?: string;
|
||||
}
|
||||
|
||||
export interface JoinGamePayload {
|
||||
roomId: string; // Puede ser el ID numérico interno o lo que usemos
|
||||
playerName: string;
|
||||
password?: string;
|
||||
}
|
||||
|
||||
export interface LobbyLists {
|
||||
rooms: GameRoom[];
|
||||
}
|
||||
Reference in New Issue
Block a user