blacktrigram 0.7.23 → 0.7.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/ARCHITECTURE.md +51 -47
  2. package/CRA-ASSESSMENT.md +13 -13
  3. package/DATA_MODEL.md +6 -2
  4. package/SECURITY_ARCHITECTURE.md +6 -6
  5. package/THREAT_MODEL.md +6 -6
  6. package/lib/audio/AudioManager.js +3 -2
  7. package/lib/audio/AudioManager.js.map +1 -1
  8. package/lib/audio/types.js.map +1 -1
  9. package/lib/components/screens/intro/IntroScreen3D.js +1 -1
  10. package/lib/components/shared/ui/SplashScreen.js +2 -2
  11. package/lib/systems/ai/AdaptiveDifficulty.js +2 -1
  12. package/lib/systems/ai/AdaptiveDifficulty.js.map +1 -1
  13. package/lib/systems/ai/types.js.map +1 -1
  14. package/lib/systems/animation/builders/MartialArtsConstants.js.map +1 -1
  15. package/lib/systems/animation/core/types.js.map +1 -1
  16. package/lib/systems/bodypart/types.js.map +1 -1
  17. package/lib/systems/breathing/BreathingDisruptionSystem.js.map +1 -1
  18. package/lib/systems/combat/BalanceSystem.js.map +1 -1
  19. package/lib/systems/combat/CombatStateSystem.js.map +1 -1
  20. package/lib/systems/combat/ConsciousnessSystem.js.map +1 -1
  21. package/lib/systems/combat/PainResponseSystem.js.map +1 -1
  22. package/lib/systems/effects.js.map +1 -1
  23. package/lib/systems/game.js.map +1 -1
  24. package/lib/systems/physics/SpeedModifierSystem.js.map +1 -1
  25. package/lib/types/AccessibilityTypes.js.map +1 -1
  26. package/lib/types/common.js.map +1 -1
  27. package/lib/types/facial.js.map +1 -1
  28. package/lib/types/hand-animation.js.map +1 -1
  29. package/lib/types/injury.js.map +1 -1
  30. package/lib/types/skeletal.js.map +1 -1
  31. package/lib/types/techniqueId.js.map +1 -1
  32. package/lib/utils/deviceDetection.js.map +1 -1
  33. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../src/systems/animation/core/types.ts"],"sourcesContent":["/**\n * Animation system types for Black Trigram\n *\n * Defines animation states, configurations, and transition rules\n * for frame-accurate combat animations at 60fps.\n *\n * @module systems/animation/types\n * @category Animation\n * @korean 애니메이션시스템타입\n */\n\n/**\n * Animation states for player characters (애니메이션 상태)\n *\n * Enum-based animation state system for type safety and IDE autocomplete.\n * Each state includes Korean terminology and timing specifications.\n *\n * Based on game-design.md specifications:\n * - Attack: 12 frames (200ms at 60fps)\n * - Block: 4 frames (67ms at 60fps)\n * - Walk: 6 frames (100ms at 60fps)\n * - Stance transitions: 36 frames (600ms at 60fps)\n * - Tactical steps: 18 frames (300ms at 60fps, 30cm distance)\n *\n * @public\n * @korean 애니메이션상태\n */\nexport enum AnimationState {\n // ===== Basic Movement States (기본 이동 상태) =====\n\n /**\n * Idle stance - Default breathing animation\n * Korean: 대기 (daegi) - Standing ready\n * Duration: 4 frames (67ms)\n */\n IDLE = \"idle\",\n\n /**\n * Walk - Normal walking movement\n * Korean: 보행 (bohaeng) - Walking\n * Duration: 6 frames (100ms)\n */\n WALK = \"walk\",\n\n /**\n * Run - Fast movement animation\n * Korean: 달리기 (dalligi) - Running\n * Duration: 8 frames (133ms)\n */\n RUN = \"run\",\n\n // ===== Combat Actions (전투 행동) =====\n\n /**\n * Attack - Generic attack animation\n * Korean: 공격 (gonggyeok) - Attack\n * Duration: 12 frames (200ms)\n */\n ATTACK = \"attack\",\n\n /**\n * Defend - Basic block/defense\n * Korean: 방어 (bangeo) - Defense\n * Duration: 4 frames (67ms)\n */\n DEFEND = \"defend\",\n\n /**\n * Defend Block Success - Successful block, absorb impact\n * Korean: 막기 (makgi) - Block successfully\n * Duration: 8 frames (133ms)\n */\n DEFEND_BLOCK_SUCCESS = \"defend_block_success\",\n\n /**\n * Defend Parry - Parry deflection, redirect attack\n * Korean: 받아넘기기 (badaneumgigi) - Parry deflect\n * Duration: 10 frames (167ms)\n */\n DEFEND_PARRY = \"defend_parry\",\n\n /**\n * Defend Guard Break - Guard break, defensive stance destroyed\n * Korean: 방어붕괴 (bangeo bunggoe) - Guard broken\n * Duration: 15 frames (250ms)\n */\n DEFEND_GUARD_BREAK = \"defend_guard_break\",\n\n /**\n * Defend Recovery - Guard recovery, restore defensive posture\n * Korean: 방어복구 (bangeo bokgu) - Guard recovery\n * Duration: 12 frames (200ms)\n */\n DEFEND_RECOVERY = \"defend_recovery\",\n\n /**\n * Hit - Taking damage animation\n * Korean: 피격 (pigyeok) - Being hit\n * Duration: 4 frames (67ms)\n */\n HIT = \"hit\",\n\n /**\n * KO - Knockout/death animation\n * Korean: 기절 (gijeol) - Knockout\n * Duration: 30 frames (500ms)\n */\n KO = \"ko\",\n\n // ===== Stance Transitions (자세 전환) =====\n\n /**\n * Stance Change - Trigram stance transition\n * Korean: 자세변경 (jaseybyeongyeong) - Stance change\n * Duration: 36 frames (600ms)\n */\n STANCE_CHANGE = \"stance_change\",\n\n /**\n * Stance Side Switch - Left↔right stance mirror\n * Korean: 좌우전환 (jwaujeonhwan) - Left-right switch\n * Duration: 24 frames (400ms)\n */\n STANCE_SIDE_SWITCH = \"stance_side_switch\",\n\n // ===== Stance Guard Animations (팔괘 방어 자세) =====\n\n /**\n * Stance Guard Geon - ☰ Heaven stance guard\n * Korean: 건괘수비 (geon-goe subi) - Heaven guard\n * Duration: 6 frames (breathing loop)\n */\n STANCE_GUARD_GEON = \"stance_guard_geon\",\n\n /**\n * Stance Guard Tae - ☱ Lake stance guard\n * Korean: 태괘수비 (tae-goe subi) - Lake guard\n * Duration: 6 frames (breathing loop)\n */\n STANCE_GUARD_TAE = \"stance_guard_tae\",\n\n /**\n * Stance Guard Li - ☲ Fire stance guard\n * Korean: 리괘수비 (li-goe subi) - Fire guard\n * Duration: 4 frames (breathing loop)\n */\n STANCE_GUARD_LI = \"stance_guard_li\",\n\n /**\n * Stance Guard Jin - ☳ Thunder stance guard\n * Korean: 진괘수비 (jin-goe subi) - Thunder guard\n * Duration: 5 frames (breathing loop)\n */\n STANCE_GUARD_JIN = \"stance_guard_jin\",\n\n /**\n * Stance Guard Son - ☴ Wind stance guard\n * Korean: 손괘수비 (son-goe subi) - Wind guard\n * Duration: 6 frames (breathing loop)\n */\n STANCE_GUARD_SON = \"stance_guard_son\",\n\n /**\n * Stance Guard Gam - ☵ Water stance guard\n * Korean: 감괘수비 (gam-goe subi) - Water guard\n * Duration: 6 frames (breathing loop)\n */\n STANCE_GUARD_GAM = \"stance_guard_gam\",\n\n /**\n * Stance Guard Gan - ☶ Mountain stance guard\n * Korean: 간괘수비 (gan-goe subi) - Mountain guard\n * Duration: 4 frames (breathing loop)\n */\n STANCE_GUARD_GAN = \"stance_guard_gan\",\n\n /**\n * Stance Guard Gon - ☷ Earth stance guard\n * Korean: 곤괘수비 (gon-goe subi) - Earth guard\n * Duration: 5 frames (breathing loop)\n */\n STANCE_GUARD_GON = \"stance_guard_gon\",\n\n // ===== Tactical Step Movements (전술적 발걸음) =====\n\n /**\n * Step Forward - Forward tactical step\n * Korean: 전진보법 (jeonjin bobeop) - Forward step\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_FORWARD = \"step_forward\",\n\n /**\n * Step Back - Retreat tactical step\n * Korean: 후퇴보법 (hutoe bobeop) - Retreat step\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_BACK = \"step_back\",\n\n /**\n * Step Left - Left side tactical step\n * Korean: 좌측면보법 (jwacheuk myeon bobeop) - Left side step\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_LEFT = \"step_left\",\n\n /**\n * Step Right - Right side tactical step\n * Korean: 우측면보법 (ucheuk myeon bobeop) - Right side step\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_RIGHT = \"step_right\",\n\n /**\n * Step Forward Left - Forward-left diagonal step\n * Korean: 전좌측보법 (jeon jwacheuk bobeop) - Forward-left diagonal\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_FORWARD_LEFT = \"step_forward_left\",\n\n /**\n * Step Forward Right - Forward-right diagonal step\n * Korean: 전우측보법 (jeon ucheuk bobeop) - Forward-right diagonal\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_FORWARD_RIGHT = \"step_forward_right\",\n\n /**\n * Step Back Left - Back-left diagonal step\n * Korean: 후좌측보법 (hu jwacheuk bobeop) - Back-left diagonal\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_BACK_LEFT = \"step_back_left\",\n\n /**\n * Step Back Right - Back-right diagonal step\n * Korean: 후우측보법 (hu ucheuk bobeop) - Back-right diagonal\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_BACK_RIGHT = \"step_back_right\",\n\n // ===== Footwork Patterns (보법) =====\n\n /**\n * Footwork Circular Left - Circular step maintaining guard (left)\n * Korean: 원형보 좌 (wonhyeongbo jwa) - Circular step left\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n FOOTWORK_CIRCULAR_LEFT = \"footwork_circular_left\",\n\n /**\n * Footwork Circular Right - Circular step maintaining guard (right)\n * Korean: 원형보 우 (wonhyeongbo u) - Circular step right\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n FOOTWORK_CIRCULAR_RIGHT = \"footwork_circular_right\",\n\n /**\n * Footwork Pivot Left - Pivot rotation on planted foot (left)\n * Korean: 축족회전 좌 (chukjok hoejeon jwa) - Pivot rotation left\n * Duration: 15 frames (250ms), Rotation: 90°\n */\n FOOTWORK_PIVOT_LEFT = \"footwork_pivot_left\",\n\n /**\n * Footwork Pivot Right - Pivot rotation on planted foot (right)\n * Korean: 축족회전 우 (chukjok hoejeon u) - Pivot rotation right\n * Duration: 15 frames (250ms), Rotation: 90°\n */\n FOOTWORK_PIVOT_RIGHT = \"footwork_pivot_right\",\n\n /**\n * Footwork Slide Forward - Both feet slide together (forward)\n * Korean: 미끄럼보 전 (mikkeureombo jeon) - Sliding step forward\n * Duration: 12 frames (200ms), Distance: 30cm\n */\n FOOTWORK_SLIDE_FORWARD = \"footwork_slide_forward\",\n\n /**\n * Footwork Slide Back - Both feet slide together (back)\n * Korean: 미끄럼보 후 (mikkeureombo hu) - Sliding step back\n * Duration: 12 frames (200ms), Distance: 30cm\n */\n FOOTWORK_SLIDE_BACK = \"footwork_slide_back\",\n\n /**\n * Footwork Slide Left - Both feet slide together (left)\n * Korean: 미끄럼보 좌 (mikkeureombo jwa) - Sliding step left\n * Duration: 12 frames (200ms), Distance: 30cm\n */\n FOOTWORK_SLIDE_LEFT = \"footwork_slide_left\",\n\n /**\n * Footwork Slide Right - Both feet slide together (right)\n * Korean: 미끄럼보 우 (mikkeureombo u) - Sliding step right\n * Duration: 12 frames (200ms), Distance: 30cm\n */\n FOOTWORK_SLIDE_RIGHT = \"footwork_slide_right\",\n\n /**\n * Footwork Shuffle - Quick micro-adjustment\n * Korean: 섞음보 (seokkeumbo) - Shuffle step\n * Duration: 6 frames (100ms), Distance: 15cm\n */\n FOOTWORK_SHUFFLE = \"footwork_shuffle\",\n\n // ===== Fall Animations (낙법 애니메이션) =====\n\n /**\n * Fall Forward - Forward fall animation\n * Korean: 전방낙법 (jeonbang nakbeop) - Forward falling technique\n * Duration: 24 frames (400ms)\n */\n FALL_FORWARD = \"fall_forward\",\n\n /**\n * Fall Backward - Backward fall animation\n * Korean: 후방낙법 (hubang nakbeop) - Backward falling technique\n * Duration: 30 frames (500ms)\n */\n FALL_BACKWARD = \"fall_backward\",\n\n /**\n * Fall Side Left - Left side fall animation\n * Korean: 좌측낙법 (jwacheuk nakbeop) - Left side falling technique\n * Duration: 27 frames (450ms)\n */\n FALL_SIDE_LEFT = \"fall_side_left\",\n\n /**\n * Fall Side Right - Right side fall animation\n * Korean: 우측낙법 (ucheuk nakbeop) - Right side falling technique\n * Duration: 27 frames (450ms)\n */\n FALL_SIDE_RIGHT = \"fall_side_right\",\n\n // ===== Ground States (지면 자세) =====\n\n /**\n * Ground Prone - Face-down ground position\n * Korean: 엎드림 (eopdeurim) - Face down position\n * Duration: 4 frames (breathing loop)\n */\n GROUND_PRONE = \"ground_prone\",\n\n /**\n * Ground Supine - Face-up ground position\n * Korean: 누움 (nuum) - Face up position\n * Duration: 4 frames (breathing loop)\n */\n GROUND_SUPINE = \"ground_supine\",\n\n /**\n * Ground Side Left - Left side ground position\n * Korean: 좌측와 (jwacheuk wa) - Left side position\n * Duration: 4 frames (breathing loop)\n */\n GROUND_SIDE_LEFT = \"ground_side_left\",\n\n /**\n * Ground Side Right - Right side ground position\n * Korean: 우측와 (ucheuk wa) - Right side position\n * Duration: 4 frames (breathing loop)\n */\n GROUND_SIDE_RIGHT = \"ground_side_right\",\n\n // ===== Turn Animations (180도 회전) =====\n\n /**\n * Turn Left - 180° turn left animation\n * Korean: 좌회전 (jwahoejeon) - Left turn\n * Duration: 12 frames (200ms), Rotation: 180°\n */\n TURN_LEFT = \"turn_left\",\n\n /**\n * Turn Right - 180° turn right animation\n * Korean: 우회전 (uhoejeon) - Right turn\n * Duration: 12 frames (200ms), Rotation: 180°\n */\n TURN_RIGHT = \"turn_right\",\n\n // ===== Recovery Animations (회복 애니메이션) =====\n\n /**\n * Recovery Prone Standup - Stand up from prone position\n * Korean: 엎드린 기상 (eopdeurin gisang) - Prone stand-up\n * Duration: 30 frames (500ms)\n */\n RECOVERY_PRONE_STANDUP = \"recovery_prone_standup\",\n\n /**\n * Recovery Supine Standup - Stand up from supine position\n * Korean: 누운 기상 (nuun gisang) - Supine stand-up\n * Duration: 36 frames (600ms)\n */\n RECOVERY_SUPINE_STANDUP = \"recovery_supine_standup\",\n\n /**\n * Recovery Roll - Roll recovery to standing\n * Korean: 회전기상 (hoejeon gisang) - Roll recovery\n * Duration: 24 frames (400ms), Stamina cost: 20\n */\n RECOVERY_ROLL = \"recovery_roll\",\n\n /**\n * Recovery Defensive - Defensive getup with guard\n * Korean: 방어기상 (bangeo gisang) - Defensive getup\n * Duration: 42 frames (700ms), Damage reduction: 50%\n */\n RECOVERY_DEFENSIVE = \"recovery_defensive\",\n\n // ===== Grappling Animations (잡기 애니메이션) =====\n\n /**\n * Grapple Entry - Establish grip connection\n * Korean: 잡기 연결 (japgi yeongyeol) - Grab connection\n * Duration: 8 frames (133ms)\n *\n * Initiates the grappling sequence when attacker successfully grabs defender.\n * Transition from IDLE/ATTACK state to establishing physical control.\n */\n GRAPPLE_ENTRY = \"grapple_entry\",\n\n /**\n * Grapple Control - Maintain grip control\n * Korean: 잡기 유지 (japgi yuji) - Maintaining grip\n * Duration: Loop (breathing animation ~4 frames)\n *\n * Active control state where attacker maintains grip on defender.\n * Looping animation with subtle struggle movements.\n * Stamina cost: 5/second (default)\n */\n GRAPPLE_CONTROL = \"grapple_control\",\n\n /**\n * Grapple Struggle - Escape attempt animation\n * Korean: 탈출 시도 (talchul sido) - Escape attempts\n * Duration: 12 frames (200ms)\n *\n * Defender animation when attempting to break free from grapple.\n * Shows strain and resistance movements.\n * Stamina cost: 15 per attempt\n */\n GRAPPLE_STRUGGLE = \"grapple_struggle\",\n\n /**\n * Grapple Escape - Successful escape from grapple\n * Korean: 탈출 성공 (talchul seonggong) - Successful escape\n * Duration: 15 frames (250ms)\n *\n * Defender breaks free and creates distance from attacker.\n * Returns to IDLE state upon completion.\n * Provides invulnerability frames during escape animation.\n */\n GRAPPLE_ESCAPE = \"grapple_escape\",\n}\n\n/**\n * Animation priority levels for interrupt system\n *\n * Higher priority animations can interrupt lower priority ones.\n * Priority order: recovery > fall > ko > hit > attack > defend > step > stance_change > movement > idle\n *\n * Steps are non-interruptible (same priority as attacks) to ensure commitment\n * to tactical repositioning in Korean martial arts.\n * Recovery animations have highest priority to allow getting up from ground.\n *\n * @public\n * @korean 애니메이션우선순위\n */\nexport enum AnimationPriority {\n IDLE = 0,\n WALK = 1,\n RUN = 2,\n STANCE_CHANGE = 3,\n DEFEND = 4,\n ATTACK = 5, // STEP shares ATTACK priority (both non-interruptible)\n HIT = 6,\n KO = 7,\n FALL = 8,\n RECOVERY = 9,\n}\n\n// Step animations use ATTACK priority (5) - both are non-interruptible\nexport const STEP_PRIORITY = AnimationPriority.ATTACK;\n\n/**\n * Defensive animation types for guard break and defensive stance mechanics.\n *\n * **Korean Terminology**:\n * - block_success: 막기 (makgi) - Successful block, absorb impact\n * - parry_deflect: 받아넘기기 (badaneumgigi) - Parry deflection, redirect attack\n * - guard_break: 방어붕괴 (bangeo bunggoe) - Guard break, defensive stance destroyed\n * - guard_recovery: 방어복구 (bangeo bokgu) - Guard recovery, restore defensive posture\n *\n * @public\n * @korean 방어애니메이션타입\n */\nexport type DefensiveAnimationType =\n | \"block_success\"\n | \"parry_deflect\"\n | \"guard_break\"\n | \"guard_recovery\";\n\n/**\n * Animation configuration for a single animation state\n *\n * Frame counts based on game-design.md:\n * - Attack: 12 frames (200ms at 60fps)\n * - Block: 4 frames (67ms at 60fps)\n * - Walk: 6 frames\n *\n * Extended with defensive animation support:\n * - Block Success: 8 frames (133ms)\n * - Parry Deflect: 10 frames (167ms)\n * - Guard Break: 15 frames (250ms)\n * - Guard Recovery: 12 frames (200ms)\n *\n * @public\n * @korean 애니메이션설정\n */\nexport interface AnimationConfig {\n /**\n * Animation state identifier\n * @korean 상태\n */\n readonly state: AnimationState;\n\n /**\n * Total number of frames in animation\n * @korean 프레임수\n */\n readonly frames: number;\n\n /**\n * Target frames per second (typically 60)\n * @korean 초당프레임\n */\n readonly fps: number;\n\n /**\n * Whether animation loops continuously\n * @korean 반복여부\n */\n readonly loop: boolean;\n\n /**\n * Whether animation can be interrupted by higher priority animations\n * @korean 중단가능여부\n */\n readonly interruptible: boolean;\n\n /**\n * Animation priority for interrupt system\n * @korean 우선순위\n */\n readonly priority: AnimationPriority;\n\n /**\n * Duration in seconds (calculated from frames/fps)\n * @korean 지속시간\n */\n readonly duration: number;\n\n /**\n * Counter-attack window in seconds (for parry animations)\n * Creates an opportunity window for immediate counter-attacks after successful parry.\n * @korean 반격시간\n */\n readonly counterWindow?: number;\n\n /**\n * Vulnerability window duration in seconds (for guard break animations)\n * Extended vulnerability period where defender takes increased damage.\n * @korean 취약시간\n */\n readonly vulnerabilityDuration?: number;\n\n /**\n * Easing function for smooth animation transitions\n *\n * **Korean**: 이징 함수\n *\n * Specifies the easing curve for this animation's transitions.\n * Uses cubic bezier presets for natural Korean martial arts movement.\n *\n * @korean 이징함수\n */\n readonly easing?:\n | \"linear\"\n | \"ease-in\"\n | \"ease-out\"\n | \"ease-in-out\"\n | \"natural-motion\"\n | \"smooth-transition\"\n | \"quick-start\"\n | \"explosive-power\"\n | \"controlled-slow\";\n}\n\n/**\n * Mutable version of AnimationConfig for internal state machine use.\n * Allows dynamic frame/duration updates for technique-specific timing.\n *\n * @internal\n * @korean 가변애니메이션설정\n */\nexport type MutableAnimationConfig = {\n -readonly [K in keyof AnimationConfig]: AnimationConfig[K];\n};\n\n/**\n * Animation event callback types\n *\n * @public\n * @korean 애니메이션이벤트\n */\nexport interface AnimationEvents {\n /**\n * Called when animation starts\n * @korean 시작이벤트\n */\n readonly onAnimationStart?: (state: AnimationState) => void;\n\n /**\n * Called on specific frame numbers\n * @korean 프레임이벤트\n */\n readonly onFrame?: (frame: number, state: AnimationState) => void;\n\n /**\n * Called when animation completes\n * @korean 완료이벤트\n */\n readonly onAnimationComplete?: (state: AnimationState) => void;\n\n /**\n * Called when animation is interrupted\n * @korean 중단이벤트\n */\n readonly onAnimationInterrupted?: (\n fromState: AnimationState,\n toState: AnimationState,\n ) => void;\n}\n\n/**\n * Animation state machine state\n *\n * @public\n * @korean 애니메이션상태머신상태\n */\nexport interface AnimationMachineState {\n /**\n * Current animation state\n * @korean 현재상태\n */\n readonly currentState: AnimationState;\n\n /**\n * Current frame index (0 to frames-1)\n * @korean 현재프레임\n */\n readonly frameIndex: number;\n\n /**\n * Time accumulator for frame timing\n * @korean 시간누적\n */\n readonly timeAccumulator: number;\n\n /**\n * Whether animation is playing\n * @korean 재생중\n */\n readonly isPlaying: boolean;\n\n /**\n * Previous animation state\n * @korean 이전상태\n */\n readonly previousState: AnimationState | null;\n}\n\n/**\n * Animation transition rule\n *\n * @public\n * @korean 애니메이션전환규칙\n */\nexport interface TransitionRule {\n /**\n * Source animation state\n * @korean 시작상태\n */\n readonly from: AnimationState;\n\n /**\n * Target animation state\n * @korean 목표상태\n */\n readonly to: AnimationState;\n\n /**\n * Whether transition is allowed\n * @korean 허용여부\n */\n readonly allowed: boolean;\n\n /**\n * Optional condition function\n * @korean 조건함수\n */\n readonly condition?: () => boolean;\n}\n\n/**\n * Result of an animation update\n *\n * @public\n * @korean 애니메이션업데이트결과\n */\nexport interface AnimationUpdateResult {\n /**\n * Current animation state\n * @korean 현재상태\n */\n readonly state: AnimationState;\n\n /**\n * Current frame index\n * @korean 현재프레임\n */\n readonly frame: number;\n\n /**\n * Animation progress (0-1)\n * @korean 진행률\n */\n readonly progress: number;\n\n /**\n * Whether animation just completed this frame\n * @korean 완료여부\n */\n readonly justCompleted: boolean;\n\n /**\n * Whether animation just started this frame\n * @korean 시작여부\n */\n readonly justStarted: boolean;\n}\n\n/**\n * Step direction for tactical movement\n *\n * Eight directions for tactical stepping (전술적 발놀림):\n * - forward: 전진보법 (Jeonjin Bobeop) - Forward step\n * - back: 후퇴보법 (Hutoe Bobeop) - Retreat step\n * - left: 좌측면보법 (Jwacheuk Myeon Bobeop) - Left side step\n * - right: 우측면보법 (Ucheuk Myeon Bobeop) - Right side step\n * - forward_left: 전좌측보법 (Jeon Jwacheuk Bobeop) - Forward-left diagonal\n * - forward_right: 전우측보법 (Jeon Ucheuk Bobeop) - Forward-right diagonal\n * - back_left: 후좌측보법 (Hu Jwacheuk Bobeop) - Back-left diagonal\n * - back_right: 후우측보법 (Hu Ucheuk Bobeop) - Back-right diagonal\n *\n * Each step moves exactly 30cm (one foot width) for tactical repositioning\n * in Korean martial arts combat.\n *\n * @public\n * @korean 발걸음방향\n */\nexport type StepDirection =\n | \"forward\"\n | \"back\"\n | \"left\"\n | \"right\"\n | \"forward_left\"\n | \"forward_right\"\n | \"back_left\"\n | \"back_right\";\n\n/**\n * Step animation configuration\n *\n * Defines keyframes for tactical step movements with:\n * - Weight transfer from back foot to front foot\n * - Foot lift and placement\n * - Guard position maintenance\n * - 30cm distance movement\n * - 300ms duration (18 frames at 60fps)\n *\n * @public\n * @korean 발걸음애니메이션설정\n */\nexport interface StepConfig extends AnimationConfig {\n /**\n * Step direction\n * @korean 방향\n */\n readonly direction: StepDirection;\n\n /**\n * Distance moved in meters (always 0.3m = 30cm)\n * @korean 이동거리\n */\n readonly distance: number;\n\n /**\n * Whether guard position is maintained during step\n * @korean 방어자세유지\n */\n readonly maintainsGuard: boolean;\n\n /**\n * Stamina cost for this step\n * @korean 체력소모\n */\n readonly staminaCost: number;\n}\n\n/**\n * Step keyframe data for animation interpolation\n *\n * Defines weight distribution, foot positions, and body center of gravity\n * at specific frames during the step animation.\n *\n * @public\n * @korean 발걸음키프레임\n */\nexport interface StepKeyframe {\n /**\n * Frame number (0-17 for 18-frame step)\n * @korean 프레임번호\n */\n readonly frame: number;\n\n /**\n * Weight distribution (0 = fully on back foot, 1 = fully on front foot)\n * @korean 체중분배\n */\n readonly weight: number;\n\n /**\n * Front foot position offset from start (0-1, where 1 = full step distance)\n * @korean 앞발위치\n */\n readonly frontFootOffset: number;\n\n /**\n * Back foot position offset from start (0-1)\n * @korean 뒷발위치\n */\n readonly backFootOffset: number;\n\n /**\n * Vertical lift of front foot in meters\n * @korean 앞발들어올림\n */\n readonly frontFootLift: number;\n\n /**\n * Body center of gravity height offset\n * @korean 무게중심높이\n */\n readonly cogHeight: number;\n}\n\n/**\n * Fall direction types for knockdown animations\n *\n * Determines which fall animation to play based on attack direction,\n * balance loss, or consciousness failure.\n *\n * Korean terminology:\n * - forward: 전방낙법 (Jeonbang Nakbeop) - Forward falling technique\n * - backward: 후방낙법 (Hubang Nakbeop) - Backward falling technique\n * - side_left: 좌측낙법 (Jwacheuk Nakbeop) - Left side falling technique\n * - side_right: 우측낙법 (Ucheuk Nakbeop) - Right side falling technique\n *\n * @public\n * @korean 낙법유형\n */\nexport type FallType = \"forward\" | \"backward\" | \"side_left\" | \"side_right\";\n\n/**\n * Ground position states after falling\n *\n * Represents the character's position on the ground after a fall.\n * Each state has a looping breathing animation.\n *\n * Korean terminology:\n * - prone: 엎드림 (Eopdeurim) - Face down position\n * - supine: 누움 (Nuum) - Face up position\n * - side_left: 좌측와 (Jwacheuk Wa) - Left side position\n * - side_right: 우측와 (Ucheuk Wa) - Right side position\n *\n * @public\n * @korean 지면자세\n */\nexport type GroundState = \"prone\" | \"supine\" | \"side_left\" | \"side_right\";\n\n/**\n * Maps fall types to corresponding ground states\n *\n * @public\n * @korean 낙법지면맵\n */\nexport const FALL_TO_GROUND_MAP: Record<FallType, GroundState> = {\n forward: \"prone\",\n backward: \"supine\",\n side_left: \"side_left\",\n side_right: \"side_right\",\n};\n\n/**\n * Maps fall types to corresponding animation states\n *\n * @public\n * @korean 낙법애니메이션맵\n */\nexport const FALL_TYPE_TO_ANIMATION: Record<FallType, AnimationState> = {\n forward: AnimationState.FALL_FORWARD,\n backward: AnimationState.FALL_BACKWARD,\n side_left: AnimationState.FALL_SIDE_LEFT,\n side_right: AnimationState.FALL_SIDE_RIGHT,\n};\n\n/**\n * Maps ground states to corresponding animation states\n *\n * @public\n * @korean 지면애니메이션맵\n */\nexport const GROUND_STATE_TO_ANIMATION: Record<GroundState, AnimationState> = {\n prone: AnimationState.GROUND_PRONE,\n supine: AnimationState.GROUND_SUPINE,\n side_left: AnimationState.GROUND_SIDE_LEFT,\n side_right: AnimationState.GROUND_SIDE_RIGHT,\n};\n\n/**\n * Body facing direction system state\n *\n * Manages automatic character rotation to face opponent with:\n * - Smooth torso rotation (45°/sec, ±90° range)\n * - Independent head tracking (±45° range)\n * - 180° turn animations for repositioning\n * - Facing lock during attack/defend animations\n *\n * Korean terminology:\n * - 정면향하기 (Jeongmyeon Hyanghagi) - Face forward\n * - 몸회전 (Mom Hoejeon) - Body rotation\n * - 머리추적 (Meori Chujok) - Head tracking\n * - 180도회전 (180-do Hoejeon) - 180-degree turn\n *\n * @public\n * @korean 몸향하기상태\n */\nexport interface BodyFacing {\n /**\n * Current facing direction in degrees (0-360)\n * - 0° = facing right (+X axis)\n * - 90° = facing down (+Z axis)\n * - 180° = facing left (-X axis)\n * - 270° = facing up (-Z axis)\n *\n * @korean 현재각도\n */\n readonly currentAngle: number;\n\n /**\n * Desired facing direction in degrees (0-360)\n * Typically pointing toward opponent position\n *\n * @korean 목표각도\n */\n readonly targetAngle: number;\n\n /**\n * Rotation speed in degrees per second\n * Default: 45°/sec for smooth, realistic rotation\n *\n * @korean 회전속도\n */\n readonly rotationSpeed: number;\n\n /**\n * Head rotation offset relative to torso (-45° to +45°)\n * Head can track independently within limited range\n * - Positive = head turned right\n * - Negative = head turned left\n *\n * @korean 머리회전각도\n */\n readonly headAngleOffset: number;\n\n /**\n * Whether facing direction is locked\n * True during attack/defend animations to lock attack direction\n * False during idle/movement to allow dynamic tracking\n *\n * @korean 회전잠금\n */\n readonly isLocked: boolean;\n\n /**\n * Whether character is currently executing a 180° turn animation\n * Used to prevent movement and other actions during repositioning\n *\n * @korean 180도회전중\n */\n readonly isTurning: boolean;\n\n /**\n * Direction of current 180° turn ('left' or 'right')\n * Determines which turn animation to play\n *\n * @korean 회전방향\n */\n readonly turnDirection?: \"left\" | \"right\";\n\n /**\n * Timestamp when 180° turn animation started\n * Used to track turn animation progress (200ms duration)\n *\n * @korean 회전시작시간\n */\n readonly turnStartTime?: number;\n\n /**\n * Torso rotation relative to hips in radians\n * Range: ±π/2 (±90°) for anatomically correct movement\n * - Positive = torso rotated right relative to hips\n * - Negative = torso rotated left relative to hips\n *\n * @korean 허리회전 (Heorhwoejeon)\n */\n readonly torsoRotation?: number;\n\n /**\n * Hip/pelvis rotation in radians (lower body facing direction)\n * Base rotation for the lower body, torsoRotation is relative to this\n *\n * @korean 골반회전 (Golbanhwoejeon)\n */\n readonly hipRotation?: number;\n}\n\n/**\n * Torso rotation state for independent upper/lower body movement\n *\n * Manages realistic torso rotation allowing upper body to face opponent\n * while lower body moves in different direction (strafing).\n *\n * Korean terminology:\n * - 허리회전 (Heorhwoejeon) - Torso rotation\n * - 상체비틀기 (Sangchebiteulgi) - Upper body twist\n * - 골반고정 (Golbangojeong) - Hip stabilization\n *\n * @public\n * @korean 허리회전상태\n */\nexport interface TorsoRotationState {\n /**\n * Current torso Y-axis rotation in radians\n * Range: ±π/2 (±90°) relative to hip direction\n *\n * @korean 현재회전\n */\n readonly currentRotation: number;\n\n /**\n * Target rotation towards opponent in radians\n * Smoothly interpolated to currentRotation\n *\n * @korean 목표회전\n */\n readonly targetRotation: number;\n\n /**\n * Lower body (hip/pelvis) rotation in radians\n * Base rotation for movement direction\n *\n * @korean 골반회전\n */\n readonly hipRotation: number;\n\n /**\n * Interpolation speed in seconds\n * Default: 0.2 (200ms for smooth rotation)\n *\n * @korean 보간속도\n */\n readonly interpolationSpeed: number;\n}\n\n/**\n * Footwork pattern types for Korean martial arts (보법)\n *\n * Four specialized footwork patterns based on traditional Korean martial arts:\n * - circular: 원형보 (Wonhyeongbo) - Circular stepping while maintaining guard facing\n * - pivot: 축족회전 (Chukjok Hoejeon) - Pivot rotation on planted foot\n * - slide: 미끄럼보 (Mikkeureombo) - Sliding step with both feet moving together\n * - shuffle: 섞음보 (Seokkeumbo) - Quick shuffling micro-adjustment\n *\n * Each pattern serves distinct tactical purposes in combat:\n * - Circular: Lateral repositioning while keeping opponent in guard\n * - Pivot: Fast direction changes on planted foot\n * - Slide: Maintaining stable base while advancing/retreating\n * - Shuffle: Fine-tuning position without commitment\n *\n * @public\n * @korean 보법유형\n */\nexport type FootworkPattern = \"circular\" | \"pivot\" | \"slide\" | \"shuffle\";\n\n/**\n * Footwork direction for directional patterns\n *\n * @public\n * @korean 보법방향\n */\nexport type FootworkDirection = \"left\" | \"right\" | \"forward\" | \"back\";\n\n/**\n * Korean terminology for footwork patterns\n *\n * Maps each footwork pattern to its Korean martial arts terminology\n * with romanization and English translation.\n *\n * @public\n * @korean 보법한글용어\n */\nexport const FOOTWORK_KOREAN_TERMS: Record<\n FootworkPattern,\n { korean: string; romanized: string; english: string }\n> = {\n circular: {\n korean: \"원형보\",\n romanized: \"Wonhyeongbo\",\n english: \"Circular Step\",\n },\n pivot: {\n korean: \"축족회전\",\n romanized: \"Chukjok Hoejeon\",\n english: \"Pivot Rotation\",\n },\n slide: {\n korean: \"미끄럼보\",\n romanized: \"Mikkeureombo\",\n english: \"Sliding Step\",\n },\n shuffle: {\n korean: \"섞음보\",\n romanized: \"Seokkeumbo\",\n english: \"Shuffle Step\",\n },\n};\n\n/**\n * Recovery animation types for getting up from ground states\n *\n * Korean terminology:\n * - prone_standup: 엎드린 기상 (Eopdeurin Gisang) - Stand up from prone\n * - supine_standup: 누운 기상 (Nuun Gisang) - Stand up from supine\n * - roll: 회전기상 (Hoejeon Gisang) - Roll recovery\n * - defensive: 방어기상 (Bangeo Gisang) - Defensive getup\n *\n * @public\n * @korean 회복애니메이션유형\n */\nexport type RecoveryAnimationType =\n | \"prone_standup\"\n | \"supine_standup\"\n | \"roll_recovery\"\n | \"defensive_getup\";\n\n/**\n * Korean terminology for recovery animations\n *\n * Maps each recovery type to its Korean martial arts terminology\n * with romanization and English translation.\n *\n * @public\n * @korean 회복한글용어\n */\nexport const RECOVERY_KOREAN_TERMS: Record<\n RecoveryAnimationType,\n { korean: string; romanized: string; english: string }\n> = {\n prone_standup: {\n korean: \"엎드린 기상\",\n romanized: \"Eopdeurin Gisang\",\n english: \"Prone Stand-Up\",\n },\n supine_standup: {\n korean: \"누운 기상\",\n romanized: \"Nuun Gisang\",\n english: \"Supine Stand-Up\",\n },\n roll_recovery: {\n korean: \"회전기상\",\n romanized: \"Hoejeon Gisang\",\n english: \"Roll Recovery\",\n },\n defensive_getup: {\n korean: \"방어기상\",\n romanized: \"Bangeo Gisang\",\n english: \"Defensive Getup\",\n },\n};\n\n/**\n * Maps ground states to their default recovery animation\n *\n * @public\n * @korean 지면회복맵\n */\nexport const GROUND_STATE_TO_RECOVERY: Record<\n GroundState,\n RecoveryAnimationType\n> = {\n prone: \"prone_standup\",\n supine: \"supine_standup\",\n side_left: \"roll_recovery\", // Side positions use roll by default\n side_right: \"roll_recovery\",\n};\n\n/**\n * Maps recovery types to their animation states\n *\n * @public\n * @korean 회복애니메이션맵\n */\nexport const RECOVERY_TYPE_TO_ANIMATION: Record<\n RecoveryAnimationType,\n AnimationState\n> = {\n prone_standup: AnimationState.RECOVERY_PRONE_STANDUP,\n supine_standup: AnimationState.RECOVERY_SUPINE_STANDUP,\n roll_recovery: AnimationState.RECOVERY_ROLL,\n defensive_getup: AnimationState.RECOVERY_DEFENSIVE,\n};\n\n/**\n * Technique intensity levels for animation speed and impact\n *\n * **Korean**: 기술 강도 레벨\n *\n * Determines animation speed modifier and visual impact effects:\n * - light: Fast techniques (1.2x speed), lower damage\n * - medium: Normal techniques (1.0x speed), standard damage\n * - heavy: Powerful techniques (0.8x speed), high damage\n * - critical: Maximum power (0.6x speed), critical damage\n *\n * @public\n * @category Animation\n * @korean 기술강도\n */\nexport type TechniqueIntensity = \"light\" | \"medium\" | \"heavy\" | \"critical\";\n\n/**\n * Technique type categories for animation selection\n *\n * **Korean**: 기술 유형\n *\n * Core technique categories that determine base animation style:\n * - strike: Direct striking attacks (punches, palm strikes)\n * - joint: Joint manipulation and locks\n * - throw: Throwing and sweeping techniques\n * - pressure_point: Precise vital point strikes\n *\n * @public\n * @category Combat\n * @korean 기술타입\n */\nexport type TechniqueTypeCategory =\n | \"strike\"\n | \"joint\"\n | \"throw\"\n | \"pressure_point\";\n\n/**\n * Composite key for technique animation lookup\n *\n * **Korean**: 기술 애니메이션 키\n *\n * Combines stance, technique type, target body part, and intensity\n * to uniquely identify the appropriate animation to play.\n *\n * @example\n * ```typescript\n * const key: TechniqueAnimationKey = {\n * stance: TrigramStance.GEON,\n * techniqueType: 'strike',\n * bodyPart: BodyPart.HEAD,\n * intensity: 'heavy',\n * };\n * ```\n *\n * @public\n * @category Animation\n * @korean 기술애니메이션키\n */\nexport interface TechniqueAnimationKey {\n /** Trigram stance (8 stances) */\n readonly stance: string;\n /** Technique category */\n readonly techniqueType: TechniqueTypeCategory;\n /** Target body part */\n readonly bodyPart: string;\n /** Attack intensity level */\n readonly intensity: TechniqueIntensity;\n}\n\n/**\n * Complete technique animation configuration\n *\n * **Korean**: 기술 애니메이션 설정\n *\n * Defines all properties needed to execute a technique animation,\n * including timing, impact frame, Korean terminology, and priority.\n *\n * @example\n * ```typescript\n * const animation: TechniqueAnimation = {\n * animationState: AnimationState.ATTACK,\n * duration: 0.8,\n * impactFrame: 12,\n * recoveryFrames: 15,\n * priority: 8,\n * koreanName: '건괘 두부 강 타격',\n * englishName: 'Heaven Stance Head Strike',\n * };\n * ```\n *\n * @public\n * @category Animation\n * @korean 기술애니메이션\n */\nexport interface TechniqueAnimation {\n /** Animation state to play */\n readonly animationState: AnimationState;\n /** Duration in seconds */\n readonly duration: number;\n /** Frame number where hit lands (0-indexed) */\n readonly impactFrame: number;\n /** Number of recovery frames after impact */\n readonly recoveryFrames: number;\n /** Animation priority for interrupt system */\n readonly priority: AnimationPriority;\n /** Korean technique name */\n readonly koreanName: string;\n /** English technique name */\n readonly englishName: string;\n\n // ===== Advanced Joint Movement Properties (고급 관절 동작) =====\n\n /**\n * Torso rotation angle in radians relative to hips\n *\n * **Korean**: 허리회전 (Heorhwoejeon)\n *\n * Range: -π/2 to π/2 (-90° to 90°)\n * Used for independent upper/lower body movement\n *\n * @korean 허리회전각도\n */\n readonly torsoRotation?: number;\n\n /**\n * Hip rotation engagement factor (0-1)\n *\n * **Korean**: 골반회전 참여도 (Golbanhwoejeon Chamyeodo)\n *\n * - 0.0: No hip engagement (isolated technique)\n * - 0.3: Minimal hip involvement\n * - 0.6: Moderate hip rotation\n * - 1.0: Full hip engagement (maximum power)\n *\n * Contributes 10-30% damage bonus based on technique type\n *\n * @korean 골반회전도\n */\n readonly hipEngagement?: number;\n\n /**\n * Power modifier from hip rotation (calculated)\n *\n * **Korean**: 파워배율 (Pawo Baeyul)\n *\n * Multiplier applied to technique damage (1.0-1.3)\n * Calculated from hipEngagement and techniqueType\n *\n * @korean 파워배율\n */\n readonly powerModifier?: number;\n}\n\n/**\n * Validation result for technique animation mapping completeness\n *\n * **Korean**: 기술 애니메이션 매핑 검증 결과\n *\n * Reports coverage percentage and lists any missing mappings\n * that need to be filled in.\n *\n * @public\n * @category Animation\n * @korean 매핑검증결과\n */\nexport interface MappingValidationResult {\n /** Coverage percentage (0-100) */\n readonly coverage: number;\n /** Total combinations expected */\n readonly total: number;\n /** Number of mapped combinations */\n readonly mapped: number;\n /** List of missing combinations */\n readonly missing: readonly TechniqueAnimationKey[];\n}\n\n// ===== Backward Compatibility Helpers (하위 호환성 도우미) =====\n\n/**\n * Convert string to AnimationState enum (backward compatibility)\n *\n * **Korean**: 문자열을 애니메이션 상태로 변환\n *\n * Provides backward compatibility for code using string-based animation states.\n * Returns null if the string doesn't match any valid animation state.\n *\n * @param state - String representation of animation state\n * @returns AnimationState enum or null if invalid\n *\n * @example\n * ```typescript\n * const state = stringToAnimationState(\"idle\"); // AnimationState.IDLE\n * const invalid = stringToAnimationState(\"invalid\"); // null\n * ```\n *\n * @public\n * @korean 문자열을애니메이션상태로변환\n */\nexport function stringToAnimationState(state: string): AnimationState | null {\n const normalized = state.toLowerCase();\n\n // Check if the normalized string is a valid AnimationState enum value\n const values = Object.values(AnimationState) as string[];\n if (values.includes(normalized)) {\n return normalized as AnimationState;\n }\n\n return null;\n}\n\n/**\n * Check if a value is a valid AnimationState enum\n *\n * **Korean**: 유효한 애니메이션 상태인지 확인\n *\n * Type guard to validate that a value is a valid AnimationState enum value.\n *\n * @param value - Value to check\n * @returns True if value is a valid AnimationState\n *\n * @example\n * ```typescript\n * if (isValidAnimationState(someValue)) {\n * // TypeScript knows someValue is AnimationState here\n * machine.transitionTo(someValue);\n * }\n * ```\n *\n * @public\n * @korean 유효한애니메이션상태확인\n */\nexport function isValidAnimationState(value: unknown): value is AnimationState {\n if (typeof value !== \"string\") {\n return false;\n }\n\n const values = Object.values(AnimationState) as string[];\n return values.includes(value);\n}\n\n/**\n * Get all animation state enum values as an array\n *\n * **Korean**: 모든 애니메이션 상태 값 배열\n *\n * Returns an array of all valid AnimationState enum values.\n * Useful for iteration, validation, and testing.\n *\n * @returns Array of all AnimationState values\n *\n * @example\n * ```typescript\n * const allStates = getAllAnimationStates();\n * allStates.forEach(state => {\n * console.log(`State: ${state}`);\n * });\n * ```\n *\n * @public\n * @korean 모든애니메이션상태가져오기\n */\nexport function getAllAnimationStates(): AnimationState[] {\n return Object.values(AnimationState);\n}\n\n/**\n * Check if an animation state is a stance guard state\n *\n * **Korean**: 자세 방어 상태인지 확인\n *\n * Determines if the given animation state is one of the eight trigram\n * stance guard animations.\n *\n * @param state - Animation state to check\n * @returns True if state is a stance guard animation\n *\n * @example\n * ```typescript\n * if (isStanceGuardState(AnimationState.STANCE_GUARD_GEON)) {\n * // Handle stance guard logic\n * }\n * ```\n *\n * @public\n * @korean 자세방어상태확인\n */\nexport function isStanceGuardState(state: AnimationState): boolean {\n return state.startsWith(\"stance_guard_\");\n}\n\n/**\n * Check if an animation state is a step movement state\n *\n * **Korean**: 발걸음 이동 상태인지 확인\n *\n * Determines if the given animation state is one of the tactical step\n * movement animations.\n *\n * @param state - Animation state to check\n * @returns True if state is a step movement animation\n *\n * @example\n * ```typescript\n * if (isStepState(AnimationState.STEP_FORWARD)) {\n * // Handle step movement logic\n * }\n * ```\n *\n * @public\n * @korean 발걸음상태확인\n */\nexport function isStepState(state: AnimationState): boolean {\n return state.startsWith(\"step_\");\n}\n\n/**\n * Check if an animation state is a footwork pattern state\n *\n * **Korean**: 보법 패턴 상태인지 확인\n *\n * Determines if the given animation state is one of the specialized\n * Korean martial arts footwork patterns.\n *\n * @param state - Animation state to check\n * @returns True if state is a footwork pattern animation\n *\n * @example\n * ```typescript\n * if (isFootworkState(AnimationState.FOOTWORK_CIRCULAR_LEFT)) {\n * // Handle footwork pattern logic\n * }\n * ```\n *\n * @public\n * @korean 보법상태확인\n */\nexport function isFootworkState(state: AnimationState): boolean {\n return state.startsWith(\"footwork_\");\n}\n\n/**\n * Check if an animation state is a fall animation state\n *\n * **Korean**: 낙법 애니메이션 상태인지 확인\n *\n * Determines if the given animation state is one of the fall animations.\n *\n * @param state - Animation state to check\n * @returns True if state is a fall animation\n *\n * @example\n * ```typescript\n * if (isFallState(AnimationState.FALL_FORWARD)) {\n * // Handle fall animation logic\n * }\n * ```\n *\n * @public\n * @korean 낙법상태확인\n */\nexport function isFallState(state: AnimationState): boolean {\n return state.startsWith(\"fall_\");\n}\n\n/**\n * Check if an animation state is a ground position state\n *\n * **Korean**: 지면 자세 상태인지 확인\n *\n * Determines if the given animation state is one of the ground position\n * breathing loops.\n *\n * @param state - Animation state to check\n * @returns True if state is a ground position animation\n *\n * @example\n * ```typescript\n * if (isGroundState(AnimationState.GROUND_PRONE)) {\n * // Handle ground position logic\n * }\n * ```\n *\n * @public\n * @korean 지면상태확인\n */\nexport function isGroundState(state: AnimationState): boolean {\n return state.startsWith(\"ground_\");\n}\n\n/**\n * Check if an animation state is a recovery animation state\n *\n * **Korean**: 회복 애니메이션 상태인지 확인\n *\n * Determines if the given animation state is one of the recovery/getup\n * animations.\n *\n * @param state - Animation state to check\n * @returns True if state is a recovery animation\n *\n * @example\n * ```typescript\n * if (isRecoveryState(AnimationState.RECOVERY_ROLL)) {\n * // Handle recovery animation logic\n * }\n * ```\n *\n * @public\n * @korean 회복상태확인\n */\nexport function isRecoveryState(state: AnimationState): boolean {\n return state.startsWith(\"recovery_\");\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../src/systems/animation/core/types.ts"],"sourcesContent":["/**\n * Animation system types for Black Trigram\n *\n * Defines animation states, configurations, and transition rules\n * for frame-accurate combat animations at 60fps.\n *\n * @module systems/animation/types\n * @category Animation\n * @korean 애니메이션시스템타입\n */\n\n/**\n * Animation states for player characters (애니메이션 상태)\n *\n * Enum-based animation state system for type safety and IDE autocomplete.\n * Each state includes Korean terminology and timing specifications.\n *\n * Based on game-design.md specifications:\n * - Attack: 12 frames (200ms at 60fps)\n * - Block: 4 frames (67ms at 60fps)\n * - Walk: 6 frames (100ms at 60fps)\n * - Stance transitions: 36 frames (600ms at 60fps)\n * - Tactical steps: 18 frames (300ms at 60fps, 30cm distance)\n *\n * @public\n * @korean 애니메이션상태\n */\nexport enum AnimationState {\n // ===== Basic Movement States (기본 이동 상태) =====\n\n /**\n * Idle stance - Default breathing animation\n * Korean: 대기 (daegi) - Standing ready\n * Duration: 4 frames (67ms)\n */\n IDLE = \"idle\",\n\n /**\n * Walk - Normal walking movement\n * Korean: 보행 (bohaeng) - Walking\n * Duration: 6 frames (100ms)\n */\n WALK = \"walk\",\n\n /**\n * Run - Fast movement animation\n * Korean: 달리기 (dalligi) - Running\n * Duration: 8 frames (133ms)\n */\n RUN = \"run\",\n\n // ===== Combat Actions (전투 행동) =====\n\n /**\n * Attack - Generic attack animation\n * Korean: 공격 (gonggyeok) - Attack\n * Duration: 12 frames (200ms)\n */\n ATTACK = \"attack\",\n\n /**\n * Defend - Basic block/defense\n * Korean: 방어 (bangeo) - Defense\n * Duration: 4 frames (67ms)\n */\n DEFEND = \"defend\",\n\n /**\n * Defend Block Success - Successful block, absorb impact\n * Korean: 막기 (makgi) - Block successfully\n * Duration: 8 frames (133ms)\n */\n DEFEND_BLOCK_SUCCESS = \"defend_block_success\",\n\n /**\n * Defend Parry - Parry deflection, redirect attack\n * Korean: 받아넘기기 (badaneumgigi) - Parry deflect\n * Duration: 10 frames (167ms)\n */\n DEFEND_PARRY = \"defend_parry\",\n\n /**\n * Defend Guard Break - Guard break, defensive stance destroyed\n * Korean: 방어붕괴 (bangeo bunggoe) - Guard broken\n * Duration: 15 frames (250ms)\n */\n DEFEND_GUARD_BREAK = \"defend_guard_break\",\n\n /**\n * Defend Recovery - Guard recovery, restore defensive posture\n * Korean: 방어복구 (bangeo bokgu) - Guard recovery\n * Duration: 12 frames (200ms)\n */\n DEFEND_RECOVERY = \"defend_recovery\",\n\n /**\n * Hit - Taking damage animation\n * Korean: 피격 (pigyeok) - Being hit\n * Duration: 4 frames (67ms)\n */\n HIT = \"hit\",\n\n /**\n * KO - Knockout/death animation\n * Korean: 기절 (gijeol) - Knockout\n * Duration: 30 frames (500ms)\n */\n KO = \"ko\",\n\n // ===== Stance Transitions (자세 전환) =====\n\n /**\n * Stance Change - Trigram stance transition\n * Korean: 자세변경 (jaseybyeongyeong) - Stance change\n * Duration: 36 frames (600ms)\n */\n STANCE_CHANGE = \"stance_change\",\n\n /**\n * Stance Side Switch - Left↔right stance mirror\n * Korean: 좌우전환 (jwaujeonhwan) - Left-right switch\n * Duration: 24 frames (400ms)\n */\n STANCE_SIDE_SWITCH = \"stance_side_switch\",\n\n // ===== Stance Guard Animations (팔괘 방어 자세) =====\n\n /**\n * Stance Guard Geon - ☰ Heaven stance guard\n * Korean: 건괘수비 (geon-goe subi) - Heaven guard\n * Duration: 6 frames (breathing loop)\n */\n STANCE_GUARD_GEON = \"stance_guard_geon\",\n\n /**\n * Stance Guard Tae - ☱ Lake stance guard\n * Korean: 태괘수비 (tae-goe subi) - Lake guard\n * Duration: 6 frames (breathing loop)\n */\n STANCE_GUARD_TAE = \"stance_guard_tae\",\n\n /**\n * Stance Guard Li - ☲ Fire stance guard\n * Korean: 리괘수비 (li-goe subi) - Fire guard\n * Duration: 4 frames (breathing loop)\n */\n STANCE_GUARD_LI = \"stance_guard_li\",\n\n /**\n * Stance Guard Jin - ☳ Thunder stance guard\n * Korean: 진괘수비 (jin-goe subi) - Thunder guard\n * Duration: 5 frames (breathing loop)\n */\n STANCE_GUARD_JIN = \"stance_guard_jin\",\n\n /**\n * Stance Guard Son - ☴ Wind stance guard\n * Korean: 손괘수비 (son-goe subi) - Wind guard\n * Duration: 6 frames (breathing loop)\n */\n STANCE_GUARD_SON = \"stance_guard_son\",\n\n /**\n * Stance Guard Gam - ☵ Water stance guard\n * Korean: 감괘수비 (gam-goe subi) - Water guard\n * Duration: 6 frames (breathing loop)\n */\n STANCE_GUARD_GAM = \"stance_guard_gam\",\n\n /**\n * Stance Guard Gan - ☶ Mountain stance guard\n * Korean: 간괘수비 (gan-goe subi) - Mountain guard\n * Duration: 4 frames (breathing loop)\n */\n STANCE_GUARD_GAN = \"stance_guard_gan\",\n\n /**\n * Stance Guard Gon - ☷ Earth stance guard\n * Korean: 곤괘수비 (gon-goe subi) - Earth guard\n * Duration: 5 frames (breathing loop)\n */\n STANCE_GUARD_GON = \"stance_guard_gon\",\n\n // ===== Tactical Step Movements (전술적 발걸음) =====\n\n /**\n * Step Forward - Forward tactical step\n * Korean: 전진보법 (jeonjin bobeop) - Forward step\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_FORWARD = \"step_forward\",\n\n /**\n * Step Back - Retreat tactical step\n * Korean: 후퇴보법 (hutoe bobeop) - Retreat step\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_BACK = \"step_back\",\n\n /**\n * Step Left - Left side tactical step\n * Korean: 좌측면보법 (jwacheuk myeon bobeop) - Left side step\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_LEFT = \"step_left\",\n\n /**\n * Step Right - Right side tactical step\n * Korean: 우측면보법 (ucheuk myeon bobeop) - Right side step\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_RIGHT = \"step_right\",\n\n /**\n * Step Forward Left - Forward-left diagonal step\n * Korean: 전좌측보법 (jeon jwacheuk bobeop) - Forward-left diagonal\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_FORWARD_LEFT = \"step_forward_left\",\n\n /**\n * Step Forward Right - Forward-right diagonal step\n * Korean: 전우측보법 (jeon ucheuk bobeop) - Forward-right diagonal\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_FORWARD_RIGHT = \"step_forward_right\",\n\n /**\n * Step Back Left - Back-left diagonal step\n * Korean: 후좌측보법 (hu jwacheuk bobeop) - Back-left diagonal\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_BACK_LEFT = \"step_back_left\",\n\n /**\n * Step Back Right - Back-right diagonal step\n * Korean: 후우측보법 (hu ucheuk bobeop) - Back-right diagonal\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_BACK_RIGHT = \"step_back_right\",\n\n // ===== Footwork Patterns (보법) =====\n\n /**\n * Footwork Circular Left - Circular step maintaining guard (left)\n * Korean: 원형보 좌 (wonhyeongbo jwa) - Circular step left\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n FOOTWORK_CIRCULAR_LEFT = \"footwork_circular_left\",\n\n /**\n * Footwork Circular Right - Circular step maintaining guard (right)\n * Korean: 원형보 우 (wonhyeongbo u) - Circular step right\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n FOOTWORK_CIRCULAR_RIGHT = \"footwork_circular_right\",\n\n /**\n * Footwork Pivot Left - Pivot rotation on planted foot (left)\n * Korean: 축족회전 좌 (chukjok hoejeon jwa) - Pivot rotation left\n * Duration: 15 frames (250ms), Rotation: 90°\n */\n FOOTWORK_PIVOT_LEFT = \"footwork_pivot_left\",\n\n /**\n * Footwork Pivot Right - Pivot rotation on planted foot (right)\n * Korean: 축족회전 우 (chukjok hoejeon u) - Pivot rotation right\n * Duration: 15 frames (250ms), Rotation: 90°\n */\n FOOTWORK_PIVOT_RIGHT = \"footwork_pivot_right\",\n\n /**\n * Footwork Slide Forward - Both feet slide together (forward)\n * Korean: 미끄럼보 전 (mikkeureombo jeon) - Sliding step forward\n * Duration: 12 frames (200ms), Distance: 30cm\n */\n FOOTWORK_SLIDE_FORWARD = \"footwork_slide_forward\",\n\n /**\n * Footwork Slide Back - Both feet slide together (back)\n * Korean: 미끄럼보 후 (mikkeureombo hu) - Sliding step back\n * Duration: 12 frames (200ms), Distance: 30cm\n */\n FOOTWORK_SLIDE_BACK = \"footwork_slide_back\",\n\n /**\n * Footwork Slide Left - Both feet slide together (left)\n * Korean: 미끄럼보 좌 (mikkeureombo jwa) - Sliding step left\n * Duration: 12 frames (200ms), Distance: 30cm\n */\n FOOTWORK_SLIDE_LEFT = \"footwork_slide_left\",\n\n /**\n * Footwork Slide Right - Both feet slide together (right)\n * Korean: 미끄럼보 우 (mikkeureombo u) - Sliding step right\n * Duration: 12 frames (200ms), Distance: 30cm\n */\n FOOTWORK_SLIDE_RIGHT = \"footwork_slide_right\",\n\n /**\n * Footwork Shuffle - Quick micro-adjustment\n * Korean: 섞음보 (seokkeumbo) - Shuffle step\n * Duration: 6 frames (100ms), Distance: 15cm\n */\n FOOTWORK_SHUFFLE = \"footwork_shuffle\",\n\n // ===== Fall Animations (낙법 애니메이션) =====\n\n /**\n * Fall Forward - Forward fall animation\n * Korean: 전방낙법 (jeonbang nakbeop) - Forward falling technique\n * Duration: 24 frames (400ms)\n */\n FALL_FORWARD = \"fall_forward\",\n\n /**\n * Fall Backward - Backward fall animation\n * Korean: 후방낙법 (hubang nakbeop) - Backward falling technique\n * Duration: 30 frames (500ms)\n */\n FALL_BACKWARD = \"fall_backward\",\n\n /**\n * Fall Side Left - Left side fall animation\n * Korean: 좌측낙법 (jwacheuk nakbeop) - Left side falling technique\n * Duration: 27 frames (450ms)\n */\n FALL_SIDE_LEFT = \"fall_side_left\",\n\n /**\n * Fall Side Right - Right side fall animation\n * Korean: 우측낙법 (ucheuk nakbeop) - Right side falling technique\n * Duration: 27 frames (450ms)\n */\n FALL_SIDE_RIGHT = \"fall_side_right\",\n\n // ===== Ground States (지면 자세) =====\n\n /**\n * Ground Prone - Face-down ground position\n * Korean: 엎드림 (eopdeurim) - Face down position\n * Duration: 4 frames (breathing loop)\n */\n GROUND_PRONE = \"ground_prone\",\n\n /**\n * Ground Supine - Face-up ground position\n * Korean: 누움 (nuum) - Face up position\n * Duration: 4 frames (breathing loop)\n */\n GROUND_SUPINE = \"ground_supine\",\n\n /**\n * Ground Side Left - Left side ground position\n * Korean: 좌측와 (jwacheuk wa) - Left side position\n * Duration: 4 frames (breathing loop)\n */\n GROUND_SIDE_LEFT = \"ground_side_left\",\n\n /**\n * Ground Side Right - Right side ground position\n * Korean: 우측와 (ucheuk wa) - Right side position\n * Duration: 4 frames (breathing loop)\n */\n GROUND_SIDE_RIGHT = \"ground_side_right\",\n\n // ===== Turn Animations (180도 회전) =====\n\n /**\n * Turn Left - 180° turn left animation\n * Korean: 좌회전 (jwahoejeon) - Left turn\n * Duration: 12 frames (200ms), Rotation: 180°\n */\n TURN_LEFT = \"turn_left\",\n\n /**\n * Turn Right - 180° turn right animation\n * Korean: 우회전 (uhoejeon) - Right turn\n * Duration: 12 frames (200ms), Rotation: 180°\n */\n TURN_RIGHT = \"turn_right\",\n\n // ===== Recovery Animations (회복 애니메이션) =====\n\n /**\n * Recovery Prone Standup - Stand up from prone position\n * Korean: 엎드린 기상 (eopdeurin gisang) - Prone stand-up\n * Duration: 30 frames (500ms)\n */\n RECOVERY_PRONE_STANDUP = \"recovery_prone_standup\",\n\n /**\n * Recovery Supine Standup - Stand up from supine position\n * Korean: 누운 기상 (nuun gisang) - Supine stand-up\n * Duration: 36 frames (600ms)\n */\n RECOVERY_SUPINE_STANDUP = \"recovery_supine_standup\",\n\n /**\n * Recovery Roll - Roll recovery to standing\n * Korean: 회전기상 (hoejeon gisang) - Roll recovery\n * Duration: 24 frames (400ms), Stamina cost: 20\n */\n RECOVERY_ROLL = \"recovery_roll\",\n\n /**\n * Recovery Defensive - Defensive getup with guard\n * Korean: 방어기상 (bangeo gisang) - Defensive getup\n * Duration: 42 frames (700ms), Damage reduction: 50%\n */\n RECOVERY_DEFENSIVE = \"recovery_defensive\",\n\n // ===== Grappling Animations (잡기 애니메이션) =====\n\n /**\n * Grapple Entry - Establish grip connection\n * Korean: 잡기 연결 (japgi yeongyeol) - Grab connection\n * Duration: 8 frames (133ms)\n *\n * Initiates the grappling sequence when attacker successfully grabs defender.\n * Transition from IDLE/ATTACK state to establishing physical control.\n */\n GRAPPLE_ENTRY = \"grapple_entry\",\n\n /**\n * Grapple Control - Maintain grip control\n * Korean: 잡기 유지 (japgi yuji) - Maintaining grip\n * Duration: Loop (breathing animation ~4 frames)\n *\n * Active control state where attacker maintains grip on defender.\n * Looping animation with subtle struggle movements.\n * Stamina cost: 5/second (default)\n */\n GRAPPLE_CONTROL = \"grapple_control\",\n\n /**\n * Grapple Struggle - Escape attempt animation\n * Korean: 탈출 시도 (talchul sido) - Escape attempts\n * Duration: 12 frames (200ms)\n *\n * Defender animation when attempting to break free from grapple.\n * Shows strain and resistance movements.\n * Stamina cost: 15 per attempt\n */\n GRAPPLE_STRUGGLE = \"grapple_struggle\",\n\n /**\n * Grapple Escape - Successful escape from grapple\n * Korean: 탈출 성공 (talchul seonggong) - Successful escape\n * Duration: 15 frames (250ms)\n *\n * Defender breaks free and creates distance from attacker.\n * Returns to IDLE state upon completion.\n * Provides invulnerability frames during escape animation.\n */\n GRAPPLE_ESCAPE = \"grapple_escape\",\n}\n\n/**\n * Animation priority levels for interrupt system\n *\n * Higher priority animations can interrupt lower priority ones.\n * Priority order: recovery > fall > ko > hit > attack > defend > step > stance_change > movement > idle\n *\n * Steps are non-interruptible (same priority as attacks) to ensure commitment\n * to tactical repositioning in Korean martial arts.\n * Recovery animations have highest priority to allow getting up from ground.\n *\n * @public\n * @korean 애니메이션우선순위\n */\nexport enum AnimationPriority {\n IDLE = 0,\n WALK = 1,\n RUN = 2,\n STANCE_CHANGE = 3,\n DEFEND = 4,\n ATTACK = 5, // STEP shares ATTACK priority (both non-interruptible)\n HIT = 6,\n KO = 7,\n FALL = 8,\n RECOVERY = 9,\n}\n\n// Step animations use ATTACK priority (5) - both are non-interruptible\nexport const STEP_PRIORITY = AnimationPriority.ATTACK;\n\n/**\n * Defensive animation types for guard break and defensive stance mechanics.\n *\n * **Korean Terminology**:\n * - block_success: 막기 (makgi) - Successful block, absorb impact\n * - parry_deflect: 받아넘기기 (badaneumgigi) - Parry deflection, redirect attack\n * - guard_break: 방어붕괴 (bangeo bunggoe) - Guard break, defensive stance destroyed\n * - guard_recovery: 방어복구 (bangeo bokgu) - Guard recovery, restore defensive posture\n *\n * @public\n * @korean 방어애니메이션타입\n */\nexport type DefensiveAnimationType =\n | \"block_success\"\n | \"parry_deflect\"\n | \"guard_break\"\n | \"guard_recovery\";\n\n/**\n * Animation configuration for a single animation state\n *\n * Frame counts based on game-design.md:\n * - Attack: 12 frames (200ms at 60fps)\n * - Block: 4 frames (67ms at 60fps)\n * - Walk: 6 frames\n *\n * Extended with defensive animation support:\n * - Block Success: 8 frames (133ms)\n * - Parry Deflect: 10 frames (167ms)\n * - Guard Break: 15 frames (250ms)\n * - Guard Recovery: 12 frames (200ms)\n *\n * @public\n * @korean 애니메이션설정\n */\nexport interface AnimationConfig {\n /**\n * Animation state identifier\n * @korean 상태\n */\n readonly state: AnimationState;\n\n /**\n * Total number of frames in animation\n * @korean 프레임수\n */\n readonly frames: number;\n\n /**\n * Target frames per second (typically 60)\n * @korean 초당프레임\n */\n readonly fps: number;\n\n /**\n * Whether animation loops continuously\n * @korean 반복여부\n */\n readonly loop: boolean;\n\n /**\n * Whether animation can be interrupted by higher priority animations\n * @korean 중단가능여부\n */\n readonly interruptible: boolean;\n\n /**\n * Animation priority for interrupt system\n * @korean 우선순위\n */\n readonly priority: AnimationPriority;\n\n /**\n * Duration in seconds (calculated from frames/fps)\n * @korean 지속시간\n */\n readonly duration: number;\n\n /**\n * Counter-attack window in seconds (for parry animations)\n * Creates an opportunity window for immediate counter-attacks after successful parry.\n * @korean 반격시간\n */\n readonly counterWindow?: number;\n\n /**\n * Vulnerability window duration in seconds (for guard break animations)\n * Extended vulnerability period where defender takes increased damage.\n * @korean 취약시간\n */\n readonly vulnerabilityDuration?: number;\n\n /**\n * Easing function for smooth animation transitions\n *\n * **Korean**: 이징 함수\n *\n * Specifies the easing curve for this animation's transitions.\n * Uses cubic bezier presets for natural Korean martial arts movement.\n *\n * @korean 이징함수\n */\n readonly easing?:\n | \"linear\"\n | \"ease-in\"\n | \"ease-out\"\n | \"ease-in-out\"\n | \"natural-motion\"\n | \"smooth-transition\"\n | \"quick-start\"\n | \"explosive-power\"\n | \"controlled-slow\";\n}\n\n/**\n * Mutable version of AnimationConfig for internal state machine use.\n * Allows dynamic frame/duration updates for technique-specific timing.\n *\n * @internal\n * @korean 가변애니메이션설정\n */\nexport type MutableAnimationConfig = {\n -readonly [K in keyof AnimationConfig]: AnimationConfig[K];\n};\n\n/**\n * Animation event callback types\n *\n * @public\n * @korean 애니메이션이벤트\n */\nexport interface AnimationEvents {\n /**\n * Called when animation starts\n * @korean 시작이벤트\n */\n readonly onAnimationStart?: (state: AnimationState) => void;\n\n /**\n * Called on specific frame numbers\n * @korean 프레임이벤트\n */\n readonly onFrame?: (frame: number, state: AnimationState) => void;\n\n /**\n * Called when animation completes\n * @korean 완료이벤트\n */\n readonly onAnimationComplete?: (state: AnimationState) => void;\n\n /**\n * Called when animation is interrupted\n * @korean 중단이벤트\n */\n readonly onAnimationInterrupted?: (\n fromState: AnimationState,\n toState: AnimationState,\n ) => void;\n}\n\n/**\n * Animation state machine state\n *\n * @public\n * @korean 애니메이션상태머신상태\n */\nexport interface AnimationMachineState {\n /**\n * Current animation state\n * @korean 현재상태\n */\n readonly currentState: AnimationState;\n\n /**\n * Current frame index (0 to frames-1)\n * @korean 현재프레임\n */\n readonly frameIndex: number;\n\n /**\n * Time accumulator for frame timing\n * @korean 시간누적\n */\n readonly timeAccumulator: number;\n\n /**\n * Whether animation is playing\n * @korean 재생중\n */\n readonly isPlaying: boolean;\n\n /**\n * Previous animation state\n * @korean 이전상태\n */\n readonly previousState: AnimationState | null;\n}\n\n/**\n * Animation transition rule\n *\n * @public\n * @korean 애니메이션전환규칙\n */\nexport interface TransitionRule {\n /**\n * Source animation state\n * @korean 시작상태\n */\n readonly from: AnimationState;\n\n /**\n * Target animation state\n * @korean 목표상태\n */\n readonly to: AnimationState;\n\n /**\n * Whether transition is allowed\n * @korean 허용여부\n */\n readonly allowed: boolean;\n\n /**\n * Optional condition function\n * @korean 조건함수\n */\n readonly condition?: () => boolean;\n}\n\n/**\n * Result of an animation update\n *\n * @public\n * @korean 애니메이션업데이트결과\n */\nexport interface AnimationUpdateResult {\n /**\n * Current animation state\n * @korean 현재상태\n */\n readonly state: AnimationState;\n\n /**\n * Current frame index\n * @korean 현재프레임\n */\n readonly frame: number;\n\n /**\n * Animation progress (0-1)\n * @korean 진행률\n */\n readonly progress: number;\n\n /**\n * Whether animation just completed this frame\n * @korean 완료여부\n */\n readonly justCompleted: boolean;\n\n /**\n * Whether animation just started this frame\n * @korean 시작여부\n */\n readonly justStarted: boolean;\n}\n\n/**\n * Step direction for tactical movement\n *\n * Eight directions for tactical stepping (전술적 발놀림):\n * - forward: 전진보법 (Jeonjin Bobeop) - Forward step\n * - back: 후퇴보법 (Hutoe Bobeop) - Retreat step\n * - left: 좌측면보법 (Jwacheuk Myeon Bobeop) - Left side step\n * - right: 우측면보법 (Ucheuk Myeon Bobeop) - Right side step\n * - forward_left: 전좌측보법 (Jeon Jwacheuk Bobeop) - Forward-left diagonal\n * - forward_right: 전우측보법 (Jeon Ucheuk Bobeop) - Forward-right diagonal\n * - back_left: 후좌측보법 (Hu Jwacheuk Bobeop) - Back-left diagonal\n * - back_right: 후우측보법 (Hu Ucheuk Bobeop) - Back-right diagonal\n *\n * Each step moves exactly 30cm (one foot width) for tactical repositioning\n * in Korean martial arts combat.\n *\n * @public\n * @korean 발걸음방향\n */\nexport type StepDirection =\n | \"forward\"\n | \"back\"\n | \"left\"\n | \"right\"\n | \"forward_left\"\n | \"forward_right\"\n | \"back_left\"\n | \"back_right\";\n\n/**\n * Step animation configuration\n *\n * Defines keyframes for tactical step movements with:\n * - Weight transfer from back foot to front foot\n * - Foot lift and placement\n * - Guard position maintenance\n * - 30cm distance movement\n * - 300ms duration (18 frames at 60fps)\n *\n * @public\n * @korean 발걸음애니메이션설정\n */\nexport interface StepConfig extends AnimationConfig {\n /**\n * Step direction\n * @korean 방향\n */\n readonly direction: StepDirection;\n\n /**\n * Distance moved in meters (always 0.3m = 30cm)\n * @korean 이동거리\n */\n readonly distance: number;\n\n /**\n * Whether guard position is maintained during step\n * @korean 방어자세유지\n */\n readonly maintainsGuard: boolean;\n\n /**\n * Stamina cost for this step\n * @korean 체력소모\n */\n readonly staminaCost: number;\n}\n\n/**\n * Step keyframe data for animation interpolation\n *\n * Defines weight distribution, foot positions, and body center of gravity\n * at specific frames during the step animation.\n *\n * @public\n * @korean 발걸음키프레임\n */\nexport interface StepKeyframe {\n /**\n * Frame number (0-17 for 18-frame step)\n * @korean 프레임번호\n */\n readonly frame: number;\n\n /**\n * Weight distribution (0 = fully on back foot, 1 = fully on front foot)\n * @korean 체중분배\n */\n readonly weight: number;\n\n /**\n * Front foot position offset from start (0-1, where 1 = full step distance)\n * @korean 앞발위치\n */\n readonly frontFootOffset: number;\n\n /**\n * Back foot position offset from start (0-1)\n * @korean 뒷발위치\n */\n readonly backFootOffset: number;\n\n /**\n * Vertical lift of front foot in meters\n * @korean 앞발들어올림\n */\n readonly frontFootLift: number;\n\n /**\n * Body center of gravity height offset\n * @korean 무게중심높이\n */\n readonly cogHeight: number;\n}\n\n/**\n * Fall direction types for knockdown animations\n *\n * Determines which fall animation to play based on attack direction,\n * balance loss, or consciousness failure.\n *\n * Korean terminology:\n * - forward: 전방낙법 (Jeonbang Nakbeop) - Forward falling technique\n * - backward: 후방낙법 (Hubang Nakbeop) - Backward falling technique\n * - side_left: 좌측낙법 (Jwacheuk Nakbeop) - Left side falling technique\n * - side_right: 우측낙법 (Ucheuk Nakbeop) - Right side falling technique\n *\n * @public\n * @korean 낙법유형\n */\nexport type FallType = \"forward\" | \"backward\" | \"side_left\" | \"side_right\";\n\n/**\n * Ground position states after falling\n *\n * Represents the character's position on the ground after a fall.\n * Each state has a looping breathing animation.\n *\n * Korean terminology:\n * - prone: 엎드림 (Eopdeurim) - Face down position\n * - supine: 누움 (Nuum) - Face up position\n * - side_left: 좌측와 (Jwacheuk Wa) - Left side position\n * - side_right: 우측와 (Ucheuk Wa) - Right side position\n *\n * @public\n * @korean 지면자세\n */\nexport type GroundState = \"prone\" | \"supine\" | \"side_left\" | \"side_right\";\n\n/**\n * Maps fall types to corresponding ground states\n *\n * @public\n * @korean 낙법지면맵\n */\nexport const FALL_TO_GROUND_MAP: Record<FallType, GroundState> = {\n forward: \"prone\",\n backward: \"supine\",\n side_left: \"side_left\",\n side_right: \"side_right\",\n};\n\n/**\n * Maps fall types to corresponding animation states\n *\n * @public\n * @korean 낙법애니메이션맵\n */\nexport const FALL_TYPE_TO_ANIMATION: Record<FallType, AnimationState> = {\n forward: AnimationState.FALL_FORWARD,\n backward: AnimationState.FALL_BACKWARD,\n side_left: AnimationState.FALL_SIDE_LEFT,\n side_right: AnimationState.FALL_SIDE_RIGHT,\n};\n\n/**\n * Maps ground states to corresponding animation states\n *\n * @public\n * @korean 지면애니메이션맵\n */\nexport const GROUND_STATE_TO_ANIMATION: Record<GroundState, AnimationState> = {\n prone: AnimationState.GROUND_PRONE,\n supine: AnimationState.GROUND_SUPINE,\n side_left: AnimationState.GROUND_SIDE_LEFT,\n side_right: AnimationState.GROUND_SIDE_RIGHT,\n};\n\n/**\n * Body facing direction system state\n *\n * Manages automatic character rotation to face opponent with:\n * - Smooth torso rotation (45°/sec, ±90° range)\n * - Independent head tracking (±45° range)\n * - 180° turn animations for repositioning\n * - Facing lock during attack/defend animations\n *\n * Korean terminology:\n * - 정면향하기 (Jeongmyeon Hyanghagi) - Face forward\n * - 몸회전 (Mom Hoejeon) - Body rotation\n * - 머리추적 (Meori Chujok) - Head tracking\n * - 180도회전 (180-do Hoejeon) - 180-degree turn\n *\n * @public\n * @korean 몸향하기상태\n */\nexport interface BodyFacing {\n /**\n * Current facing direction in degrees (0-360)\n * - 0° = facing right (+X axis)\n * - 90° = facing down (+Z axis)\n * - 180° = facing left (-X axis)\n * - 270° = facing up (-Z axis)\n *\n * @korean 현재각도\n */\n readonly currentAngle: number;\n\n /**\n * Desired facing direction in degrees (0-360)\n * Typically pointing toward opponent position\n *\n * @korean 목표각도\n */\n readonly targetAngle: number;\n\n /**\n * Rotation speed in degrees per second\n * Default: 45°/sec for smooth, realistic rotation\n *\n * @korean 회전속도\n */\n readonly rotationSpeed: number;\n\n /**\n * Head rotation offset relative to torso (-45° to +45°)\n * Head can track independently within limited range\n * - Positive = head turned right\n * - Negative = head turned left\n *\n * @korean 머리회전각도\n */\n readonly headAngleOffset: number;\n\n /**\n * Whether facing direction is locked\n * True during attack/defend animations to lock attack direction\n * False during idle/movement to allow dynamic tracking\n *\n * @korean 회전잠금\n */\n readonly isLocked: boolean;\n\n /**\n * Whether character is currently executing a 180° turn animation\n * Used to prevent movement and other actions during repositioning\n *\n * @korean 180도회전중\n */\n readonly isTurning: boolean;\n\n /**\n * Direction of current 180° turn ('left' or 'right')\n * Determines which turn animation to play\n *\n * @korean 회전방향\n */\n readonly turnDirection?: \"left\" | \"right\";\n\n /**\n * Timestamp when 180° turn animation started\n * Used to track turn animation progress (200ms duration)\n *\n * @korean 회전시작시간\n */\n readonly turnStartTime?: number;\n\n /**\n * Torso rotation relative to hips in radians\n * Range: ±π/2 (±90°) for anatomically correct movement\n * - Positive = torso rotated right relative to hips\n * - Negative = torso rotated left relative to hips\n *\n * @korean 허리회전 (Heorhwoejeon)\n */\n readonly torsoRotation?: number;\n\n /**\n * Hip/pelvis rotation in radians (lower body facing direction)\n * Base rotation for the lower body, torsoRotation is relative to this\n *\n * @korean 골반회전 (Golbanhwoejeon)\n */\n readonly hipRotation?: number;\n}\n\n/**\n * Torso rotation state for independent upper/lower body movement\n *\n * Manages realistic torso rotation allowing upper body to face opponent\n * while lower body moves in different direction (strafing).\n *\n * Korean terminology:\n * - 허리회전 (Heorhwoejeon) - Torso rotation\n * - 상체비틀기 (Sangchebiteulgi) - Upper body twist\n * - 골반고정 (Golbangojeong) - Hip stabilization\n *\n * @public\n * @korean 허리회전상태\n */\nexport interface TorsoRotationState {\n /**\n * Current torso Y-axis rotation in radians\n * Range: ±π/2 (±90°) relative to hip direction\n *\n * @korean 현재회전\n */\n readonly currentRotation: number;\n\n /**\n * Target rotation towards opponent in radians\n * Smoothly interpolated to currentRotation\n *\n * @korean 목표회전\n */\n readonly targetRotation: number;\n\n /**\n * Lower body (hip/pelvis) rotation in radians\n * Base rotation for movement direction\n *\n * @korean 골반회전\n */\n readonly hipRotation: number;\n\n /**\n * Interpolation speed in seconds\n * Default: 0.2 (200ms for smooth rotation)\n *\n * @korean 보간속도\n */\n readonly interpolationSpeed: number;\n}\n\n/**\n * Footwork pattern types for Korean martial arts (보법)\n *\n * Four specialized footwork patterns based on traditional Korean martial arts:\n * - circular: 원형보 (Wonhyeongbo) - Circular stepping while maintaining guard facing\n * - pivot: 축족회전 (Chukjok Hoejeon) - Pivot rotation on planted foot\n * - slide: 미끄럼보 (Mikkeureombo) - Sliding step with both feet moving together\n * - shuffle: 섞음보 (Seokkeumbo) - Quick shuffling micro-adjustment\n *\n * Each pattern serves distinct tactical purposes in combat:\n * - Circular: Lateral repositioning while keeping opponent in guard\n * - Pivot: Fast direction changes on planted foot\n * - Slide: Maintaining stable base while advancing/retreating\n * - Shuffle: Fine-tuning position without commitment\n *\n * @public\n * @korean 보법유형\n */\nexport type FootworkPattern = \"circular\" | \"pivot\" | \"slide\" | \"shuffle\";\n\n/**\n * Footwork direction for directional patterns\n *\n * @public\n * @korean 보법방향\n */\nexport type FootworkDirection = \"left\" | \"right\" | \"forward\" | \"back\";\n\n/**\n * Korean terminology for footwork patterns\n *\n * Maps each footwork pattern to its Korean martial arts terminology\n * with romanization and English translation.\n *\n * @public\n * @korean 보법한글용어\n */\nexport const FOOTWORK_KOREAN_TERMS: Record<\n FootworkPattern,\n { korean: string; romanized: string; english: string }\n> = {\n circular: {\n korean: \"원형보\",\n romanized: \"Wonhyeongbo\",\n english: \"Circular Step\",\n },\n pivot: {\n korean: \"축족회전\",\n romanized: \"Chukjok Hoejeon\",\n english: \"Pivot Rotation\",\n },\n slide: {\n korean: \"미끄럼보\",\n romanized: \"Mikkeureombo\",\n english: \"Sliding Step\",\n },\n shuffle: {\n korean: \"섞음보\",\n romanized: \"Seokkeumbo\",\n english: \"Shuffle Step\",\n },\n};\n\n/**\n * Recovery animation types for getting up from ground states\n *\n * Korean terminology:\n * - prone_standup: 엎드린 기상 (Eopdeurin Gisang) - Stand up from prone\n * - supine_standup: 누운 기상 (Nuun Gisang) - Stand up from supine\n * - roll: 회전기상 (Hoejeon Gisang) - Roll recovery\n * - defensive: 방어기상 (Bangeo Gisang) - Defensive getup\n *\n * @public\n * @korean 회복애니메이션유형\n */\nexport type RecoveryAnimationType =\n | \"prone_standup\"\n | \"supine_standup\"\n | \"roll_recovery\"\n | \"defensive_getup\";\n\n/**\n * Korean terminology for recovery animations\n *\n * Maps each recovery type to its Korean martial arts terminology\n * with romanization and English translation.\n *\n * @public\n * @korean 회복한글용어\n */\nexport const RECOVERY_KOREAN_TERMS: Record<\n RecoveryAnimationType,\n { korean: string; romanized: string; english: string }\n> = {\n prone_standup: {\n korean: \"엎드린 기상\",\n romanized: \"Eopdeurin Gisang\",\n english: \"Prone Stand-Up\",\n },\n supine_standup: {\n korean: \"누운 기상\",\n romanized: \"Nuun Gisang\",\n english: \"Supine Stand-Up\",\n },\n roll_recovery: {\n korean: \"회전기상\",\n romanized: \"Hoejeon Gisang\",\n english: \"Roll Recovery\",\n },\n defensive_getup: {\n korean: \"방어기상\",\n romanized: \"Bangeo Gisang\",\n english: \"Defensive Getup\",\n },\n};\n\n/**\n * Maps ground states to their default recovery animation\n *\n * @public\n * @korean 지면회복맵\n */\nexport const GROUND_STATE_TO_RECOVERY: Record<\n GroundState,\n RecoveryAnimationType\n> = {\n prone: \"prone_standup\",\n supine: \"supine_standup\",\n side_left: \"roll_recovery\", // Side positions use roll by default\n side_right: \"roll_recovery\",\n};\n\n/**\n * Maps recovery types to their animation states\n *\n * @public\n * @korean 회복애니메이션맵\n */\nexport const RECOVERY_TYPE_TO_ANIMATION: Record<\n RecoveryAnimationType,\n AnimationState\n> = {\n prone_standup: AnimationState.RECOVERY_PRONE_STANDUP,\n supine_standup: AnimationState.RECOVERY_SUPINE_STANDUP,\n roll_recovery: AnimationState.RECOVERY_ROLL,\n defensive_getup: AnimationState.RECOVERY_DEFENSIVE,\n};\n\n/**\n * Technique intensity levels for animation speed and impact\n *\n * **Korean**: 기술 강도 레벨\n *\n * Determines animation speed modifier and visual impact effects:\n * - light: Fast techniques (1.2x speed), lower damage\n * - medium: Normal techniques (1.0x speed), standard damage\n * - heavy: Powerful techniques (0.8x speed), high damage\n * - critical: Maximum power (0.6x speed), critical damage\n *\n * @public\n * @category Animation\n * @korean 기술강도\n */\nexport type TechniqueIntensity = \"light\" | \"medium\" | \"heavy\" | \"critical\";\n\n/**\n * Technique type categories for animation selection\n *\n * **Korean**: 기술 유형\n *\n * Core technique categories that determine base animation style:\n * - strike: Direct striking attacks (punches, palm strikes)\n * - joint: Joint manipulation and locks\n * - throw: Throwing and sweeping techniques\n * - pressure_point: Precise vital point strikes\n *\n * @public\n * @category Combat\n * @korean 기술타입\n */\nexport type TechniqueTypeCategory =\n | \"strike\"\n | \"joint\"\n | \"throw\"\n | \"pressure_point\";\n\n/**\n * Composite key for technique animation lookup\n *\n * **Korean**: 기술 애니메이션 키\n *\n * Combines stance, technique type, target body part, and intensity\n * to uniquely identify the appropriate animation to play.\n *\n * @example\n * ```typescript\n * const key: TechniqueAnimationKey = {\n * stance: TrigramStance.GEON,\n * techniqueType: 'strike',\n * bodyPart: BodyPart.HEAD,\n * intensity: 'heavy',\n * };\n * ```\n *\n * @public\n * @category Animation\n * @korean 기술애니메이션키\n */\nexport interface TechniqueAnimationKey {\n /** Trigram stance (8 stances) */\n readonly stance: string;\n /** Technique category */\n readonly techniqueType: TechniqueTypeCategory;\n /** Target body part */\n readonly bodyPart: string;\n /** Attack intensity level */\n readonly intensity: TechniqueIntensity;\n}\n\n/**\n * Complete technique animation configuration\n *\n * **Korean**: 기술 애니메이션 설정\n *\n * Defines all properties needed to execute a technique animation,\n * including timing, impact frame, Korean terminology, and priority.\n *\n * @example\n * ```typescript\n * const animation: TechniqueAnimation = {\n * animationState: AnimationState.ATTACK,\n * duration: 0.8,\n * impactFrame: 12,\n * recoveryFrames: 15,\n * priority: 8,\n * koreanName: '건괘 두부 강 타격',\n * englishName: 'Heaven Stance Head Strike',\n * };\n * ```\n *\n * @public\n * @category Animation\n * @korean 기술애니메이션\n */\nexport interface TechniqueAnimation {\n /** Animation state to play */\n readonly animationState: AnimationState;\n /** Duration in seconds */\n readonly duration: number;\n /** Frame number where hit lands (0-indexed) */\n readonly impactFrame: number;\n /** Number of recovery frames after impact */\n readonly recoveryFrames: number;\n /** Animation priority for interrupt system */\n readonly priority: AnimationPriority;\n /** Korean technique name */\n readonly koreanName: string;\n /** English technique name */\n readonly englishName: string;\n\n // ===== Advanced Joint Movement Properties (고급 관절 동작) =====\n\n /**\n * Torso rotation angle in radians relative to hips\n *\n * **Korean**: 허리회전 (Heorhwoejeon)\n *\n * Range: -π/2 to π/2 (-90° to 90°)\n * Used for independent upper/lower body movement\n *\n * @korean 허리회전각도\n */\n readonly torsoRotation?: number;\n\n /**\n * Hip rotation engagement factor (0-1)\n *\n * **Korean**: 골반회전 참여도 (Golbanhwoejeon Chamyeodo)\n *\n * - 0.0: No hip engagement (isolated technique)\n * - 0.3: Minimal hip involvement\n * - 0.6: Moderate hip rotation\n * - 1.0: Full hip engagement (maximum power)\n *\n * Contributes 10-30% damage bonus based on technique type\n *\n * @korean 골반회전도\n */\n readonly hipEngagement?: number;\n\n /**\n * Power modifier from hip rotation (calculated)\n *\n * **Korean**: 파워배율 (Pawo Baeyul)\n *\n * Multiplier applied to technique damage (1.0-1.3)\n * Calculated from hipEngagement and techniqueType\n *\n * @korean 파워배율\n */\n readonly powerModifier?: number;\n}\n\n/**\n * Validation result for technique animation mapping completeness\n *\n * **Korean**: 기술 애니메이션 매핑 검증 결과\n *\n * Reports coverage percentage and lists any missing mappings\n * that need to be filled in.\n *\n * @public\n * @category Animation\n * @korean 매핑검증결과\n */\nexport interface MappingValidationResult {\n /** Coverage percentage (0-100) */\n readonly coverage: number;\n /** Total combinations expected */\n readonly total: number;\n /** Number of mapped combinations */\n readonly mapped: number;\n /** List of missing combinations */\n readonly missing: readonly TechniqueAnimationKey[];\n}\n\n// ===== Backward Compatibility Helpers (하위 호환성 도우미) =====\n\n/**\n * Convert string to AnimationState enum (backward compatibility)\n *\n * **Korean**: 문자열을 애니메이션 상태로 변환\n *\n * Provides backward compatibility for code using string-based animation states.\n * Returns null if the string doesn't match any valid animation state.\n *\n * @param state - String representation of animation state\n * @returns AnimationState enum or null if invalid\n *\n * @example\n * ```typescript\n * const state = stringToAnimationState(\"idle\"); // AnimationState.IDLE\n * const invalid = stringToAnimationState(\"invalid\"); // null\n * ```\n *\n * @public\n * @korean 문자열을애니메이션상태로변환\n */\nexport function stringToAnimationState(state: string): AnimationState | null {\n const normalized = state.toLowerCase();\n\n // Check if the normalized string is a valid AnimationState enum value\n const values = Object.values(AnimationState) as string[];\n if (values.includes(normalized)) {\n return normalized as AnimationState;\n }\n\n return null;\n}\n\n/**\n * Check if a value is a valid AnimationState enum\n *\n * **Korean**: 유효한 애니메이션 상태인지 확인\n *\n * Type guard to validate that a value is a valid AnimationState enum value.\n *\n * @param value - Value to check\n * @returns True if value is a valid AnimationState\n *\n * @example\n * ```typescript\n * if (isValidAnimationState(someValue)) {\n * // TypeScript knows someValue is AnimationState here\n * machine.transitionTo(someValue);\n * }\n * ```\n *\n * @public\n * @korean 유효한애니메이션상태확인\n */\nexport function isValidAnimationState(value: unknown): value is AnimationState {\n if (typeof value !== \"string\") {\n return false;\n }\n\n const values = Object.values(AnimationState) as string[];\n return values.includes(value);\n}\n\n/**\n * Get all animation state enum values as an array\n *\n * **Korean**: 모든 애니메이션 상태 값 배열\n *\n * Returns an array of all valid AnimationState enum values.\n * Useful for iteration, validation, and testing.\n *\n * @returns Array of all AnimationState values\n *\n * @example\n * ```typescript\n * const allStates = getAllAnimationStates();\n * allStates.forEach(state => {\n * console.log(`State: ${state}`);\n * });\n * ```\n *\n * @public\n * @korean 모든애니메이션상태가져오기\n */\nexport function getAllAnimationStates(): AnimationState[] {\n return Object.values(AnimationState);\n}\n\n/**\n * Check if an animation state is a stance guard state\n *\n * **Korean**: 자세 방어 상태인지 확인\n *\n * Determines if the given animation state is one of the eight trigram\n * stance guard animations.\n *\n * @param state - Animation state to check\n * @returns True if state is a stance guard animation\n *\n * @example\n * ```typescript\n * if (isStanceGuardState(AnimationState.STANCE_GUARD_GEON)) {\n * // Handle stance guard logic\n * }\n * ```\n *\n * @public\n * @korean 자세방어상태확인\n */\nexport function isStanceGuardState(state: AnimationState): boolean {\n return state.startsWith(\"stance_guard_\");\n}\n\n/**\n * Check if an animation state is a step movement state\n *\n * **Korean**: 발걸음 이동 상태인지 확인\n *\n * Determines if the given animation state is one of the tactical step\n * movement animations.\n *\n * @param state - Animation state to check\n * @returns True if state is a step movement animation\n *\n * @example\n * ```typescript\n * if (isStepState(AnimationState.STEP_FORWARD)) {\n * // Handle step movement logic\n * }\n * ```\n *\n * @public\n * @korean 발걸음상태확인\n */\nexport function isStepState(state: AnimationState): boolean {\n return state.startsWith(\"step_\");\n}\n\n/**\n * Check if an animation state is a footwork pattern state\n *\n * **Korean**: 보법 패턴 상태인지 확인\n *\n * Determines if the given animation state is one of the specialized\n * Korean martial arts footwork patterns.\n *\n * @param state - Animation state to check\n * @returns True if state is a footwork pattern animation\n *\n * @example\n * ```typescript\n * if (isFootworkState(AnimationState.FOOTWORK_CIRCULAR_LEFT)) {\n * // Handle footwork pattern logic\n * }\n * ```\n *\n * @public\n * @korean 보법상태확인\n */\nexport function isFootworkState(state: AnimationState): boolean {\n return state.startsWith(\"footwork_\");\n}\n\n/**\n * Check if an animation state is a fall animation state\n *\n * **Korean**: 낙법 애니메이션 상태인지 확인\n *\n * Determines if the given animation state is one of the fall animations.\n *\n * @param state - Animation state to check\n * @returns True if state is a fall animation\n *\n * @example\n * ```typescript\n * if (isFallState(AnimationState.FALL_FORWARD)) {\n * // Handle fall animation logic\n * }\n * ```\n *\n * @public\n * @korean 낙법상태확인\n */\nexport function isFallState(state: AnimationState): boolean {\n return state.startsWith(\"fall_\");\n}\n\n/**\n * Check if an animation state is a ground position state\n *\n * **Korean**: 지면 자세 상태인지 확인\n *\n * Determines if the given animation state is one of the ground position\n * breathing loops.\n *\n * @param state - Animation state to check\n * @returns True if state is a ground position animation\n *\n * @example\n * ```typescript\n * if (isGroundState(AnimationState.GROUND_PRONE)) {\n * // Handle ground position logic\n * }\n * ```\n *\n * @public\n * @korean 지면상태확인\n */\nexport function isGroundState(state: AnimationState): boolean {\n return state.startsWith(\"ground_\");\n}\n\n/**\n * Check if an animation state is a recovery animation state\n *\n * **Korean**: 회복 애니메이션 상태인지 확인\n *\n * Determines if the given animation state is one of the recovery/getup\n * animations.\n *\n * @param state - Animation state to check\n * @returns True if state is a recovery animation\n *\n * @example\n * ```typescript\n * if (isRecoveryState(AnimationState.RECOVERY_ROLL)) {\n * // Handle recovery animation logic\n * }\n * ```\n *\n * @public\n * @korean 회복상태확인\n */\nexport function isRecoveryState(state: AnimationState): boolean {\n return state.startsWith(\"recovery_\");\n}\n"],"mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/systems/bodypart/types.ts"],"sourcesContent":["/**\n * Body Part Health System Types\n * \n * **Korean**: 신체부위 체력 시스템 타입\n * \n * This module defines types for the body part-specific health tracking system,\n * which replaces the single health bar with independent health tracking for\n * each major body region. This enables realistic localized damage and combat\n * trauma simulation.\n * \n * ## Body Part Health Philosophy\n * \n * Traditional Korean martial arts emphasize targeting specific body regions\n * to achieve maximum combat effectiveness. This system reflects that by\n * tracking damage to:\n * - **HEAD** (두부): Consciousness and awareness\n * - **NECK** (경부): Vascular and respiratory function\n * - **TORSO_UPPER** (상부 몸통): Heart, lungs, vital organs\n * - **TORSO_LOWER** (하부 몸통): Stamina and core strength\n * - **ARM_LEFT/RIGHT** (좌/우팔): Attack capability\n * - **LEG_LEFT/RIGHT** (좌/우다리): Mobility and balance\n * \n * @module systems/bodypart/types\n * @category Body Part System\n * @korean 신체부위타입\n */\n\nimport { KoreanText } from \"@/types\";\n\n/**\n * Body part identifiers for health tracking.\n * \n * **Korean**: 신체 부위 (Body Parts)\n * \n * Each body part tracks independent health from 0-100 HP. Damage to specific\n * parts affects different combat capabilities based on anatomical function.\n * \n * @example\n * ```typescript\n * const bodyPart: BodyPart = BodyPart.HEAD;\n * const health = player.bodyPartHealth[bodyPart]; // 0-100\n * ```\n * \n * @public\n * @category Body Part System\n * @korean 신체부위\n */\nexport enum BodyPart {\n /** Head region - affects consciousness and awareness */\n HEAD = \"head\",\n /** Neck region - affects breathing and blood flow */\n NECK = \"neck\",\n /** Upper torso - affects heart, lungs, stamina recovery */\n TORSO_UPPER = \"torsoUpper\",\n /** Lower torso - affects core strength and balance */\n TORSO_LOWER = \"torsoLower\",\n /** Left arm - affects attack capability on left side */\n ARM_LEFT = \"armLeft\",\n /** Right arm - affects attack capability on right side */\n ARM_RIGHT = \"armRight\",\n /** Left leg - affects movement and balance */\n LEG_LEFT = \"legLeft\",\n /** Right leg - affects movement and balance */\n LEG_RIGHT = \"legRight\",\n}\n\n/**\n * Health values for each body part (0-100 HP per part).\n * \n * **Korean**: 신체 부위별 체력\n * \n * Tracks independent health pools for each major body region. When a body part\n * reaches 0 HP, it becomes non-functional and applies severe combat penalties.\n * \n * ## Default Health Values\n * \n * All body parts start at 100 HP. Different archetypes may have variations:\n * - **무사 (Musa)**: Balanced health across all parts\n * - **암살자 (Amsalja)**: Lower torso health, higher arm precision\n * - **해커 (Hacker)**: Enhanced head/neck (cyber augmentation)\n * - **정보요원 (Jeongbo)**: Balanced with slight defensive boost\n * - **조직폭력배 (Jojik)**: Higher torso/leg health (street hardened)\n * \n * @example\n * ```typescript\n * const bodyHealth: BodyPartHealth = {\n * head: 100,\n * neck: 100,\n * torsoUpper: 100,\n * torsoLower: 100,\n * armLeft: 100,\n * armRight: 100,\n * legLeft: 100,\n * legRight: 100,\n * };\n * ```\n * \n * @public\n * @category Body Part System\n * @korean 신체부위체력\n */\nexport interface BodyPartHealth {\n /** Head health (0-100 HP) - affects consciousness */\n readonly head: number;\n /** Neck health (0-100 HP) - affects breathing and circulation */\n readonly neck: number;\n /** Upper torso health (0-100 HP) - affects stamina recovery */\n readonly torsoUpper: number;\n /** Lower torso health (0-100 HP) - affects balance and core strength */\n readonly torsoLower: number;\n /** Left arm health (0-100 HP) - affects left-side attacks */\n readonly armLeft: number;\n /** Right arm health (0-100 HP) - affects right-side attacks */\n readonly armRight: number;\n /** Left leg health (0-100 HP) - affects movement and stance */\n readonly legLeft: number;\n /** Right leg health (0-100 HP) - affects movement and stance */\n readonly legRight: number;\n}\n\n/**\n * Maximum health values for each body part.\n * \n * **Korean**: 최대 신체 부위 체력\n * \n * Defines the maximum HP capacity for each body part. Can be modified by\n * archetype, equipment, or training bonuses.\n * \n * @public\n * @category Body Part System\n * @korean 최대신체부위체력\n */\nexport interface BodyPartMaxHealth {\n /** Maximum head health */\n readonly head: number;\n /** Maximum neck health */\n readonly neck: number;\n /** Maximum upper torso health */\n readonly torsoUpper: number;\n /** Maximum lower torso health */\n readonly torsoLower: number;\n /** Maximum left arm health */\n readonly armLeft: number;\n /** Maximum right arm health */\n readonly armRight: number;\n /** Maximum left leg health */\n readonly legLeft: number;\n /** Maximum right leg health */\n readonly legRight: number;\n}\n\n/**\n * Combat capability effects from body part damage.\n * \n * **Korean**: 신체 부위 손상 효과\n * \n * Defines how damage to specific body parts affects combat performance.\n * Effects are applied as multipliers to base stats (0.0 = disabled, 1.0 = normal).\n * \n * ## Effect Thresholds\n * \n * - **100-75% HP**: No penalties (1.0x)\n * - **75-50% HP**: Minor penalties (0.9-0.8x)\n * - **50-25% HP**: Major penalties (0.7-0.5x)\n * - **25-0% HP**: Severe penalties (0.3-0.1x)\n * - **0% HP**: Non-functional (0.0x)\n * \n * @example\n * ```typescript\n * const effects: BodyPartEffects = {\n * consciousnessModifier: 0.75, // Head at 50% HP\n * staminaRegenModifier: 0.5, // Torso damaged\n * attackDamageModifier: 0.7, // Arm injured\n * movementSpeedModifier: 0.6, // Leg damaged\n * };\n * ```\n * \n * @public\n * @category Body Part System\n * @korean 신체부위효과\n */\nexport interface BodyPartEffects {\n /** Consciousness and awareness multiplier (0.0-1.0) - from head/neck damage */\n readonly consciousnessModifier: number;\n /** Stamina regeneration multiplier (0.0-1.0) - from torso damage */\n readonly staminaRegenModifier: number;\n /** Attack damage multiplier (0.0-1.0) - from arm damage */\n readonly attackDamageModifier: number;\n /** Movement speed multiplier (0.0-1.0) - from leg damage */\n readonly movementSpeedModifier: number;\n /** Balance modifier (0.0-1.0) - from lower torso and leg damage */\n readonly balanceModifier: number;\n /** Technique accuracy multiplier (0.0-1.0) - from head/arm damage */\n readonly techniqueAccuracyModifier: number;\n}\n\n/**\n * Damage distribution configuration for body parts.\n * \n * **Korean**: 신체 부위 피해 분배\n * \n * Defines how damage from attacks is distributed across body parts based on\n * the hit location and attack type. Not all damage goes to a single part;\n * impact can affect adjacent regions.\n * \n * @example\n * ```typescript\n * // Strike to head distributes damage\n * const distribution: BodyPartDamageDistribution = {\n * primary: { part: BodyPart.HEAD, percentage: 0.8 },\n * secondary: [\n * { part: BodyPart.NECK, percentage: 0.2 }\n * ]\n * };\n * ```\n * \n * @public\n * @category Body Part System\n * @korean 신체부위피해분배\n */\nexport interface BodyPartDamageDistribution {\n /** Primary body part receiving most damage */\n readonly primary: {\n readonly part: BodyPart;\n readonly percentage: number; // 0.0-1.0\n };\n /** Secondary body parts receiving splash damage */\n readonly secondary: readonly {\n readonly part: BodyPart;\n readonly percentage: number; // 0.0-1.0\n }[];\n}\n\n/**\n * Body part status information for UI display.\n * \n * **Korean**: 신체 부위 상태 정보\n * \n * Provides UI-friendly data about body part health status including\n * color coding, status text, and icon information.\n * \n * @public\n * @category Body Part System\n * @korean 신체부위상태\n */\nexport interface BodyPartStatus {\n /** Body part identifier */\n readonly part: BodyPart;\n /** Current health (0-100) */\n readonly health: number;\n /** Maximum health */\n readonly maxHealth: number;\n /** Health percentage (0.0-1.0) */\n readonly percentage: number;\n /** Status description */\n readonly status: KoreanText;\n /** Color code for UI (hex number) */\n readonly color: number;\n /** Whether this part is critically damaged */\n readonly critical: boolean;\n /** Whether this part is non-functional */\n readonly disabled: boolean;\n}\n\n/**\n * Configuration for body part health system.\n * \n * **Korean**: 신체 부위 시스템 설정\n * \n * Defines thresholds, multipliers, and constants used by the body part\n * health system for damage calculation and effect application.\n * \n * @public\n * @category Body Part System\n * @korean 신체부위설정\n */\nexport interface BodyPartHealthConfig {\n /** Default max health for all body parts */\n readonly defaultMaxHealth: number;\n /** Health threshold for minor penalties (percentage) */\n readonly minorPenaltyThreshold: number;\n /** Health threshold for major penalties (percentage) */\n readonly majorPenaltyThreshold: number;\n /** Health threshold for severe penalties (percentage) */\n readonly severePenaltyThreshold: number;\n /** Health threshold for critical status (percentage) */\n readonly criticalThreshold: number;\n /** Effect multipliers for each threshold tier */\n readonly effectMultipliers: {\n readonly minor: number;\n readonly major: number;\n readonly severe: number;\n readonly critical: number;\n };\n}\n\n/**\n * Default configuration values for body part health system.\n * \n * @public\n * @category Body Part System\n */\nexport const DEFAULT_BODY_PART_CONFIG: BodyPartHealthConfig = {\n defaultMaxHealth: 100,\n minorPenaltyThreshold: 0.75, // 75% HP\n majorPenaltyThreshold: 0.50, // 50% HP\n severePenaltyThreshold: 0.25, // 25% HP\n criticalThreshold: 0.10, // 10% HP\n effectMultipliers: {\n minor: 0.90, // 10% penalty\n major: 0.70, // 30% penalty\n severe: 0.40, // 60% penalty\n critical: 0.10, // 90% penalty\n },\n} as const;\n\n/**\n * Body part health effect constants matching acceptance criteria.\n * \n * **Korean**: 신체 부위 효과 상수\n * \n * Defines specific combat penalties as per requirements:\n * - Head <50%: Consciousness penalties\n * - Torso <50%: Stamina regen -50%\n * - Arms <50%: Attack damage -30%\n * - Legs <50%: Movement speed -40%\n * \n * @public\n * @category Body Part System\n */\nexport const BODY_PART_EFFECT_CONSTANTS = {\n /** Head damage effects */\n HEAD: {\n CONSCIOUSNESS_PENALTY_AT_50: 0.75, // 25% consciousness reduction\n CRITICAL_THRESHOLD: 0.50,\n },\n /** Torso damage effects */\n TORSO: {\n STAMINA_REGEN_PENALTY_AT_50: 0.50, // 50% stamina regen reduction\n CRITICAL_THRESHOLD: 0.50,\n },\n /** Arm damage effects */\n ARMS: {\n ATTACK_DAMAGE_PENALTY_AT_50: 0.70, // 30% attack damage reduction\n CRITICAL_THRESHOLD: 0.50,\n },\n /** Leg damage effects */\n LEGS: {\n MOVEMENT_SPEED_PENALTY_AT_50: 0.60, // 40% movement speed reduction\n CRITICAL_THRESHOLD: 0.50,\n },\n} as const;\n\n/**\n * Leg injury severity levels for movement penalties.\n * \n * **Korean**: 다리 부상 정도 (Leg Injury Severity)\n * \n * Defines movement impairment states based on leg health percentage.\n * \n * @public\n * @category Body Part System\n * @korean 다리부상정도\n */\nexport enum LegInjuryState {\n /** Normal movement - Leg health 100-70% */\n NORMAL = \"normal\",\n /** Limping - Leg health 69-50% */\n LIMPING = \"limping\",\n /** Severe limp - Leg health 49-30% */\n SEVERE_LIMP = \"severe_limp\",\n /** Hobbled - Leg health <30%, cannot run */\n HOBBLED = \"hobbled\",\n}\n\n/**\n * Movement penalty applied from leg damage.\n * \n * **Korean**: 이동 패널티 (Movement Penalty)\n * \n * Describes the current movement impairment including speed reduction,\n * stance change penalties, and balance effects.\n * \n * @public\n * @category Body Part System\n * @korean 이동패널티\n */\nexport interface MovementPenalty {\n /** Movement speed multiplier (0.0-1.0) */\n readonly speedMultiplier: number;\n /** Whether player can run (false when hobbled) */\n readonly canRun: boolean;\n /** Current injury state */\n readonly injuryState: LegInjuryState;\n /** Stance change duration multiplier (1.0 = normal, 2.0 = 2x slower) */\n readonly stanceChangePenalty: number;\n /** Whether advanced stances are restricted */\n readonly advancedStancesRestricted: boolean;\n /** Balance modifier from leg damage (0.0-1.0) */\n readonly balanceModifier: number;\n /** Whether instant penalty is active (from knee/ankle strike) */\n readonly hasInstantPenalty: boolean;\n /** Timestamp when instant penalty expires (0 if not active) */\n readonly instantPenaltyExpiry: number;\n}\n\n/**\n * Instant movement penalty from knee/ankle strikes.\n * \n * **Korean**: 순간 이동 패널티 (Instant Movement Penalty)\n * \n * Applied immediately upon striking knee or ankle vital points,\n * causing temporary severe movement impairment.\n * \n * @public\n * @category Body Part System\n * @korean 순간이동패널티\n */\nexport interface InstantMovementPenalty {\n /** Speed multiplier during instant penalty */\n readonly speedMultiplier: number;\n /** Duration in milliseconds */\n readonly duration: number;\n /** Timestamp when penalty was applied */\n readonly appliedAt: number;\n /** Body part that was struck */\n readonly affectedPart: BodyPart;\n}\n\n/**\n * Movement penalty constants matching acceptance criteria.\n * \n * **Korean**: 이동 패널티 상수\n * \n * Defines thresholds and multipliers for injury-based movement penalties:\n * - 100-70%: Normal speed (100%)\n * - 69-50%: Limping (-20% speed)\n * - 49-30%: Severe limp (-40% speed)\n * - <30%: Hobbled (-60% speed, cannot run)\n * \n * @public\n * @category Body Part System\n */\nexport const MOVEMENT_PENALTY_CONSTANTS = {\n /** Health percentage thresholds for injury states */\n THRESHOLDS: {\n NORMAL: 0.70, // 70% and above\n LIMPING: 0.50, // 50-69%\n SEVERE_LIMP: 0.30, // 30-49%\n HOBBLED: 0.0, // Below 30%\n },\n \n /** Speed multipliers for each injury state */\n SPEED_MULTIPLIERS: {\n NORMAL: 1.0, // 100% speed\n LIMPING: 0.8, // 80% speed (-20%)\n SEVERE_LIMP: 0.6, // 60% speed (-40%)\n HOBBLED: 0.4, // 40% speed (-60%)\n },\n \n /** Stance change penalty multipliers */\n STANCE_CHANGE: {\n NORMAL: 1.0, // Normal duration\n INJURED: 2.0, // 2x duration when legs <50%\n CRITICAL_THRESHOLD: 0.50, // Threshold for stance penalties\n RESTRICTION_THRESHOLD: 0.30, // Threshold for advanced stance restriction\n },\n \n /** Instant penalty from knee/ankle strikes */\n INSTANT_PENALTY: {\n SPEED_MULTIPLIER: 0.3, // 30% speed for 5 seconds\n DURATION: 5000, // 5 seconds in milliseconds\n },\n \n /** Asymmetric damage effects */\n ASYMMETRIC: {\n /** Penalty when moving toward injured side */\n SAME_SIDE_PENALTY: 0.8, // Additional 20% penalty\n /** Penalty when moving away from injured side */\n OPPOSITE_SIDE_PENALTY: 0.9, // Additional 10% penalty\n },\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+CA,IAAY,WAAL,yBAAA,UAAA;;AAEL,UAAA,UAAA;;AAEA,UAAA,UAAA;;AAEA,UAAA,iBAAA;;AAEA,UAAA,iBAAA;;AAEA,UAAA,cAAA;;AAEA,UAAA,eAAA;;AAEA,UAAA,cAAA;;AAEA,UAAA,eAAA;;KACD;;;;;;;AA8OD,IAAa,2BAAiD;CAC5D,kBAAkB;CAClB,uBAAuB;CACvB,uBAAuB;CACvB,wBAAwB;CACxB,mBAAmB;CACnB,mBAAmB;EACjB,OAAO;EACP,OAAO;EACP,QAAQ;EACR,UAAU;EACX;CACF;;;;;;;;;;;;;;;AAgBD,IAAa,6BAA6B;CAExC,MAAM;EACJ,6BAA6B;EAC7B,oBAAoB;EACrB;CAED,OAAO;EACL,6BAA6B;EAC7B,oBAAoB;EACrB;CAED,MAAM;EACJ,6BAA6B;EAC7B,oBAAoB;EACrB;CAED,MAAM;EACJ,8BAA8B;EAC9B,oBAAoB;EACrB;CACF;;;;;;;;;;;;AAaD,IAAY,iBAAL,yBAAA,gBAAA;;AAEL,gBAAA,YAAA;;AAEA,gBAAA,aAAA;;AAEA,gBAAA,iBAAA;;AAEA,gBAAA,aAAA;;KACD;;;;;;;;;;;;;;;AAsED,IAAa,6BAA6B;CAExC,YAAY;EACV,QAAQ;EACR,SAAS;EACT,aAAa;EACb,SAAS;EACV;CAGD,mBAAmB;EACjB,QAAQ;EACR,SAAS;EACT,aAAa;EACb,SAAS;EACV;CAGD,eAAe;EACb,QAAQ;EACR,SAAS;EACT,oBAAoB;EACpB,uBAAuB;EACxB;CAGD,iBAAiB;EACf,kBAAkB;EAClB,UAAU;EACX;CAGD,YAAY;EAEV,mBAAmB;EAEnB,uBAAuB;EACxB;CACF"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/systems/bodypart/types.ts"],"sourcesContent":["/**\n * Body Part Health System Types\n * \n * **Korean**: 신체부위 체력 시스템 타입\n * \n * This module defines types for the body part-specific health tracking system,\n * which replaces the single health bar with independent health tracking for\n * each major body region. This enables realistic localized damage and combat\n * trauma simulation.\n * \n * ## Body Part Health Philosophy\n * \n * Traditional Korean martial arts emphasize targeting specific body regions\n * to achieve maximum combat effectiveness. This system reflects that by\n * tracking damage to:\n * - **HEAD** (두부): Consciousness and awareness\n * - **NECK** (경부): Vascular and respiratory function\n * - **TORSO_UPPER** (상부 몸통): Heart, lungs, vital organs\n * - **TORSO_LOWER** (하부 몸통): Stamina and core strength\n * - **ARM_LEFT/RIGHT** (좌/우팔): Attack capability\n * - **LEG_LEFT/RIGHT** (좌/우다리): Mobility and balance\n * \n * @module systems/bodypart/types\n * @category Body Part System\n * @korean 신체부위타입\n */\n\nimport { KoreanText } from \"@/types\";\n\n/**\n * Body part identifiers for health tracking.\n * \n * **Korean**: 신체 부위 (Body Parts)\n * \n * Each body part tracks independent health from 0-100 HP. Damage to specific\n * parts affects different combat capabilities based on anatomical function.\n * \n * @example\n * ```typescript\n * const bodyPart: BodyPart = BodyPart.HEAD;\n * const health = player.bodyPartHealth[bodyPart]; // 0-100\n * ```\n * \n * @public\n * @category Body Part System\n * @korean 신체부위\n */\nexport enum BodyPart {\n /** Head region - affects consciousness and awareness */\n HEAD = \"head\",\n /** Neck region - affects breathing and blood flow */\n NECK = \"neck\",\n /** Upper torso - affects heart, lungs, stamina recovery */\n TORSO_UPPER = \"torsoUpper\",\n /** Lower torso - affects core strength and balance */\n TORSO_LOWER = \"torsoLower\",\n /** Left arm - affects attack capability on left side */\n ARM_LEFT = \"armLeft\",\n /** Right arm - affects attack capability on right side */\n ARM_RIGHT = \"armRight\",\n /** Left leg - affects movement and balance */\n LEG_LEFT = \"legLeft\",\n /** Right leg - affects movement and balance */\n LEG_RIGHT = \"legRight\",\n}\n\n/**\n * Health values for each body part (0-100 HP per part).\n * \n * **Korean**: 신체 부위별 체력\n * \n * Tracks independent health pools for each major body region. When a body part\n * reaches 0 HP, it becomes non-functional and applies severe combat penalties.\n * \n * ## Default Health Values\n * \n * All body parts start at 100 HP. Different archetypes may have variations:\n * - **무사 (Musa)**: Balanced health across all parts\n * - **암살자 (Amsalja)**: Lower torso health, higher arm precision\n * - **해커 (Hacker)**: Enhanced head/neck (cyber augmentation)\n * - **정보요원 (Jeongbo)**: Balanced with slight defensive boost\n * - **조직폭력배 (Jojik)**: Higher torso/leg health (street hardened)\n * \n * @example\n * ```typescript\n * const bodyHealth: BodyPartHealth = {\n * head: 100,\n * neck: 100,\n * torsoUpper: 100,\n * torsoLower: 100,\n * armLeft: 100,\n * armRight: 100,\n * legLeft: 100,\n * legRight: 100,\n * };\n * ```\n * \n * @public\n * @category Body Part System\n * @korean 신체부위체력\n */\nexport interface BodyPartHealth {\n /** Head health (0-100 HP) - affects consciousness */\n readonly head: number;\n /** Neck health (0-100 HP) - affects breathing and circulation */\n readonly neck: number;\n /** Upper torso health (0-100 HP) - affects stamina recovery */\n readonly torsoUpper: number;\n /** Lower torso health (0-100 HP) - affects balance and core strength */\n readonly torsoLower: number;\n /** Left arm health (0-100 HP) - affects left-side attacks */\n readonly armLeft: number;\n /** Right arm health (0-100 HP) - affects right-side attacks */\n readonly armRight: number;\n /** Left leg health (0-100 HP) - affects movement and stance */\n readonly legLeft: number;\n /** Right leg health (0-100 HP) - affects movement and stance */\n readonly legRight: number;\n}\n\n/**\n * Maximum health values for each body part.\n * \n * **Korean**: 최대 신체 부위 체력\n * \n * Defines the maximum HP capacity for each body part. Can be modified by\n * archetype, equipment, or training bonuses.\n * \n * @public\n * @category Body Part System\n * @korean 최대신체부위체력\n */\nexport interface BodyPartMaxHealth {\n /** Maximum head health */\n readonly head: number;\n /** Maximum neck health */\n readonly neck: number;\n /** Maximum upper torso health */\n readonly torsoUpper: number;\n /** Maximum lower torso health */\n readonly torsoLower: number;\n /** Maximum left arm health */\n readonly armLeft: number;\n /** Maximum right arm health */\n readonly armRight: number;\n /** Maximum left leg health */\n readonly legLeft: number;\n /** Maximum right leg health */\n readonly legRight: number;\n}\n\n/**\n * Combat capability effects from body part damage.\n * \n * **Korean**: 신체 부위 손상 효과\n * \n * Defines how damage to specific body parts affects combat performance.\n * Effects are applied as multipliers to base stats (0.0 = disabled, 1.0 = normal).\n * \n * ## Effect Thresholds\n * \n * - **100-75% HP**: No penalties (1.0x)\n * - **75-50% HP**: Minor penalties (0.9-0.8x)\n * - **50-25% HP**: Major penalties (0.7-0.5x)\n * - **25-0% HP**: Severe penalties (0.3-0.1x)\n * - **0% HP**: Non-functional (0.0x)\n * \n * @example\n * ```typescript\n * const effects: BodyPartEffects = {\n * consciousnessModifier: 0.75, // Head at 50% HP\n * staminaRegenModifier: 0.5, // Torso damaged\n * attackDamageModifier: 0.7, // Arm injured\n * movementSpeedModifier: 0.6, // Leg damaged\n * };\n * ```\n * \n * @public\n * @category Body Part System\n * @korean 신체부위효과\n */\nexport interface BodyPartEffects {\n /** Consciousness and awareness multiplier (0.0-1.0) - from head/neck damage */\n readonly consciousnessModifier: number;\n /** Stamina regeneration multiplier (0.0-1.0) - from torso damage */\n readonly staminaRegenModifier: number;\n /** Attack damage multiplier (0.0-1.0) - from arm damage */\n readonly attackDamageModifier: number;\n /** Movement speed multiplier (0.0-1.0) - from leg damage */\n readonly movementSpeedModifier: number;\n /** Balance modifier (0.0-1.0) - from lower torso and leg damage */\n readonly balanceModifier: number;\n /** Technique accuracy multiplier (0.0-1.0) - from head/arm damage */\n readonly techniqueAccuracyModifier: number;\n}\n\n/**\n * Damage distribution configuration for body parts.\n * \n * **Korean**: 신체 부위 피해 분배\n * \n * Defines how damage from attacks is distributed across body parts based on\n * the hit location and attack type. Not all damage goes to a single part;\n * impact can affect adjacent regions.\n * \n * @example\n * ```typescript\n * // Strike to head distributes damage\n * const distribution: BodyPartDamageDistribution = {\n * primary: { part: BodyPart.HEAD, percentage: 0.8 },\n * secondary: [\n * { part: BodyPart.NECK, percentage: 0.2 }\n * ]\n * };\n * ```\n * \n * @public\n * @category Body Part System\n * @korean 신체부위피해분배\n */\nexport interface BodyPartDamageDistribution {\n /** Primary body part receiving most damage */\n readonly primary: {\n readonly part: BodyPart;\n readonly percentage: number; // 0.0-1.0\n };\n /** Secondary body parts receiving splash damage */\n readonly secondary: readonly {\n readonly part: BodyPart;\n readonly percentage: number; // 0.0-1.0\n }[];\n}\n\n/**\n * Body part status information for UI display.\n * \n * **Korean**: 신체 부위 상태 정보\n * \n * Provides UI-friendly data about body part health status including\n * color coding, status text, and icon information.\n * \n * @public\n * @category Body Part System\n * @korean 신체부위상태\n */\nexport interface BodyPartStatus {\n /** Body part identifier */\n readonly part: BodyPart;\n /** Current health (0-100) */\n readonly health: number;\n /** Maximum health */\n readonly maxHealth: number;\n /** Health percentage (0.0-1.0) */\n readonly percentage: number;\n /** Status description */\n readonly status: KoreanText;\n /** Color code for UI (hex number) */\n readonly color: number;\n /** Whether this part is critically damaged */\n readonly critical: boolean;\n /** Whether this part is non-functional */\n readonly disabled: boolean;\n}\n\n/**\n * Configuration for body part health system.\n * \n * **Korean**: 신체 부위 시스템 설정\n * \n * Defines thresholds, multipliers, and constants used by the body part\n * health system for damage calculation and effect application.\n * \n * @public\n * @category Body Part System\n * @korean 신체부위설정\n */\nexport interface BodyPartHealthConfig {\n /** Default max health for all body parts */\n readonly defaultMaxHealth: number;\n /** Health threshold for minor penalties (percentage) */\n readonly minorPenaltyThreshold: number;\n /** Health threshold for major penalties (percentage) */\n readonly majorPenaltyThreshold: number;\n /** Health threshold for severe penalties (percentage) */\n readonly severePenaltyThreshold: number;\n /** Health threshold for critical status (percentage) */\n readonly criticalThreshold: number;\n /** Effect multipliers for each threshold tier */\n readonly effectMultipliers: {\n readonly minor: number;\n readonly major: number;\n readonly severe: number;\n readonly critical: number;\n };\n}\n\n/**\n * Default configuration values for body part health system.\n * \n * @public\n * @category Body Part System\n */\nexport const DEFAULT_BODY_PART_CONFIG: BodyPartHealthConfig = {\n defaultMaxHealth: 100,\n minorPenaltyThreshold: 0.75, // 75% HP\n majorPenaltyThreshold: 0.50, // 50% HP\n severePenaltyThreshold: 0.25, // 25% HP\n criticalThreshold: 0.10, // 10% HP\n effectMultipliers: {\n minor: 0.90, // 10% penalty\n major: 0.70, // 30% penalty\n severe: 0.40, // 60% penalty\n critical: 0.10, // 90% penalty\n },\n} as const;\n\n/**\n * Body part health effect constants matching acceptance criteria.\n * \n * **Korean**: 신체 부위 효과 상수\n * \n * Defines specific combat penalties as per requirements:\n * - Head <50%: Consciousness penalties\n * - Torso <50%: Stamina regen -50%\n * - Arms <50%: Attack damage -30%\n * - Legs <50%: Movement speed -40%\n * \n * @public\n * @category Body Part System\n */\nexport const BODY_PART_EFFECT_CONSTANTS = {\n /** Head damage effects */\n HEAD: {\n CONSCIOUSNESS_PENALTY_AT_50: 0.75, // 25% consciousness reduction\n CRITICAL_THRESHOLD: 0.50,\n },\n /** Torso damage effects */\n TORSO: {\n STAMINA_REGEN_PENALTY_AT_50: 0.50, // 50% stamina regen reduction\n CRITICAL_THRESHOLD: 0.50,\n },\n /** Arm damage effects */\n ARMS: {\n ATTACK_DAMAGE_PENALTY_AT_50: 0.70, // 30% attack damage reduction\n CRITICAL_THRESHOLD: 0.50,\n },\n /** Leg damage effects */\n LEGS: {\n MOVEMENT_SPEED_PENALTY_AT_50: 0.60, // 40% movement speed reduction\n CRITICAL_THRESHOLD: 0.50,\n },\n} as const;\n\n/**\n * Leg injury severity levels for movement penalties.\n * \n * **Korean**: 다리 부상 정도 (Leg Injury Severity)\n * \n * Defines movement impairment states based on leg health percentage.\n * \n * @public\n * @category Body Part System\n * @korean 다리부상정도\n */\nexport enum LegInjuryState {\n /** Normal movement - Leg health 100-70% */\n NORMAL = \"normal\",\n /** Limping - Leg health 69-50% */\n LIMPING = \"limping\",\n /** Severe limp - Leg health 49-30% */\n SEVERE_LIMP = \"severe_limp\",\n /** Hobbled - Leg health <30%, cannot run */\n HOBBLED = \"hobbled\",\n}\n\n/**\n * Movement penalty applied from leg damage.\n * \n * **Korean**: 이동 패널티 (Movement Penalty)\n * \n * Describes the current movement impairment including speed reduction,\n * stance change penalties, and balance effects.\n * \n * @public\n * @category Body Part System\n * @korean 이동패널티\n */\nexport interface MovementPenalty {\n /** Movement speed multiplier (0.0-1.0) */\n readonly speedMultiplier: number;\n /** Whether player can run (false when hobbled) */\n readonly canRun: boolean;\n /** Current injury state */\n readonly injuryState: LegInjuryState;\n /** Stance change duration multiplier (1.0 = normal, 2.0 = 2x slower) */\n readonly stanceChangePenalty: number;\n /** Whether advanced stances are restricted */\n readonly advancedStancesRestricted: boolean;\n /** Balance modifier from leg damage (0.0-1.0) */\n readonly balanceModifier: number;\n /** Whether instant penalty is active (from knee/ankle strike) */\n readonly hasInstantPenalty: boolean;\n /** Timestamp when instant penalty expires (0 if not active) */\n readonly instantPenaltyExpiry: number;\n}\n\n/**\n * Instant movement penalty from knee/ankle strikes.\n * \n * **Korean**: 순간 이동 패널티 (Instant Movement Penalty)\n * \n * Applied immediately upon striking knee or ankle vital points,\n * causing temporary severe movement impairment.\n * \n * @public\n * @category Body Part System\n * @korean 순간이동패널티\n */\nexport interface InstantMovementPenalty {\n /** Speed multiplier during instant penalty */\n readonly speedMultiplier: number;\n /** Duration in milliseconds */\n readonly duration: number;\n /** Timestamp when penalty was applied */\n readonly appliedAt: number;\n /** Body part that was struck */\n readonly affectedPart: BodyPart;\n}\n\n/**\n * Movement penalty constants matching acceptance criteria.\n * \n * **Korean**: 이동 패널티 상수\n * \n * Defines thresholds and multipliers for injury-based movement penalties:\n * - 100-70%: Normal speed (100%)\n * - 69-50%: Limping (-20% speed)\n * - 49-30%: Severe limp (-40% speed)\n * - <30%: Hobbled (-60% speed, cannot run)\n * \n * @public\n * @category Body Part System\n */\nexport const MOVEMENT_PENALTY_CONSTANTS = {\n /** Health percentage thresholds for injury states */\n THRESHOLDS: {\n NORMAL: 0.70, // 70% and above\n LIMPING: 0.50, // 50-69%\n SEVERE_LIMP: 0.30, // 30-49%\n HOBBLED: 0.0, // Below 30%\n },\n \n /** Speed multipliers for each injury state */\n SPEED_MULTIPLIERS: {\n NORMAL: 1.0, // 100% speed\n LIMPING: 0.8, // 80% speed (-20%)\n SEVERE_LIMP: 0.6, // 60% speed (-40%)\n HOBBLED: 0.4, // 40% speed (-60%)\n },\n \n /** Stance change penalty multipliers */\n STANCE_CHANGE: {\n NORMAL: 1.0, // Normal duration\n INJURED: 2.0, // 2x duration when legs <50%\n CRITICAL_THRESHOLD: 0.50, // Threshold for stance penalties\n RESTRICTION_THRESHOLD: 0.30, // Threshold for advanced stance restriction\n },\n \n /** Instant penalty from knee/ankle strikes */\n INSTANT_PENALTY: {\n SPEED_MULTIPLIER: 0.3, // 30% speed for 5 seconds\n DURATION: 5000, // 5 seconds in milliseconds\n },\n \n /** Asymmetric damage effects */\n ASYMMETRIC: {\n /** Penalty when moving toward injured side */\n SAME_SIDE_PENALTY: 0.8, // Additional 20% penalty\n /** Penalty when moving away from injured side */\n OPPOSITE_SIDE_PENALTY: 0.9, // Additional 10% penalty\n },\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+CA,IAAY,WAAL,yBAAA,UAAA;;AAEL,UAAA,UAAO;;AAEP,UAAA,UAAO;;AAEP,UAAA,iBAAc;;AAEd,UAAA,iBAAc;;AAEd,UAAA,cAAW;;AAEX,UAAA,eAAY;;AAEZ,UAAA,cAAW;;AAEX,UAAA,eAAY;;KACb;;;;;;;AA8OD,IAAa,2BAAiD;CAC5D,kBAAkB;CAClB,uBAAuB;CACvB,uBAAuB;CACvB,wBAAwB;CACxB,mBAAmB;CACnB,mBAAmB;EACjB,OAAO;EACP,OAAO;EACP,QAAQ;EACR,UAAU;EACX;CACF;;;;;;;;;;;;;;;AAgBD,IAAa,6BAA6B;CAExC,MAAM;EACJ,6BAA6B;EAC7B,oBAAoB;EACrB;CAED,OAAO;EACL,6BAA6B;EAC7B,oBAAoB;EACrB;CAED,MAAM;EACJ,6BAA6B;EAC7B,oBAAoB;EACrB;CAED,MAAM;EACJ,8BAA8B;EAC9B,oBAAoB;EACrB;CACF;;;;;;;;;;;;AAaD,IAAY,iBAAL,yBAAA,gBAAA;;AAEL,gBAAA,YAAS;;AAET,gBAAA,aAAU;;AAEV,gBAAA,iBAAc;;AAEd,gBAAA,aAAU;;KACX;;;;;;;;;;;;;;;AAsED,IAAa,6BAA6B;CAExC,YAAY;EACV,QAAQ;EACR,SAAS;EACT,aAAa;EACb,SAAS;EACV;CAGD,mBAAmB;EACjB,QAAQ;EACR,SAAS;EACT,aAAa;EACb,SAAS;EACV;CAGD,eAAe;EACb,QAAQ;EACR,SAAS;EACT,oBAAoB;EACpB,uBAAuB;EACxB;CAGD,iBAAiB;EACf,kBAAkB;EAClB,UAAU;EACX;CAGD,YAAY;EAEV,mBAAmB;EAEnB,uBAAuB;EACxB;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"BreathingDisruptionSystem.js","names":[],"sources":["../../../src/systems/breathing/BreathingDisruptionSystem.ts"],"sourcesContent":["/**\n * Breathing Disruption System for realistic respiratory targeting mechanics.\n * \n * **Korean**: 호흡곤란 시스템 (Breathing Disruption System)\n * \n * This system implements realistic breathing disruption from torso strikes targeting\n * the solar plexus, ribs, and diaphragm. Breathing difficulty reduces stamina\n * regeneration and creates authentic combat trauma effects.\n * \n * ## Disruption Levels (호흡곤란 수준)\n * \n * - **Winded (바람맞음)**: 25% stamina regeneration penalty for 5 seconds\n * - **Gasping (헐떡임)**: 50% stamina regeneration penalty for 10 seconds\n * - **Severely Winded (심각한 호흡곤란)**: 75% stamina regeneration penalty for 15 seconds\n * \n * ## Korean Martial Arts Context\n * \n * Traditional Korean martial arts (태권도, 합기도, 택견) emphasize torso strikes:\n * - **명치 (Myeongchi)**: Solar plexus - instant breath disruption\n * - **늑골 (Neukgol)**: Floating ribs - cumulative breathing difficulty\n * - **횡격막 (Hoenggyeongmak)**: Diaphragm - severe respiratory impact\n * \n * ## Game Design Philosophy\n * \n * Breathing disruption creates tactical depth by:\n * 1. Rewarding torso targeting over simple head/limb attacks\n * 2. Creating stamina management gameplay - disrupted fighters must fight defensively\n * 3. Providing realistic combat trauma feedback\n * 4. Encouraging recovery periods when torso health is compromised\n * \n * @module systems/breathing\n * @category Combat Systems\n * @korean 호흡곤란시스템\n */\n\nimport { KoreanText, VitalPointEffectType } from \"@/types\";\nimport { StatusEffect } from \"@/systems/types\";\nimport { PlayerState } from \"@/systems/player\";\nimport { EffectIntensity } from \"@/systems/effects\";\n\n/**\n * Breathing disruption severity levels.\n * \n * **Korean**: 호흡곤란 수준\n * \n * Progressive levels of respiratory impairment from torso strikes.\n * Higher levels stack duration and increase stamina regeneration penalties.\n * \n * @public\n * @category Combat Systems\n * @korean 호흡곤란수준\n */\nexport enum BreathingDisruptionLevel {\n /** No breathing disruption - normal stamina regeneration */\n NONE = \"none\",\n \n /**\n * Winded (바람맞음)\n * - 25% stamina regeneration penalty\n * - Duration: 5 seconds\n * - Caused by: Moderate torso strikes\n */\n WINDED = \"winded\",\n \n /**\n * Gasping (헐떡임)\n * - 50% stamina regeneration penalty\n * - Duration: 10 seconds\n * - Caused by: Heavy torso strikes or multiple hits\n */\n GASPING = \"gasping\",\n \n /**\n * Severely Winded (심각한 호흡곤란)\n * - 75% stamina regeneration penalty\n * - Duration: 15 seconds\n * - Caused by: Solar plexus vital point strikes\n */\n SEVERELY_WINDED = \"severely_winded\",\n}\n\n/**\n * Breathing disruption effect extending StatusEffect.\n * \n * **Korean**: 호흡곤란 효과\n * \n * Tracks active breathing difficulty with Korean-English terminology.\n * Integrates with the status effect system for consistent duration tracking.\n * \n * @public\n * @category Combat Systems\n * @korean 호흡곤란효과\n */\nexport interface BreathingDisruptionEffect extends StatusEffect {\n /** Effect type is always BREATHLESSNESS */\n readonly type: VitalPointEffectType.BREATHLESSNESS;\n \n /** Breathing disruption severity level */\n readonly level: BreathingDisruptionLevel;\n \n /** Stamina regeneration multiplier (0.25 = 75% penalty, 0.50 = 50% penalty) */\n readonly staminaRegenMultiplier: number;\n \n /** Whether this effect can stack with additional torso hits */\n readonly stackable: true;\n}\n\n/**\n * Configuration for breathing disruption level effects.\n * \n * **Korean**: 호흡곤란 설정\n */\ninterface BreathingDisruptionConfig {\n readonly level: BreathingDisruptionLevel;\n readonly duration: number; // milliseconds\n readonly staminaRegenMultiplier: number;\n readonly koreanName: string;\n readonly englishName: string;\n readonly description: KoreanText;\n}\n\n/**\n * Breathing disruption level configurations.\n * \n * Defines stamina penalties, durations, and bilingual descriptions\n * for each severity level.\n */\nconst BREATHING_DISRUPTION_CONFIGS: Record<\n Exclude<BreathingDisruptionLevel, BreathingDisruptionLevel.NONE>,\n BreathingDisruptionConfig\n> = {\n [BreathingDisruptionLevel.WINDED]: {\n level: BreathingDisruptionLevel.WINDED,\n duration: 5000, // 5 seconds\n staminaRegenMultiplier: 0.75, // 25% penalty\n koreanName: \"바람맞음\",\n englishName: \"Winded\",\n description: {\n korean: \"중간 강도의 몸통 타격으로 호흡이 불규칙해짐\",\n english: \"Breathing is irregular from moderate torso strike\",\n romanized: \"baram-maeum\",\n },\n },\n [BreathingDisruptionLevel.GASPING]: {\n level: BreathingDisruptionLevel.GASPING,\n duration: 10000, // 10 seconds\n staminaRegenMultiplier: 0.50, // 50% penalty\n koreanName: \"헐떡임\",\n englishName: \"Gasping\",\n description: {\n korean: \"강한 몸통 타격으로 호흡이 어려워짐\",\n english: \"Heavy torso strikes cause breathing difficulty\",\n romanized: \"heoltteogim\",\n },\n },\n [BreathingDisruptionLevel.SEVERELY_WINDED]: {\n level: BreathingDisruptionLevel.SEVERELY_WINDED,\n duration: 15000, // 15 seconds\n staminaRegenMultiplier: 0.25, // 75% penalty\n koreanName: \"심각한 호흡곤란\",\n englishName: \"Severely Winded\",\n description: {\n korean: \"명치 급소 타격으로 심각한 호흡곤란 발생\",\n english: \"Solar plexus vital strike causes severe breathing disruption\",\n romanized: \"simgakhan hoheup gonnan\",\n },\n },\n};\n\n/**\n * Breathing Disruption System implementation.\n * \n * **Korean**: 호흡곤란 시스템\n * \n * Manages breathing disruption effects from torso targeting.\n * Integrates with vital point system and stamina regeneration.\n * \n * @public\n * @category Combat Systems\n */\nexport class BreathingDisruptionSystem {\n /**\n * Create a breathing disruption effect at specified severity level.\n * \n * **Korean**: 호흡곤란 효과 생성\n * \n * @param level - Severity level of breathing disruption\n * @param source - Source of the disruption (technique name, vital point, etc.)\n * @param timestamp - When the effect was applied (game time)\n * @returns BreathingDisruptionEffect ready to apply to PlayerState\n * \n * @example\n * ```typescript\n * // Solar plexus strike causes severe disruption\n * const effect = BreathingDisruptionSystem.createEffect(\n * BreathingDisruptionLevel.SEVERELY_WINDED,\n * \"명치타격 (Solar Plexus Strike)\",\n * Date.now()\n * );\n * ```\n */\n static createEffect(\n level: Exclude<BreathingDisruptionLevel, BreathingDisruptionLevel.NONE>,\n source: string,\n timestamp: number\n ): BreathingDisruptionEffect {\n const config = BREATHING_DISRUPTION_CONFIGS[level];\n \n return {\n id: `breathing_disruption_${level}_${timestamp}`,\n type: VitalPointEffectType.BREATHLESSNESS,\n level,\n intensity: this.levelToIntensity(level),\n duration: config.duration,\n staminaRegenMultiplier: config.staminaRegenMultiplier,\n description: config.description,\n stackable: true,\n source,\n startTime: timestamp,\n endTime: timestamp + config.duration,\n };\n }\n\n /**\n * Convert breathing disruption level to effect intensity.\n * \n * Maps severity levels to standardized EffectIntensity enum.\n * \n * @param level - Breathing disruption severity\n * @returns Corresponding EffectIntensity value\n */\n private static levelToIntensity(\n level: BreathingDisruptionLevel\n ): EffectIntensity {\n switch (level) {\n case BreathingDisruptionLevel.WINDED:\n return EffectIntensity.LOW;\n case BreathingDisruptionLevel.GASPING:\n return EffectIntensity.MEDIUM;\n case BreathingDisruptionLevel.SEVERELY_WINDED:\n return EffectIntensity.HIGH;\n default:\n return EffectIntensity.WEAK;\n }\n }\n\n /**\n * Calculate breathing disruption level from damage amount.\n * \n * **Korean**: 피해량으로 호흡곤란 수준 계산\n * \n * Determines appropriate disruption severity based on torso strike damage.\n * Used when vital point ID is not specified but torso region was hit.\n * \n * @param damage - Base damage of the torso strike\n * @param isSolarPlexus - Whether strike hit solar plexus vital point\n * @returns Appropriate breathing disruption level\n * \n * @example\n * ```typescript\n * // Moderate torso strike (15 damage) causes winded effect\n * const level = BreathingDisruptionSystem.calculateLevelFromDamage(15, false);\n * // level === BreathingDisruptionLevel.WINDED\n * \n * // Solar plexus vital strike (20+ damage) causes severe effect\n * const severeLevel = BreathingDisruptionSystem.calculateLevelFromDamage(25, true);\n * // severeLevel === BreathingDisruptionLevel.SEVERELY_WINDED\n * ```\n */\n static calculateLevelFromDamage(\n damage: number,\n isSolarPlexus: boolean\n ): BreathingDisruptionLevel {\n // Solar plexus vital strikes always cause severe disruption\n if (isSolarPlexus) {\n return BreathingDisruptionLevel.SEVERELY_WINDED;\n }\n\n // Thresholds for damage-based severity\n if (damage >= 20) {\n return BreathingDisruptionLevel.GASPING;\n } else if (damage >= 10) {\n return BreathingDisruptionLevel.WINDED;\n }\n\n return BreathingDisruptionLevel.NONE;\n }\n\n /**\n * Stack multiple breathing disruption effects.\n * \n * **Korean**: 호흡곤란 효과 누적\n * \n * Cumulative torso hits increase disruption duration and potentially severity.\n * Multiple hits stack duration, and severe hits can escalate the level.\n * \n * @param existingEffect - Current active breathing disruption effect\n * @param newLevel - Severity of new torso strike\n * @param source - Source of the new disruption\n * @param timestamp - Current game time\n * @returns Updated BreathingDisruptionEffect with stacked duration/severity\n * \n * @example\n * ```typescript\n * // First hit: Winded for 5 seconds\n * let effect = BreathingDisruptionSystem.createEffect(\n * BreathingDisruptionLevel.WINDED, \"Rib Strike\", 1000\n * );\n * \n * // Second hit: Stacks to Gasping with extended duration\n * effect = BreathingDisruptionSystem.stackEffect(\n * effect, BreathingDisruptionLevel.WINDED, \"Rib Strike\", 3000\n * );\n * // Now Gasping level with 10+ seconds remaining\n * ```\n */\n static stackEffect(\n existingEffect: BreathingDisruptionEffect,\n newLevel: Exclude<BreathingDisruptionLevel, BreathingDisruptionLevel.NONE>,\n source: string,\n timestamp: number\n ): BreathingDisruptionEffect {\n const newConfig = BREATHING_DISRUPTION_CONFIGS[newLevel];\n \n // Escalate to higher severity if new strike is more severe\n const effectiveLevel = this.getHigherLevel(existingEffect.level, newLevel);\n const effectiveConfig = BREATHING_DISRUPTION_CONFIGS[effectiveLevel];\n\n // Stack duration: add 50% of new effect's duration to remaining time\n const remainingTime = Math.max(0, existingEffect.endTime - timestamp);\n const additionalTime = Math.floor(newConfig.duration * 0.5);\n const totalDuration = remainingTime + additionalTime;\n\n return {\n ...existingEffect,\n level: effectiveLevel,\n intensity: this.levelToIntensity(effectiveLevel),\n duration: totalDuration,\n staminaRegenMultiplier: effectiveConfig.staminaRegenMultiplier,\n description: effectiveConfig.description,\n source: `${existingEffect.source}, ${source}`,\n endTime: timestamp + totalDuration,\n };\n }\n\n /**\n * Compare two disruption levels and return the more severe.\n * \n * @param level1 - First disruption level\n * @param level2 - Second disruption level\n * @returns The more severe of the two levels\n */\n private static getHigherLevel(\n level1: BreathingDisruptionLevel,\n level2: BreathingDisruptionLevel\n ): Exclude<BreathingDisruptionLevel, BreathingDisruptionLevel.NONE> {\n const severity = {\n [BreathingDisruptionLevel.NONE]: 0,\n [BreathingDisruptionLevel.WINDED]: 1,\n [BreathingDisruptionLevel.GASPING]: 2,\n [BreathingDisruptionLevel.SEVERELY_WINDED]: 3,\n };\n\n const higher = severity[level1] > severity[level2] ? level1 : level2;\n \n // Type guard: result can't be NONE since inputs exclude NONE\n return higher as Exclude<BreathingDisruptionLevel, BreathingDisruptionLevel.NONE>;\n }\n\n /**\n * Get active breathing disruption effect from player state.\n * \n * **Korean**: 활성 호흡곤란 효과 가져오기\n * \n * Searches player's active status effects for breathing disruption.\n * \n * @param player - Current player state\n * @returns Active BreathingDisruptionEffect or undefined\n */\n static getActiveEffect(\n player: PlayerState\n ): BreathingDisruptionEffect | undefined {\n return player.statusEffects.find(\n (effect): effect is BreathingDisruptionEffect =>\n effect.type === VitalPointEffectType.BREATHLESSNESS &&\n \"level\" in effect &&\n \"staminaRegenMultiplier\" in effect\n );\n }\n\n /**\n * Calculate stamina regeneration multiplier with breathing disruption.\n * \n * **Korean**: 호흡곤란 포함 스태미나 재생 계산\n * \n * Applies breathing disruption penalty to base stamina regeneration rate.\n * Used by stamina regeneration system each frame.\n * \n * @param player - Current player state\n * @param baseRegenRate - Base stamina regeneration per second\n * @returns Modified regeneration rate with breathing penalty applied\n * \n * @example\n * ```typescript\n * const baseRegen = 10; // 10 stamina/second normally\n * \n * // With Gasping effect (50% penalty)\n * const modifiedRegen = BreathingDisruptionSystem.calculateStaminaRegen(\n * player, baseRegen\n * );\n * // modifiedRegen === 5 (50% of base rate)\n * ```\n */\n static calculateStaminaRegen(\n player: PlayerState,\n baseRegenRate: number\n ): number {\n const activeEffect = this.getActiveEffect(player);\n \n if (!activeEffect) {\n return baseRegenRate;\n }\n\n return baseRegenRate * activeEffect.staminaRegenMultiplier;\n }\n\n /**\n * Check if player can recover from breathing disruption.\n * \n * **Korean**: 호흡곤란 회복 가능 여부 확인\n * \n * Recovery is possible when torso health > 50%.\n * Player must avoid additional torso damage to allow breathing to normalize.\n * \n * @param player - Current player state\n * @returns True if torso health supports recovery\n */\n static canRecover(player: PlayerState): boolean {\n // Check if body part health tracking is available\n if (!player.bodyPartHealth) {\n // Fallback: use overall health as proxy\n return player.health > player.maxHealth * 0.5;\n }\n\n // Calculate torso health percentage (using upper torso as primary)\n const upperTorsoHealth = player.bodyPartHealth.torsoUpper ?? 0;\n const lowerTorsoHealth = player.bodyPartHealth.torsoLower ?? 0;\n const avgTorsoHealth = (upperTorsoHealth + lowerTorsoHealth) / 2;\n \n const maxUpperTorsoHealth = player.bodyPartMaxHealth?.torsoUpper ?? 100;\n const maxLowerTorsoHealth = player.bodyPartMaxHealth?.torsoLower ?? 100;\n const avgMaxTorsoHealth = (maxUpperTorsoHealth + maxLowerTorsoHealth) / 2;\n \n const torsoHealthPercent = avgTorsoHealth / avgMaxTorsoHealth;\n\n return torsoHealthPercent > 0.5;\n }\n\n /**\n * Apply gradual recovery to breathing disruption effect.\n * \n * **Korean**: 호흡곤란 점진적 회복 적용\n * \n * When torso health > 50% and no new hits, breathing gradually improves.\n * This provides tactical gameplay: fighters with damaged torsos must fight defensively.\n * \n * @param effect - Current breathing disruption effect\n * @param deltaTime - Time since last update (milliseconds)\n * @param timestamp - Current game time\n * @returns Updated effect with recovery applied, or undefined if fully recovered\n * \n * @example\n * ```typescript\n * // Each frame with torso health > 50%\n * const updated = BreathingDisruptionSystem.applyGradualRecovery(\n * effect, 16.67, timestamp\n * );\n * // Effect duration decreases faster than normal expiration\n * ```\n */\n static applyGradualRecovery(\n effect: BreathingDisruptionEffect,\n deltaTime: number,\n timestamp: number\n ): BreathingDisruptionEffect | undefined {\n // Recovery rate: 2x faster than normal expiration\n const recoveryMultiplier = 2.0;\n const recoveryTime = deltaTime * recoveryMultiplier;\n \n const newEndTime = effect.endTime - recoveryTime;\n \n // Fully recovered if end time reached\n if (newEndTime <= timestamp) {\n return undefined;\n }\n\n return {\n ...effect,\n endTime: newEndTime,\n duration: newEndTime - effect.startTime,\n };\n }\n\n /**\n * Get breathing disruption level from player state.\n * \n * **Korean**: 플레이어 호흡곤란 수준 가져오기\n * \n * Convenience method to get current disruption level.\n * \n * @param player - Current player state\n * @returns Current breathing disruption level (NONE if no active effect)\n */\n static getCurrentLevel(player: PlayerState): BreathingDisruptionLevel {\n const activeEffect = this.getActiveEffect(player);\n return activeEffect?.level ?? BreathingDisruptionLevel.NONE;\n }\n\n /**\n * Check if breathing disruption is active.\n * \n * @param player - Current player state\n * @returns True if player has active breathing disruption\n */\n static isActive(player: PlayerState): boolean {\n return this.getCurrentLevel(player) !== BreathingDisruptionLevel.NONE;\n }\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"BreathingDisruptionSystem.js","names":[],"sources":["../../../src/systems/breathing/BreathingDisruptionSystem.ts"],"sourcesContent":["/**\n * Breathing Disruption System for realistic respiratory targeting mechanics.\n * \n * **Korean**: 호흡곤란 시스템 (Breathing Disruption System)\n * \n * This system implements realistic breathing disruption from torso strikes targeting\n * the solar plexus, ribs, and diaphragm. Breathing difficulty reduces stamina\n * regeneration and creates authentic combat trauma effects.\n * \n * ## Disruption Levels (호흡곤란 수준)\n * \n * - **Winded (바람맞음)**: 25% stamina regeneration penalty for 5 seconds\n * - **Gasping (헐떡임)**: 50% stamina regeneration penalty for 10 seconds\n * - **Severely Winded (심각한 호흡곤란)**: 75% stamina regeneration penalty for 15 seconds\n * \n * ## Korean Martial Arts Context\n * \n * Traditional Korean martial arts (태권도, 합기도, 택견) emphasize torso strikes:\n * - **명치 (Myeongchi)**: Solar plexus - instant breath disruption\n * - **늑골 (Neukgol)**: Floating ribs - cumulative breathing difficulty\n * - **횡격막 (Hoenggyeongmak)**: Diaphragm - severe respiratory impact\n * \n * ## Game Design Philosophy\n * \n * Breathing disruption creates tactical depth by:\n * 1. Rewarding torso targeting over simple head/limb attacks\n * 2. Creating stamina management gameplay - disrupted fighters must fight defensively\n * 3. Providing realistic combat trauma feedback\n * 4. Encouraging recovery periods when torso health is compromised\n * \n * @module systems/breathing\n * @category Combat Systems\n * @korean 호흡곤란시스템\n */\n\nimport { KoreanText, VitalPointEffectType } from \"@/types\";\nimport { StatusEffect } from \"@/systems/types\";\nimport { PlayerState } from \"@/systems/player\";\nimport { EffectIntensity } from \"@/systems/effects\";\n\n/**\n * Breathing disruption severity levels.\n * \n * **Korean**: 호흡곤란 수준\n * \n * Progressive levels of respiratory impairment from torso strikes.\n * Higher levels stack duration and increase stamina regeneration penalties.\n * \n * @public\n * @category Combat Systems\n * @korean 호흡곤란수준\n */\nexport enum BreathingDisruptionLevel {\n /** No breathing disruption - normal stamina regeneration */\n NONE = \"none\",\n \n /**\n * Winded (바람맞음)\n * - 25% stamina regeneration penalty\n * - Duration: 5 seconds\n * - Caused by: Moderate torso strikes\n */\n WINDED = \"winded\",\n \n /**\n * Gasping (헐떡임)\n * - 50% stamina regeneration penalty\n * - Duration: 10 seconds\n * - Caused by: Heavy torso strikes or multiple hits\n */\n GASPING = \"gasping\",\n \n /**\n * Severely Winded (심각한 호흡곤란)\n * - 75% stamina regeneration penalty\n * - Duration: 15 seconds\n * - Caused by: Solar plexus vital point strikes\n */\n SEVERELY_WINDED = \"severely_winded\",\n}\n\n/**\n * Breathing disruption effect extending StatusEffect.\n * \n * **Korean**: 호흡곤란 효과\n * \n * Tracks active breathing difficulty with Korean-English terminology.\n * Integrates with the status effect system for consistent duration tracking.\n * \n * @public\n * @category Combat Systems\n * @korean 호흡곤란효과\n */\nexport interface BreathingDisruptionEffect extends StatusEffect {\n /** Effect type is always BREATHLESSNESS */\n readonly type: VitalPointEffectType.BREATHLESSNESS;\n \n /** Breathing disruption severity level */\n readonly level: BreathingDisruptionLevel;\n \n /** Stamina regeneration multiplier (0.25 = 75% penalty, 0.50 = 50% penalty) */\n readonly staminaRegenMultiplier: number;\n \n /** Whether this effect can stack with additional torso hits */\n readonly stackable: true;\n}\n\n/**\n * Configuration for breathing disruption level effects.\n * \n * **Korean**: 호흡곤란 설정\n */\ninterface BreathingDisruptionConfig {\n readonly level: BreathingDisruptionLevel;\n readonly duration: number; // milliseconds\n readonly staminaRegenMultiplier: number;\n readonly koreanName: string;\n readonly englishName: string;\n readonly description: KoreanText;\n}\n\n/**\n * Breathing disruption level configurations.\n * \n * Defines stamina penalties, durations, and bilingual descriptions\n * for each severity level.\n */\nconst BREATHING_DISRUPTION_CONFIGS: Record<\n Exclude<BreathingDisruptionLevel, BreathingDisruptionLevel.NONE>,\n BreathingDisruptionConfig\n> = {\n [BreathingDisruptionLevel.WINDED]: {\n level: BreathingDisruptionLevel.WINDED,\n duration: 5000, // 5 seconds\n staminaRegenMultiplier: 0.75, // 25% penalty\n koreanName: \"바람맞음\",\n englishName: \"Winded\",\n description: {\n korean: \"중간 강도의 몸통 타격으로 호흡이 불규칙해짐\",\n english: \"Breathing is irregular from moderate torso strike\",\n romanized: \"baram-maeum\",\n },\n },\n [BreathingDisruptionLevel.GASPING]: {\n level: BreathingDisruptionLevel.GASPING,\n duration: 10000, // 10 seconds\n staminaRegenMultiplier: 0.50, // 50% penalty\n koreanName: \"헐떡임\",\n englishName: \"Gasping\",\n description: {\n korean: \"강한 몸통 타격으로 호흡이 어려워짐\",\n english: \"Heavy torso strikes cause breathing difficulty\",\n romanized: \"heoltteogim\",\n },\n },\n [BreathingDisruptionLevel.SEVERELY_WINDED]: {\n level: BreathingDisruptionLevel.SEVERELY_WINDED,\n duration: 15000, // 15 seconds\n staminaRegenMultiplier: 0.25, // 75% penalty\n koreanName: \"심각한 호흡곤란\",\n englishName: \"Severely Winded\",\n description: {\n korean: \"명치 급소 타격으로 심각한 호흡곤란 발생\",\n english: \"Solar plexus vital strike causes severe breathing disruption\",\n romanized: \"simgakhan hoheup gonnan\",\n },\n },\n};\n\n/**\n * Breathing Disruption System implementation.\n * \n * **Korean**: 호흡곤란 시스템\n * \n * Manages breathing disruption effects from torso targeting.\n * Integrates with vital point system and stamina regeneration.\n * \n * @public\n * @category Combat Systems\n */\nexport class BreathingDisruptionSystem {\n /**\n * Create a breathing disruption effect at specified severity level.\n * \n * **Korean**: 호흡곤란 효과 생성\n * \n * @param level - Severity level of breathing disruption\n * @param source - Source of the disruption (technique name, vital point, etc.)\n * @param timestamp - When the effect was applied (game time)\n * @returns BreathingDisruptionEffect ready to apply to PlayerState\n * \n * @example\n * ```typescript\n * // Solar plexus strike causes severe disruption\n * const effect = BreathingDisruptionSystem.createEffect(\n * BreathingDisruptionLevel.SEVERELY_WINDED,\n * \"명치타격 (Solar Plexus Strike)\",\n * Date.now()\n * );\n * ```\n */\n static createEffect(\n level: Exclude<BreathingDisruptionLevel, BreathingDisruptionLevel.NONE>,\n source: string,\n timestamp: number\n ): BreathingDisruptionEffect {\n const config = BREATHING_DISRUPTION_CONFIGS[level];\n \n return {\n id: `breathing_disruption_${level}_${timestamp}`,\n type: VitalPointEffectType.BREATHLESSNESS,\n level,\n intensity: this.levelToIntensity(level),\n duration: config.duration,\n staminaRegenMultiplier: config.staminaRegenMultiplier,\n description: config.description,\n stackable: true,\n source,\n startTime: timestamp,\n endTime: timestamp + config.duration,\n };\n }\n\n /**\n * Convert breathing disruption level to effect intensity.\n * \n * Maps severity levels to standardized EffectIntensity enum.\n * \n * @param level - Breathing disruption severity\n * @returns Corresponding EffectIntensity value\n */\n private static levelToIntensity(\n level: BreathingDisruptionLevel\n ): EffectIntensity {\n switch (level) {\n case BreathingDisruptionLevel.WINDED:\n return EffectIntensity.LOW;\n case BreathingDisruptionLevel.GASPING:\n return EffectIntensity.MEDIUM;\n case BreathingDisruptionLevel.SEVERELY_WINDED:\n return EffectIntensity.HIGH;\n default:\n return EffectIntensity.WEAK;\n }\n }\n\n /**\n * Calculate breathing disruption level from damage amount.\n * \n * **Korean**: 피해량으로 호흡곤란 수준 계산\n * \n * Determines appropriate disruption severity based on torso strike damage.\n * Used when vital point ID is not specified but torso region was hit.\n * \n * @param damage - Base damage of the torso strike\n * @param isSolarPlexus - Whether strike hit solar plexus vital point\n * @returns Appropriate breathing disruption level\n * \n * @example\n * ```typescript\n * // Moderate torso strike (15 damage) causes winded effect\n * const level = BreathingDisruptionSystem.calculateLevelFromDamage(15, false);\n * // level === BreathingDisruptionLevel.WINDED\n * \n * // Solar plexus vital strike (20+ damage) causes severe effect\n * const severeLevel = BreathingDisruptionSystem.calculateLevelFromDamage(25, true);\n * // severeLevel === BreathingDisruptionLevel.SEVERELY_WINDED\n * ```\n */\n static calculateLevelFromDamage(\n damage: number,\n isSolarPlexus: boolean\n ): BreathingDisruptionLevel {\n // Solar plexus vital strikes always cause severe disruption\n if (isSolarPlexus) {\n return BreathingDisruptionLevel.SEVERELY_WINDED;\n }\n\n // Thresholds for damage-based severity\n if (damage >= 20) {\n return BreathingDisruptionLevel.GASPING;\n } else if (damage >= 10) {\n return BreathingDisruptionLevel.WINDED;\n }\n\n return BreathingDisruptionLevel.NONE;\n }\n\n /**\n * Stack multiple breathing disruption effects.\n * \n * **Korean**: 호흡곤란 효과 누적\n * \n * Cumulative torso hits increase disruption duration and potentially severity.\n * Multiple hits stack duration, and severe hits can escalate the level.\n * \n * @param existingEffect - Current active breathing disruption effect\n * @param newLevel - Severity of new torso strike\n * @param source - Source of the new disruption\n * @param timestamp - Current game time\n * @returns Updated BreathingDisruptionEffect with stacked duration/severity\n * \n * @example\n * ```typescript\n * // First hit: Winded for 5 seconds\n * let effect = BreathingDisruptionSystem.createEffect(\n * BreathingDisruptionLevel.WINDED, \"Rib Strike\", 1000\n * );\n * \n * // Second hit: Stacks to Gasping with extended duration\n * effect = BreathingDisruptionSystem.stackEffect(\n * effect, BreathingDisruptionLevel.WINDED, \"Rib Strike\", 3000\n * );\n * // Now Gasping level with 10+ seconds remaining\n * ```\n */\n static stackEffect(\n existingEffect: BreathingDisruptionEffect,\n newLevel: Exclude<BreathingDisruptionLevel, BreathingDisruptionLevel.NONE>,\n source: string,\n timestamp: number\n ): BreathingDisruptionEffect {\n const newConfig = BREATHING_DISRUPTION_CONFIGS[newLevel];\n \n // Escalate to higher severity if new strike is more severe\n const effectiveLevel = this.getHigherLevel(existingEffect.level, newLevel);\n const effectiveConfig = BREATHING_DISRUPTION_CONFIGS[effectiveLevel];\n\n // Stack duration: add 50% of new effect's duration to remaining time\n const remainingTime = Math.max(0, existingEffect.endTime - timestamp);\n const additionalTime = Math.floor(newConfig.duration * 0.5);\n const totalDuration = remainingTime + additionalTime;\n\n return {\n ...existingEffect,\n level: effectiveLevel,\n intensity: this.levelToIntensity(effectiveLevel),\n duration: totalDuration,\n staminaRegenMultiplier: effectiveConfig.staminaRegenMultiplier,\n description: effectiveConfig.description,\n source: `${existingEffect.source}, ${source}`,\n endTime: timestamp + totalDuration,\n };\n }\n\n /**\n * Compare two disruption levels and return the more severe.\n * \n * @param level1 - First disruption level\n * @param level2 - Second disruption level\n * @returns The more severe of the two levels\n */\n private static getHigherLevel(\n level1: BreathingDisruptionLevel,\n level2: BreathingDisruptionLevel\n ): Exclude<BreathingDisruptionLevel, BreathingDisruptionLevel.NONE> {\n const severity = {\n [BreathingDisruptionLevel.NONE]: 0,\n [BreathingDisruptionLevel.WINDED]: 1,\n [BreathingDisruptionLevel.GASPING]: 2,\n [BreathingDisruptionLevel.SEVERELY_WINDED]: 3,\n };\n\n const higher = severity[level1] > severity[level2] ? level1 : level2;\n \n // Type guard: result can't be NONE since inputs exclude NONE\n return higher as Exclude<BreathingDisruptionLevel, BreathingDisruptionLevel.NONE>;\n }\n\n /**\n * Get active breathing disruption effect from player state.\n * \n * **Korean**: 활성 호흡곤란 효과 가져오기\n * \n * Searches player's active status effects for breathing disruption.\n * \n * @param player - Current player state\n * @returns Active BreathingDisruptionEffect or undefined\n */\n static getActiveEffect(\n player: PlayerState\n ): BreathingDisruptionEffect | undefined {\n return player.statusEffects.find(\n (effect): effect is BreathingDisruptionEffect =>\n effect.type === VitalPointEffectType.BREATHLESSNESS &&\n \"level\" in effect &&\n \"staminaRegenMultiplier\" in effect\n );\n }\n\n /**\n * Calculate stamina regeneration multiplier with breathing disruption.\n * \n * **Korean**: 호흡곤란 포함 스태미나 재생 계산\n * \n * Applies breathing disruption penalty to base stamina regeneration rate.\n * Used by stamina regeneration system each frame.\n * \n * @param player - Current player state\n * @param baseRegenRate - Base stamina regeneration per second\n * @returns Modified regeneration rate with breathing penalty applied\n * \n * @example\n * ```typescript\n * const baseRegen = 10; // 10 stamina/second normally\n * \n * // With Gasping effect (50% penalty)\n * const modifiedRegen = BreathingDisruptionSystem.calculateStaminaRegen(\n * player, baseRegen\n * );\n * // modifiedRegen === 5 (50% of base rate)\n * ```\n */\n static calculateStaminaRegen(\n player: PlayerState,\n baseRegenRate: number\n ): number {\n const activeEffect = this.getActiveEffect(player);\n \n if (!activeEffect) {\n return baseRegenRate;\n }\n\n return baseRegenRate * activeEffect.staminaRegenMultiplier;\n }\n\n /**\n * Check if player can recover from breathing disruption.\n * \n * **Korean**: 호흡곤란 회복 가능 여부 확인\n * \n * Recovery is possible when torso health > 50%.\n * Player must avoid additional torso damage to allow breathing to normalize.\n * \n * @param player - Current player state\n * @returns True if torso health supports recovery\n */\n static canRecover(player: PlayerState): boolean {\n // Check if body part health tracking is available\n if (!player.bodyPartHealth) {\n // Fallback: use overall health as proxy\n return player.health > player.maxHealth * 0.5;\n }\n\n // Calculate torso health percentage (using upper torso as primary)\n const upperTorsoHealth = player.bodyPartHealth.torsoUpper ?? 0;\n const lowerTorsoHealth = player.bodyPartHealth.torsoLower ?? 0;\n const avgTorsoHealth = (upperTorsoHealth + lowerTorsoHealth) / 2;\n \n const maxUpperTorsoHealth = player.bodyPartMaxHealth?.torsoUpper ?? 100;\n const maxLowerTorsoHealth = player.bodyPartMaxHealth?.torsoLower ?? 100;\n const avgMaxTorsoHealth = (maxUpperTorsoHealth + maxLowerTorsoHealth) / 2;\n \n const torsoHealthPercent = avgTorsoHealth / avgMaxTorsoHealth;\n\n return torsoHealthPercent > 0.5;\n }\n\n /**\n * Apply gradual recovery to breathing disruption effect.\n * \n * **Korean**: 호흡곤란 점진적 회복 적용\n * \n * When torso health > 50% and no new hits, breathing gradually improves.\n * This provides tactical gameplay: fighters with damaged torsos must fight defensively.\n * \n * @param effect - Current breathing disruption effect\n * @param deltaTime - Time since last update (milliseconds)\n * @param timestamp - Current game time\n * @returns Updated effect with recovery applied, or undefined if fully recovered\n * \n * @example\n * ```typescript\n * // Each frame with torso health > 50%\n * const updated = BreathingDisruptionSystem.applyGradualRecovery(\n * effect, 16.67, timestamp\n * );\n * // Effect duration decreases faster than normal expiration\n * ```\n */\n static applyGradualRecovery(\n effect: BreathingDisruptionEffect,\n deltaTime: number,\n timestamp: number\n ): BreathingDisruptionEffect | undefined {\n // Recovery rate: 2x faster than normal expiration\n const recoveryMultiplier = 2.0;\n const recoveryTime = deltaTime * recoveryMultiplier;\n \n const newEndTime = effect.endTime - recoveryTime;\n \n // Fully recovered if end time reached\n if (newEndTime <= timestamp) {\n return undefined;\n }\n\n return {\n ...effect,\n endTime: newEndTime,\n duration: newEndTime - effect.startTime,\n };\n }\n\n /**\n * Get breathing disruption level from player state.\n * \n * **Korean**: 플레이어 호흡곤란 수준 가져오기\n * \n * Convenience method to get current disruption level.\n * \n * @param player - Current player state\n * @returns Current breathing disruption level (NONE if no active effect)\n */\n static getCurrentLevel(player: PlayerState): BreathingDisruptionLevel {\n const activeEffect = this.getActiveEffect(player);\n return activeEffect?.level ?? BreathingDisruptionLevel.NONE;\n }\n\n /**\n * Check if breathing disruption is active.\n * \n * @param player - Current player state\n * @returns True if player has active breathing disruption\n */\n static isActive(player: PlayerState): boolean {\n return this.getCurrentLevel(player) !== BreathingDisruptionLevel.NONE;\n }\n}\n"],"mappings":"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"}