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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | /**
* Player state and related types for Korean martial arts combat system.
*
* **Korean**: 플레이어 시스템 (Player System)
*
* This module defines the complete state structure for combat participants,
* including resources (Health, Ki, Stamina), combat attributes, positioning,
* and tracking for vital point strikes and statistics.
*
* ## Player State Structure
*
* The player state encompasses:
* - **Identity**: Name, archetype, unique ID
* - **Resources**: Health, Ki (氣), Stamina, Energy
* - **Attributes**: Attack, Defense, Speed, Technique skill
* - **Combat Status**: Stance, state, blocking, stunning, countering
* - **Position**: 2D coordinates in combat arena
* - **Effects**: Status effects and active modifiers
* - **Statistics**: Match performance metrics
*
* @module systems/player
* @category Player & Archetypes
* @korean 플레이어
*/
import { StatusEffect } from "@/systems/types";
import {
CombatState,
KoreanText,
PlayerArchetype,
Position,
TrigramStance,
} from "@/types";
/**
* Complete player state for Korean martial arts combat.
*
* **Korean**: 플레이어 상태 (Player State)
*
* Represents the complete state of a combatant including physical resources,
* combat attributes, current stance, position, and accumulated statistics.
* All properties are readonly to enforce immutable state updates.
*
* ## Resource System
*
* - **Health**: Physical integrity (0 = defeated)
* - **Ki (氣)**: Spiritual energy for techniques and stance transitions
* - **Stamina**: Physical endurance for sustained combat
* - **Energy**: Action points for moves per turn
*
* ## Combat Attributes
*
* - **Attack Power**: Base damage output modifier
* - **Defense**: Damage reduction and blocking effectiveness
* - **Speed**: Action priority and dodge capability
* - **Technique**: Precision for vital point targeting
*
* @example
* ```typescript
* const player: PlayerState = {
* id: "player-1",
* name: { korean: "이순신", english: "Yi Sun-sin" },
* archetype: PlayerArchetype.MUSA,
*
* // Resources
* health: 100,
* maxHealth: 100,
* ki: 100,
* maxKi: 100,
* stamina: 100,
* maxStamina: 100,
* energy: 100,
* maxEnergy: 100,
*
* // Attributes
* attackPower: 15,
* defense: 12,
* speed: 10,
* technique: 14,
*
* // Combat state
* currentStance: TrigramStance.GEON,
* combatState: CombatState.IDLE,
* position: { x: 100, y: 200 },
* isBlocking: false,
* isStunned: false,
*
* // ... other properties
* };
* ```
*
* @public
* @category Player & Archetypes
* @korean 플레이어상태
*/
export interface PlayerState {
/** Unique player identifier */
readonly id: string;
/** Bilingual Korean-English player name */
readonly name: KoreanText;
/** Player combat archetype (무사, 암살자, etc.) */
readonly archetype: PlayerArchetype;
// Combat stats
/** Current health points (0 = defeated) */
readonly health: number;
/** Maximum health capacity */
readonly maxHealth: number;
/** Current Ki (氣) spiritual energy */
readonly ki: number;
/** Maximum Ki capacity */
readonly maxKi: number;
/** Current stamina (physical endurance) */
readonly stamina: number;
/** Maximum stamina capacity */
readonly maxStamina: number;
/** Current energy (action points) */
readonly energy: number;
/** Maximum energy capacity */
readonly maxEnergy: number;
// Combat attributes
/** Base attack damage multiplier */
readonly attackPower: number;
/** Damage reduction and blocking effectiveness */
readonly defense: number;
/** Action speed and dodge capability */
readonly speed: number;
/** Precision for vital point targeting */
readonly technique: number;
/** Current pain level (reduces effectiveness) */
readonly pain: number;
/** Consciousness level (0 = unconscious) */
readonly consciousness: number;
/** Physical balance and stability */
readonly balance: number;
/** Combat momentum for combo bonuses */
readonly momentum: number;
// Combat state
/** Current Eight Trigram stance */
readonly currentStance: TrigramStance;
/** Current combat action state */
readonly combatState: CombatState;
/** Position in combat arena */
readonly position: Position;
/** Whether player is actively blocking */
readonly isBlocking: boolean;
/** Whether player is stunned (cannot act) */
readonly isStunned: boolean;
/** Whether player is executing a counter-attack */
readonly isCountering: boolean;
/** Timestamp of last action performed */
readonly lastActionTime: number;
/** Time required before next action available */
readonly recoveryTime: number;
/** Timestamp of last stance transition */
readonly lastStanceChangeTime: number;
// Status and effects
/** Active status effects (poison, stun, etc.) */
readonly statusEffects: readonly StatusEffect[];
/** IDs of currently active effects */
readonly activeEffects: readonly string[];
// Vital points state
/** State of player's vital points (for defense) */
readonly vitalPoints: readonly {
/** Vital point identifier */
readonly id: string;
/** Whether this vital point has been struck */
readonly isHit: boolean;
/** Accumulated damage to this vital point */
readonly damage: number;
/** Timestamp of last hit to this point */
readonly lastHitTime: number;
}[];
// Match statistics
/** Total damage received this match */
readonly totalDamageReceived: number;
/** Total damage dealt this match */
readonly totalDamageDealt: number;
/** Number of hits received */
readonly hitsTaken: number;
/** Number of hits successfully landed */
readonly hitsLanded: number;
/** Number of perfect accuracy strikes */
readonly perfectStrikes: number;
/** Number of successful vital point strikes */
readonly vitalPointHits: number;
// Optional extended statistics
/** Number of missed attacks */
readonly misses?: number;
/** Overall accuracy percentage */
readonly accuracy?: number;
/** Current combo chain length */
readonly comboCount?: number;
/** Maximum combo achieved this match */
readonly maxCombo?: number;
/** Rounds won this match */
readonly roundsWon?: number;
/** Total matches won (career) */
readonly matchesWon?: number;
/** Experience points earned */
readonly experiencePoints?: number;
/** Player ranking (e.g., "Bronze", "Silver") */
readonly rank?: string;
/** Total career wins */
readonly wins?: number;
/** Total career losses */
readonly losses?: number;
}
/**
* Data required to create a new player.
*
* **Korean**: 플레이어 생성 데이터
*
* Used when initializing a new combatant with customizations.
*
* @example
* ```typescript
* const creationData: PlayerCreationData = {
* name: { korean: "김무사", english: "Kim Warrior" },
* archetype: PlayerArchetype.MUSA,
* preferredStance: TrigramStance.GEON,
* customizations: {
* colors: { primary: 0x00FFFF, secondary: 0xFFAA00 },
* techniques: ["geon-thunder-strike"]
* }
* };
* ```
*
* @public
* @category Player & Archetypes
* @korean 플레이어생성
*/
export interface PlayerCreationData {
/** Bilingual player name */
readonly name: KoreanText;
/** Combat archetype selection */
readonly archetype: PlayerArchetype;
/** Optional starting stance preference */
readonly preferredStance?: TrigramStance;
/** Optional visual and technique customizations */
readonly customizations?: {
/** Primary and secondary color scheme */
readonly colors?: { primary: number; secondary: number };
/** List of unlocked technique IDs */
readonly techniques?: string[];
};
}
/**
* Player statistics accumulated over a match.
*
* **Korean**: 플레이어 경기 통계
*
* Tracks performance metrics for a single combat match.
*
* @public
* @category Player & Archetypes
* @korean 경기통계
*/
export interface PlayerMatchStats {
/** Wins in this match */
readonly wins: number;
/** Losses in this match */
readonly losses: number;
/** Total hits received */
readonly hitsTaken: number;
/** Total hits landed on opponent */
readonly hitsLanded: number;
/** Total damage dealt */
readonly totalDamageDealt: number;
/** Total damage received */
readonly totalDamageReceived: number;
/** Techniques used this match */
readonly techniques: readonly string[];
/** Number of perfect accuracy strikes */
readonly perfectStrikes: number;
/** Number of vital point hits */
readonly vitalPointHits: number;
/** Current consecutive win streak */
readonly consecutiveWins: number;
/** Match duration in milliseconds */
readonly matchDuration: number;
}
/**
* Partial update data for player state.
*
* **Korean**: 플레이어 업데이트 데이터
*
* Allows updating specific player properties without replacing entire state.
*
* @example
* ```typescript
* const update: PlayerUpdateData = {
* health: 75,
* ki: 50,
* currentStance: TrigramStance.GAM
* };
* ```
*
* @public
* @category Player & Archetypes
*/
export type PlayerUpdateData = Partial<PlayerState>;
/**
* Minimal player state with only essential properties.
*
* **Korean**: 최소 플레이어 상태
*
* Simplified player state for systems that don't require full combat data.
* Useful for UI displays and simple calculations.
*
* @public
* @category Player & Archetypes
* @korean 최소상태
*/
export interface MinimalPlayerState {
id: string;
name: { korean: string; english: string };
archetype: PlayerArchetype;
health: number;
maxHealth: number;
ki: number;
maxKi: number;
stamina: number;
maxStamina: number;
energy: number;
maxEnergy: number;
attackPower: number;
defense: number;
speed: number;
technique: number;
pain: number;
consciousness: number;
balance: number;
momentum: number;
currentStance: TrigramStance;
combatState: CombatState;
position: Position;
isBlocking: boolean;
isStunned: boolean;
isCountering: boolean;
lastActionTime: number;
recoveryTime: number;
lastStanceChangeTime: number;
statusEffects: any[];
activeEffects: any[];
vitalPoints: any[];
totalDamageReceived: number;
totalDamageDealt: number;
hitsTaken: number;
hitsLanded: number;
perfectStrikes: number;
vitalPointHits: number;
}
export interface PlayerTrainingStats {
readonly attempts: number;
readonly successes: number;
readonly failures: number;
readonly averageTime: number;
readonly bestTime: number;
readonly worstTime: number;
readonly techniquesUsed: readonly string[];
readonly dummyInteractions: number;
}
|