Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x | /**
* Core game state and flow management types.
*
* Defines match configuration, event system, game sessions, and
* persistent save data for the Black Trigram combat game.
*
* @module systems/game
* @category Game State
* @korean 게임상태관리
*/
import { GameMode, KoreanText } from "@/types";
import type { PlayerState } from "./player";
/** Configuration for a match before it begins */
export interface MatchConfig {
readonly mode: GameMode;
readonly rounds: number;
readonly roundDuration: number; // seconds
readonly player1Archetype: string;
readonly player2Archetype: string;
readonly stage: string;
readonly difficulty?: "easy" | "medium" | "hard" | "expert";
}
/** A discrete event emitted during gameplay for logging and UI updates */
export interface GameEvent {
readonly id: string;
readonly type: GameEventType;
readonly timestamp: number;
readonly playerId?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Event data can contain various types depending on event type
readonly data: Record<string, any>;
readonly message?: KoreanText;
}
/** All event types emitted during a match lifecycle */
export enum GameEventType {
GAME_START = "game_start",
ROUND_START = "round_start",
ROUND_END = "round_end",
MATCH_END = "match_end",
PLAYER_ATTACK = "player_attack",
PLAYER_HIT = "player_hit",
STANCE_CHANGE = "stance_change",
TECHNIQUE_EXECUTE = "technique_execute",
VITAL_POINT_HIT = "vital_point_hit",
STATUS_EFFECT = "status_effect",
PAUSE_TOGGLE = "pause_toggle",
ERROR = "error",
}
/** Runtime state for an active match session */
export interface GameSession {
readonly id: string;
readonly gameMode: GameMode;
readonly players: readonly [PlayerState, PlayerState];
readonly currentRound: number;
readonly maxRounds: number;
readonly roundTimeLimit: number;
readonly timeRemaining: number;
readonly isPaused: boolean;
readonly isGameOver: boolean;
readonly winner: PlayerState | null;
}
/** Global game rules and balance parameters */
export interface GameConfig {
readonly maxHealth: number;
readonly maxKi: number;
readonly maxStamina: number;
readonly roundDuration: number;
readonly maxRounds: number;
readonly difficulty: "beginner" | "intermediate" | "expert" | "master";
readonly enableVitalPoints: boolean;
readonly enableStatusEffects: boolean;
readonly allowArchetypeSwitching: boolean;
}
/** Persistent player data written to save storage */
export interface GameSaveData {
readonly version: string;
readonly playerId: string;
readonly playerProgress: {
readonly archetypeExperience: Record<string, number>;
readonly unlockedTechniques: readonly string[];
readonly achievements: readonly string[];
};
readonly settings: {
readonly volume: number;
readonly difficulty: string;
readonly controls: Record<string, string>;
};
readonly statistics: {
readonly totalMatches: number;
readonly wins: number;
readonly losses: number;
readonly favoriteArchetype: string;
};
}
|