blacktrigram 0.7.8 → 0.7.9

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 (38) hide show
  1. package/ARCHITECTURE.md +2404 -0
  2. package/COMBAT_ARCHITECTURE.md +3322 -0
  3. package/CONTROLS.md +639 -0
  4. package/CRA-ASSESSMENT.md +508 -0
  5. package/DATA_MODEL.md +675 -0
  6. package/ISMS_REFERENCE_MAPPING.md +513 -0
  7. package/SECURITY_ARCHITECTURE.md +1160 -0
  8. package/THREAT_MODEL.md +1163 -0
  9. package/lib/components/screens/intro/IntroScreen3D.js +1 -1
  10. package/lib/components/shared/ui/SplashScreen.js +2 -2
  11. package/lib/data/archetypeClothing.js +1 -1
  12. package/lib/data/archetypePhysicalAttributes.js +158 -1
  13. package/lib/data/archetypePhysicalAttributes.js.map +1 -1
  14. package/lib/data/index.d.ts +14 -0
  15. package/lib/data/index.d.ts.map +1 -0
  16. package/lib/data/index.js +43 -0
  17. package/lib/data/index.js.map +1 -0
  18. package/lib/data/techniqueMappings.js +47 -2
  19. package/lib/data/techniqueMappings.js.map +1 -1
  20. package/lib/data/techniques.js +1 -1
  21. package/lib/hooks/index.d.ts +29 -0
  22. package/lib/hooks/index.d.ts.map +1 -0
  23. package/lib/hooks/index.js +53 -0
  24. package/lib/hooks/index.js.map +1 -0
  25. package/lib/hooks/useDebounce.js +52 -0
  26. package/lib/hooks/useDebounce.js.map +1 -0
  27. package/lib/hooks/usePauseMenu.js +60 -0
  28. package/lib/hooks/usePauseMenu.js.map +1 -0
  29. package/lib/hooks/useResponsiveLayout.js +160 -0
  30. package/lib/hooks/useResponsiveLayout.js.map +1 -0
  31. package/lib/hooks/useWebGLContextLossHandler.js +36 -1
  32. package/lib/hooks/useWebGLContextLossHandler.js.map +1 -1
  33. package/lib/hooks/useWindowSize.js +19 -1
  34. package/lib/hooks/useWindowSize.js.map +1 -1
  35. package/lib/index.d.ts +2 -0
  36. package/lib/index.d.ts.map +1 -1
  37. package/lib/index.js +3 -1
  38. package/package.json +19 -3
@@ -0,0 +1,3322 @@
1
+ # ⚔️ Black Trigram (흑괘) – Combat System Architecture
2
+
3
+ **🔐 ISMS Alignment:** This document follows [Hack23 Secure Development Policy](https://github.com/Hack23/ISMS-PUBLIC/blob/main/Secure_Development_Policy.md) for secure system architecture documentation.
4
+
5
+ **2D Realistic Precision Combat Simulator** rooted in Korean martial arts and I Ching philosophy.
6
+
7
+ - **Audio-Visual Feedback**: 국악 (traditional Korean instruments) blended with cyberpunk aesthetics for immersive combat cues.
8
+ - **Anatomical Targeting**: 70 vital points with realistic damage calculation
9
+ - **Cultural Authenticity**: Traditional Korean martial arts with modern implementation
10
+ - **Dark Ops Integration**: 15 specialized techniques from Korean special operations units
11
+ - **Injury-Based Movement Penalties**: Realistic leg/body damage affects movement speed and stance changes
12
+
13
+ **Latest Update**:
14
+ - **December 2024**: Added Dark Ops unit combat techniques (암흑작전부대 기술) for tactical assassination and silent incapacitation methods used by Korean special operations forces.
15
+ - **December 2024**: Implemented Injury-Based Movement Penalty System (이동 패널티 시스템) for realistic leg damage affecting mobility, stance changes, and balance.
16
+ - **Q1 2026**: Completed comprehensive documentation of all 70 vital points across 4 anatomical systems with damage calculation examples.
17
+ - **January 2026**: ✨ Integrated Grappling System (잡기 체계) with authentic Hapkido/Ssireum techniques, 4 animation states, and grip mechanics.
18
+ - **January 2026**: ✨ Integrated Limb Exposure & Counter-Attack System (사지 노출 및 반격 체계) with AI decision integration, visual indicators, and 132 comprehensive tests.
19
+
20
+ ## 📚 Quick Navigation
21
+
22
+ ### Core Systems
23
+ - [🔧 Core Combat System Architecture](#-core-combat-system-architecture) - System overview and architecture diagram
24
+ - [☰ Trigram Combat System](#-trigram-combat-system-팔괘-무술-체계) - 8 stance system with I Ching philosophy
25
+ - [🎯 Vital Point Targeting System](#-vital-point-targeting-system-급소-타격-체계) - 70 vital points overview
26
+ - [🤜 Grappling System](#-grappling-system-잡기-체계) - ✨ **NEW**: Hapkido/Ssireum grappling with grip decay and escape mechanics
27
+ - [⚡ Limb Exposure & Counter-Attacks](#-limb-exposure--counter-attack-system-사지-노출-및-반격-체계) - ✨ **NEW**: Vulnerability windows with AI integration
28
+
29
+ ### Complete 70 Vital Points Documentation
30
+ - [💀 Complete 70 Vital Points System](#-complete-70-vital-points-system-70개-급소-완전-체계) - **NEW**: All 70 vital points organized by anatomical system
31
+ - [🧠 Nervous System (25 points)](#-nervous-system-targets-신경계-급소---25-points) - Paralysis, unconsciousness, stunning
32
+ - [🩸 Circulatory System (15 points)](#-circulatory-system-targets-순환계-급소---15-points) - Blood flow disruption, hemorrhage
33
+ - [🫁 Respiratory System (10 points)](#-respiratory-system-targets-호흡기계-급소---10-points) - Breathing disruption, suffocation
34
+ - [🦴 Musculoskeletal System (20 points)](#-musculoskeletal-system-targets-근골격계-급소---20-points) - Joint locks, bone strikes, mobility loss
35
+
36
+ ### Combat Mechanics
37
+ - [⚙️ Damage Calculation System](#️-damage-calculation-system-데미지-계산-시스템) - **NEW**: Complete damage formulas with 3 worked examples
38
+ - [🦴 28-Bone Skeletal Animation](#-28-bone-skeletal-animation-system-28개-뼈-골격-애니메이션) - **NEW**: Skeletal rig with 7 hand poses
39
+ - [💊 Status Effect System](#-status-effect-system-상태-효과-시스템) - **NEW**: 5 status effects (Stun, Bleed, Fatigue, Paralysis, Disorientation)
40
+ - [🤖 Combat AI Behavior](#-combat-ai-behavior-system-전투-ai-행동-시스템) - **NEW**: AI decision trees and vital point selection logic
41
+ - [⚡ Performance Optimization](#️-performance-optimization-for-60fps-60fps-성능-최적화) - **NEW**: 60fps optimization techniques
42
+ - [⚖️ Balance Considerations](#️-balance-considerations-밸런스-고려사항) - **NEW**: Game balance philosophy and tuning guidelines
43
+
44
+ ### Player Systems
45
+ - [👤 Player Archetype Combat Specializations](#-player-archetype-combat-specializations-무사-유형별-전투-특화) - 5 fighter archetypes
46
+ - [🌑 Dark Ops Unit Combat Techniques](#-dark-ops-unit-combat-techniques-암흑작전부대-기술) - 15 specialized assassination techniques
47
+ - [🦵 Injury-Based Movement Penalty System](#-injury-based-movement-penalty-system-이동-패널티-시스템) - Realistic damage affecting mobility
48
+ - [🧬 Physical Attributes System](#-physical-attributes-system-신체-속성-시스템) - Stats and attribute mechanics
49
+
50
+ ### Animation Systems
51
+ - [🥋 Fighting Stance Guard Animation System](#-fighting-stance-guard-animation-system-자세-방어-애니메이션) - Defensive stance animations
52
+ - [🎬 Complete Animation Coverage System](#-complete-animation-coverage-system-완전한-애니메이션-커버리지) - Full combat animation catalog
53
+ - [🔄 Stance Transition Animation System](#-stance-transition-animation-system-팔괘전환-애니메이션) - Trigram stance transitions
54
+ - [🤕 Fall Down Animation System](#-fall-down-animation-system-낙법-애니메이션-시스템) - Knockdown and fall animations
55
+ - [🏃 Recovery Animation System](#-recovery-animation-system-기상-애니메이션-시스템) - Getting up from knockdown
56
+
57
+ ### Implementation
58
+ - [🎮 Combat Component Architecture](#-combat-component-architecture) - Component structure
59
+ - [🔊 Audio System Integration](#-audio-system-integration) - Korean traditional music integration
60
+ - [📊 Type System Foundation](#-type-system-foundation) - TypeScript interfaces
61
+ - [🚀 Implementation Priority Matrix](#-implementation-priority-matrix) - Development roadmap
62
+ - [💡 Technical Specifications](#-technical-specifications) - Performance and cultural standards
63
+ - [🎯 Success Metrics](#-success-metrics) - Combat effectiveness goals
64
+
65
+ ### External References
66
+ - **[docs/vital-points/VITAL_POINTS_REFERENCE.md](./docs/vital-points/VITAL_POINTS_REFERENCE.md)** - Complete anatomical documentation with TCM meridian associations
67
+ - **[docs/combat/damage-calculation-guide.md](./docs/combat/damage-calculation-guide.md)** - Quick-reference damage calculation overview and formulas
68
+ - **[game-design.md](./game-design.md)** - Overall game design document
69
+ - **[ARCHITECTURE.md](./ARCHITECTURE.md)** - System architecture overview
70
+ - **[game-status.md](./game-status.md)** - Current implementation status
71
+
72
+ ---
73
+
74
+ Below, we define the Combat System's architecture in detail.
75
+
76
+ ---
77
+
78
+ ## 🔧 Core Combat System Architecture
79
+
80
+ ```mermaid
81
+ graph TB
82
+ subgraph "Combat System Controller (src/systems/CombatSystem.ts)"
83
+ CSC[CombatSystemController]:::core
84
+ CSC --> TCS[TrigramSystemFactory]:::trigram
85
+ CSC --> VPS[VitalPointSystemFactory]:::vital
86
+ CSC --> KTS[KoreanTechniqueSystemFactory]:::tech
87
+ CSC --> DCS[DamageCalculationEngine]:::damage
88
+ CSC --> AFS[AudioFeedbackSystem]:::audio
89
+ end
90
+
91
+ subgraph "Type System Foundation"
92
+ TS[Type System]:::types
93
+ TS --> CT[Combat Types]:::types
94
+ TS --> PT[Player Types]:::types
95
+ TS --> AT[Anatomy Types]:::types
96
+ TS --> TT[Trigram Types]:::types
97
+ TS --> AuT[Audio Types]:::types
98
+ end
99
+
100
+ subgraph "Trigram Combat Engine (src/systems/TrigramSystem.ts)"
101
+ TCS --> SM[StanceManager]:::trigram
102
+ TCS --> TC[TrigramCalculator]:::trigram
103
+ TCS --> TR[TransitionCalculator]:::trigram
104
+ TCS --> KC[KoreanCulture]:::trigram
105
+ TCS --> KT[KoreanTechniques]:::trigram
106
+ end
107
+
108
+ subgraph "Vital Point System (src/systems/VitalPointSystem.ts)"
109
+ VPS --> KA[KoreanAnatomy]:::vital
110
+ VPS --> KVP[KoreanVitalPoints]:::vital
111
+ VPS --> AR[AnatomicalRegions]:::vital
112
+ VPS --> HD[HitDetection]:::vital
113
+ VPS --> DC[DamageCalculator]:::vital
114
+ end
115
+
116
+ subgraph "Component Layer"
117
+ CMP[Combat Components]:::components
118
+ CMP --> CS[CombatScreen]:::components
119
+ CMP --> CA[CombatArena]:::components
120
+ CMP --> CH[CombatHUD]:::components
121
+ CMP --> CC[CombatControls]:::components
122
+ end
123
+
124
+ classDef core fill:#00ffd0,stroke:#333,color:#000,stroke-width:3px
125
+ classDef trigram fill:#ffd700,stroke:#333,color:#000,stroke-width:2px
126
+ classDef vital fill:#ff6b6b,stroke:#333,color:#000,stroke-width:2px
127
+ classDef tech fill:#4caf50,stroke:#333,color:#000,stroke-width:2px
128
+ classDef damage fill:#ff8c00,stroke:#333,color:#000,stroke-width:2px
129
+ classDef audio fill:#87CEFA,stroke:#333,color:#000,stroke-width:2px
130
+ classDef types fill:#9370db,stroke:#333,color:#000,stroke-width:2px
131
+ classDef components fill:#32cd32,stroke:#333,color:#000,stroke-width:2px
132
+
133
+ CSC -.->|uses| TS
134
+ CMP -.->|implements| CSC
135
+ ```
136
+
137
+ ---
138
+
139
+ ## 🎯 Combat System Controller Architecture
140
+
141
+ - **CombatSystemController** (`src/systems/CombatSystem.ts`):
142
+ - **Status**: Currently empty, needs full implementation
143
+ - **Planned Methods**:
144
+ - `executeKoreanTechnique(attacker, techniqueName, target)`: Execute authentic Korean martial arts techniques
145
+ - `calculateTrigramAdvantage(attackerStance, defenderStance)`: I Ching-based stance effectiveness
146
+ - `processVitalPointHit(targetState, hitPosition, technique)`: Anatomical damage calculation
147
+ - `validateTechnique(playerState, techniqueName)`: Check stance compatibility and resources
148
+ - `update(deltaTime, playerInputs)`: 60 FPS combat state advancement
149
+
150
+ ---
151
+
152
+ ## ☰ Trigram Combat System (팔괘 무술 체계)
153
+
154
+ ```mermaid
155
+ graph LR
156
+ subgraph "Eight Trigram Stances (팔괘)"
157
+ G[☰ 건 Geon<br/>Heaven]:::geon
158
+ T[☱ 태 Tae<br/>Lake]:::tae
159
+ L[☲ 리 Li<br/>Fire]:::li
160
+ J[☳ 진 Jin<br/>Thunder]:::jin
161
+ S[☴ 손 Son<br/>Wind]:::son
162
+ GA[☵ 감 Gam<br/>Water]:::gam
163
+ GN[☶ 간 Gan<br/>Mountain]:::gan
164
+ GO[☷ 곤 Gon<br/>Earth]:::gon
165
+ end
166
+
167
+ subgraph "Trigram System Components"
168
+ SM[StanceManager]:::sys
169
+ TC[TrigramCalculator]:::sys
170
+ TR[TransitionCalculator]:::sys
171
+ KT[KoreanTechniques]:::sys
172
+ end
173
+
174
+ G --> SM
175
+ T --> SM
176
+ L --> SM
177
+ J --> SM
178
+ S --> SM
179
+ GA --> SM
180
+ GN --> SM
181
+ GO --> SM
182
+
183
+ SM --> TC
184
+ TC --> TR
185
+ TR --> KT
186
+
187
+ classDef geon fill:#ffd700,stroke:#333,color:#000
188
+ classDef tae fill:#87ceeb,stroke:#333,color:#000
189
+ classDef li fill:#ff4500,stroke:#333,color:#fff
190
+ classDef jin fill:#9370db,stroke:#333,color:#fff
191
+ classDef son fill:#98fb98,stroke:#333,color:#000
192
+ classDef gam fill:#4169e1,stroke:#333,color:#fff
193
+ classDef gan fill:#8b4513,stroke:#333,color:#fff
194
+ classDef gon fill:#654321,stroke:#333,color:#fff
195
+ classDef sys fill:#333,stroke:#ffd700,color:#ffd700,stroke-width:2px
196
+ ```
197
+
198
+ ### Current Implementation Status:
199
+
200
+ - **StanceManager** (`src/systems/trigram/StanceManager.ts`): ❌ Empty - needs full implementation
201
+ - **TrigramCalculator** (`src/systems/trigram/TrigramCalculator.ts`): ❌ Empty - needs stance effectiveness matrix
202
+ - **TransitionCalculator** (`src/systems/trigram/TransitionCalculator.ts`): ❌ Empty - needs Ki/Stamina cost calculation
203
+ - **KoreanTechniques** (`src/systems/trigram/KoreanTechniques.ts`): ❌ Empty - needs authentic technique database
204
+ - **KoreanCulture** (`src/systems/trigram/KoreanCulture.ts`): ❌ Empty - needs cultural context system
205
+
206
+ ---
207
+
208
+ ## 🥋 Fighting Stance Guard Animation System (자세 방어 애니메이션)
209
+
210
+ **Added**: January 2025 - Authentic Korean martial arts guard positions with breathing animations
211
+
212
+ The Fighting Stance Guard Animation System provides stance-specific defensive postures for all 8 trigram stances, implementing authentic Korean martial arts guard positions with realistic breathing animations at 60fps.
213
+
214
+ ### Guard Pose Architecture
215
+
216
+ Each of the 8 trigram stances has a unique default guard pose that reflects traditional Korean martial arts positioning:
217
+
218
+ ```typescript
219
+ interface StanceGuardPose {
220
+ leftArm: { shoulder: Euler; elbow: Euler; wrist: Euler };
221
+ rightArm: { shoulder: Euler; elbow: Euler; wrist: Euler };
222
+ torso: Euler;
223
+ weight: 'forward' | 'neutral' | 'back';
224
+ breathingRange: { min: number; max: number };
225
+ }
226
+ ```
227
+
228
+ ### Eight Trigram Guard Positions
229
+
230
+ | Trigram | Korean | Guard Type | Weight | Breathing | Martial Arts Basis |
231
+ |---------|--------|------------|--------|-----------|-------------------|
232
+ | ☰ 건 | Heaven | High Guard | Forward | 6 frames | Taekwondo Ap Seogi |
233
+ | ☱ 태 | Lake | Fluid Mid-Guard | Forward | 6 frames | Taekwondo Ap Koobi Seogi |
234
+ | ☲ 리 | Fire | Aggressive Forward | Neutral | 4 frames | Taekwondo Juchum Seogi |
235
+ | ☳ 진 | Thunder | Explosive Ready | Back | 5 frames | Taekwondo Dwi Koobi Seogi |
236
+ | ☴ 손 | Wind | Continuous Motion | Neutral | 6 frames | Taekwondo Niunja Seogi |
237
+ | ☵ 감 | Water | Flowing Defensive | Neutral | 6 frames | Taekwondo Narani Seogi |
238
+ | ☶ 간 | Mountain | Solid Defensive | Neutral | 4 frames | Taekwondo Gibo Seogi |
239
+ | ☷ 곤 | Earth | Grounded Low | Neutral | 5 frames | Taekwondo Joong Ha Seogi |
240
+
241
+ ### Animation State Integration
242
+
243
+ ```mermaid
244
+ graph LR
245
+ subgraph "Guard Animation States"
246
+ SG1[stance_guard_geon]:::guard
247
+ SG2[stance_guard_tae]:::guard
248
+ SG3[stance_guard_li]:::guard
249
+ SG4[stance_guard_jin]:::guard
250
+ SG5[stance_guard_son]:::guard
251
+ SG6[stance_guard_gam]:::guard
252
+ SG7[stance_guard_gan]:::guard
253
+ SG8[stance_guard_gon]:::guard
254
+ end
255
+
256
+ subgraph "Combat Actions"
257
+ ATK[Attack]:::action
258
+ DEF[Defend]:::action
259
+ MOV[Movement]:::action
260
+ end
261
+
262
+ subgraph "Stance System"
263
+ SC[Stance Change<br/>600ms]:::stance
264
+ end
265
+
266
+ SG1 --> ATK
267
+ SG2 --> ATK
268
+ SG1 --> DEF
269
+ SG1 --> MOV
270
+ SG1 --> SC
271
+ ATK --> SG1
272
+ DEF --> SG1
273
+ MOV --> SG1
274
+ SC --> SG1
275
+
276
+ classDef guard fill:#00ffd0,stroke:#333,color:#000,stroke-width:2px
277
+ classDef action fill:#ff6b6b,stroke:#333,color:#fff,stroke-width:2px
278
+ classDef stance fill:#ffd700,stroke:#333,color:#000,stroke-width:2px
279
+ ```
280
+
281
+ ### Breathing Animation System
282
+
283
+ Each guard implements authentic martial arts breathing patterns:
284
+
285
+ **Breathing Frame Counts**:
286
+ - **Power Stances** (Heaven, Thunder, Earth): 5-6 frames for deep breathing
287
+ - **Precision Stances** (Fire, Mountain): 4 frames for controlled breathing
288
+ - **Fluid Stances** (Lake, Wind, Water): 6 frames for flowing breathing
289
+
290
+ **Breathing Range**:
291
+ - Min: 0.96-0.99 (inhale, chest expansion)
292
+ - Max: 1.01-1.04 (exhale, chest contraction)
293
+ - Target FPS: 60fps for smooth animation
294
+
295
+ ### Implementation Files
296
+
297
+ **Core System**:
298
+ - `src/systems/animation/StanceGuardPoses.ts` - Guard pose configurations (8 stances)
299
+ - `src/systems/animation/AnimationStateMachine.ts` - State machine with guard support
300
+ - `src/systems/animation/AnimationTransitions.ts` - Guard transition rules (264 rules)
301
+ - `src/types/skeletal.ts` - Guard pose type definitions
302
+
303
+ **Helper Methods**:
304
+ ```typescript
305
+ // Transition to stance-specific guard
306
+ machine.transitionToStanceGuard(TrigramStance.GEON);
307
+
308
+ // Check if in guard state
309
+ if (machine.isInStanceGuard()) {
310
+ const currentGuardStance = machine.getCurrentGuardStance();
311
+ }
312
+
313
+ // Get guard pose for rendering
314
+ const guardPose = getGuardPoseForStance(TrigramStance.LI);
315
+ ```
316
+
317
+ ### Korean Martial Arts Authenticity
318
+
319
+ Each guard position is based on traditional Korean martial arts stances (자세):
320
+
321
+ **☰ 건 (Geon) - Heaven**: High guard based on 앞서기 (Ap Seogi - Walking Stance)
322
+ - Hands raised to shoulder level or above
323
+ - Weight 60% forward for aggressive positioning
324
+ - Ready for overhead strikes and bone-breaking techniques
325
+ - Breathing emphasizes chest expansion for power generation
326
+
327
+ **☱ 태 (Tae) - Lake**: Fluid mid-guard based on 앞굽이 (Ap Koobi Seogi - Front Stance)
328
+ - Hands at mid-level (chest height)
329
+ - Extended reach for joint locks and throws (+15% reach bonus)
330
+ - Weight forward for throwing leverage
331
+ - Smooth flowing breathing for continuous adaptation
332
+
333
+ **☲ 리 (Li) - Fire**: Aggressive forward guard based on 주춤 (Juchum Seogi - Horse Stance)
334
+ - Hands forward in striking position
335
+ - Low center of gravity for stability (+15% stability vs vital strikes)
336
+ - Neutral weight but ready to explode forward
337
+ - Controlled shallow breathing for precision (+5% crit chance)
338
+
339
+ **☳ 진 (Jin) - Thunder**: Explosive ready stance based on 뒤굽이 (Dwi Koobi Seogi - Back Stance)
340
+ - Hands chambered high for explosive release
341
+ - Weight 70% back for sudden forward burst
342
+ - Ready for shocking nerve strikes (+15% shock damage)
343
+ - Deep breathing for power generation
344
+
345
+ **☴ 손 (Son) - Wind**: Continuous motion guard based on 니은자 (Niunja Seogi - L-Stance)
346
+ - Hands in flowing circular pattern
347
+ - Neutral weight for lateral movement (+10% lateral mobility)
348
+ - Ready for pressure point sequences (+10% chaining speed)
349
+ - Rhythmic breathing for sustained combos
350
+
351
+ **☵ 감 (Gam) - Water**: Flowing defensive guard based on 나란이 (Narani Seogi - Parallel Stance)
352
+ - Hands low and flowing
353
+ - Centered weight for adaptability (+10% counter speed)
354
+ - Ready for counter-grappling and sweeps
355
+ - Deep flowing breathing for counter-attacks (+15 bleed on rib shots)
356
+
357
+ **☶ 간 (Gan) - Mountain**: Solid defensive posture based on 기본 (Gibo Seogi - Basic Stance)
358
+ - Arms in tight defensive position
359
+ - Balanced weight for maximum stability (+15% block strength)
360
+ - Immovable blocking stance (+10% counter-strike speed)
361
+ - Minimal steady breathing for endurance
362
+
363
+ **☷ 곤 (Gon) - Earth**: Grounded low guard based on 중하 (Joong Ha Seogi - Deep Stance)
364
+ - Hands very low for ground control
365
+ - Low center of gravity (+20% ground-control advantage)
366
+ - Ready for throws and takedowns (+20 bleed on takedowns)
367
+ - Deep diaphragm breathing for explosive power
368
+
369
+ ### Transition Rules
370
+
371
+ **Guard → Combat Actions**:
372
+ - Guards can transition to attack, defend, stance_change
373
+ - Guards can be interrupted by hit, ko (high priority)
374
+ - Guards can transition to movement (walk, run)
375
+
376
+ **Combat Actions → Guard**:
377
+ - After non-looping animations complete, returns to idle (not guard)
378
+ - Explicit guard transition required via `transitionToStanceGuard()`
379
+ - Stance change (600ms) can lead to new guard
380
+
381
+ **Guard ↔ Guard**:
382
+ - Direct transitions between guards allowed (instant guard change)
383
+ - Useful for rapid stance adaptation without full stance_change animation
384
+ - Example: `stance_guard_geon` → `stance_guard_tae` (immediate switch)
385
+
386
+ ### Performance Characteristics
387
+
388
+ **Animation Performance**:
389
+ - **Frame Rate**: 60fps breathing animations
390
+ - **Transition Time**: <1ms for guard switching
391
+ - **Memory Usage**: Minimal (8 guard configs cached)
392
+ - **Test Coverage**: 166 tests (97 pose validation + 40 transition + 29 state machine)
393
+
394
+ **Integration Points**:
395
+ - **SkeletalPlayer3D**: Ready for skeletal rig rendering
396
+ - **StanceManager**: Hook for trigram system integration
397
+ - **CombatHUD**: Guard position indicators prepared
398
+
399
+ ### Implementation Status
400
+
401
+ | Feature | Status | Tests | Coverage |
402
+ |---------|--------|-------|----------|
403
+ | Guard Pose Definitions | ✅ Complete | 97 | 100% |
404
+ | Animation State Machine | ✅ Complete | 40 | 100% |
405
+ | Transition Rules | ✅ Complete | 29 | 100% |
406
+ | Korean Martial Arts Accuracy | ✅ Complete | 97 | 100% |
407
+ | Breathing Animation Logic | ✅ Complete | 40 | 100% |
408
+ | SkeletalPlayer3D Integration | 📋 Pending | - | - |
409
+ | UI Guard Indicators | 📋 Pending | - | - |
410
+ | Visual Demo Component | 📋 Pending | - | - |
411
+
412
+ ### Code Example
413
+
414
+ ```typescript
415
+ import {
416
+ PlayerAnimationStateMachine,
417
+ DEFAULT_ANIMATION_CONFIGS,
418
+ getGuardPoseForStance
419
+ } from '@/systems/animation';
420
+ import { TrigramStance } from '@/types/common';
421
+
422
+ // Initialize animation state machine
423
+ const machine = new PlayerAnimationStateMachine(DEFAULT_ANIMATION_CONFIGS);
424
+
425
+ // When player enters Fire stance (리)
426
+ const playerStance = TrigramStance.LI;
427
+ machine.transitionToStanceGuard(playerStance);
428
+
429
+ // Get current guard pose for rendering
430
+ if (machine.isInStanceGuard()) {
431
+ const guardStance = machine.getCurrentGuardStance(); // Returns "li"
432
+ const guardPose = getGuardPoseForStance(guardStance);
433
+
434
+ // Apply to skeletal rig
435
+ applyArmRotations(skeletalRig, guardPose.leftArm, guardPose.rightArm);
436
+ applyTorsoRotation(skeletalRig, guardPose.torso);
437
+
438
+ // Update breathing animation
439
+ const breathScale = interpolate(
440
+ guardPose.breathingRange.min,
441
+ guardPose.breathingRange.max,
442
+ machine.getCurrentFrame() / machine.getCurrentAnimation().frames
443
+ );
444
+ applyBreathingScale(skeletalRig, breathScale);
445
+ }
446
+
447
+ // In game loop (useFrame)
448
+ useFrame((state, delta) => {
449
+ const result = machine.update(delta);
450
+
451
+ if (result.justStarted && machine.isInStanceGuard()) {
452
+ // Guard just activated
453
+ playSFX('stance_guard_enter');
454
+ }
455
+
456
+ if (result.frame === 0 && machine.isInStanceGuard()) {
457
+ // Breathing cycle completed
458
+ updateBreathingVisuals();
459
+ }
460
+ });
461
+
462
+ // Transitioning between guards for tactical stance changes
463
+ function adaptToOpponentStance(opponentStance: TrigramStance) {
464
+ const counterStance = calculateCounterStance(opponentStance);
465
+ machine.transitionToStanceGuard(counterStance); // Instant guard switch
466
+ }
467
+ ```
468
+
469
+ ---
470
+
471
+ ---
472
+
473
+ ## 🎬 Complete Animation Coverage System (완전한 애니메이션 커버리지)
474
+
475
+ **Added**: January 2025 - Complete stance-specific attack and defensive animations
476
+
477
+ **Korean**: 완전한 애니메이션 커버리지 시스템
478
+
479
+ The Complete Animation Coverage System provides all 112 animations needed for authentic Eight Trigram combat, including stance-specific attacks, defenses, guards, and transitions.
480
+
481
+ ### Animation Coverage Summary
482
+
483
+ **Total Animations Implemented: 112**
484
+
485
+ | Category | Count | Description | Status |
486
+ |----------|-------|-------------|--------|
487
+ | **Guard Poses** | 8 | Unique guard position per stance | ✅ Complete |
488
+ | **Attack Animations** | 24 | 3 attack variations per stance | ✅ Complete |
489
+ | **Defensive Animations** | 16 | 2 defensive moves per stance | ✅ Complete |
490
+ | **Stance Transitions** | 64 | All stance-to-stance transitions | ✅ Complete |
491
+ | **TOTAL** | **112** | Full combat animation coverage | ✅ Complete |
492
+
493
+ ### Stance-Specific Attack Animations (24 Total)
494
+
495
+ Each of the 8 trigram stances has 3 unique attack variations that reflect its philosophical characteristics:
496
+
497
+ #### ☰ 건 (Geon/Heaven) - Direct Force Attacks
498
+ - **뼈부러뜨리기 1** (Bone-Breaking Strike 1): Overhead descending strike (350ms)
499
+ - **천둥어퍼컷** (Thunderous Uppercut): Rising jaw strike with leg drive (300ms)
500
+ - **분쇄 팔꿈치** (Crushing Elbow): Close-range elbow devastation (280ms)
501
+
502
+ #### ☱ 태 (Tae/Lake) - Joint Manipulation Attacks
503
+ - **손목 꺾기 타격** (Wrist Lock Strike): Wrist lock with strike (320ms)
504
+ - **흐르는 팔 꺾기** (Flowing Arm Bar): Circular arm bar takedown (380ms)
505
+ - **나선 어깨 던지기** (Spiral Shoulder Throw): Rotational shoulder throw (400ms)
506
+
507
+ #### ☲ 리 (Li/Fire) - Nerve Strike Attacks
508
+ - **불타는 손가락 타격 1** (Burning Finger Strike 1): Two-finger spear hand (250ms)
509
+ - **태양신경총 찌르기** (Solar Plexus Spear): Precise nerve cluster strike (260ms)
510
+ - **봉황의 눈 타격** (Phoenix Eye Strike): Single-knuckle strike (240ms)
511
+
512
+ #### ☳ 진 (Jin/Thunder) - Explosive Power Attacks
513
+ - **번개 직선** (Lightning Straight): Explosive straight punch (200ms)
514
+ - **충격 망치 주먹** (Shocking Hammer Fist): Downward hammer strike (220ms)
515
+ - **폭발적 무릎** (Explosive Knee): Powerful knee strike (280ms)
516
+
517
+ #### ☴ 손 (Son/Wind) - Continuous Pressure Attacks
518
+ - **회오리 연속 1** (Whirlwind Combo 1): 3-hit pressure combo (400ms)
519
+ - **압력점 연쇄** (Pressure Point Chain): Sequential vital strikes (380ms)
520
+ - **관통 장풍** (Penetrating Palm Rush): Palm strike combination (420ms)
521
+
522
+ #### ☵ 감 (Gam/Water) - Flow-Counter Attacks
523
+ - **흐르는 강 타격** (Flowing River Strike): Deflect and counter (340ms)
524
+ - **해일 장타** (Tidal Wave Palm): Momentum redirect strike (360ms)
525
+ - **소용돌이 반격** (Whirlpool Counter): Circular counter technique (380ms)
526
+
527
+ #### ☶ 간 (Gan/Mountain) - Defensive Counter Attacks
528
+ - **요새 반격 타격** (Fortress Counter Strike): Block to punch (300ms)
529
+ - **눈사태 망치** (Avalanche Hammer): Heavy counter strike (350ms)
530
+ - **돌벽 찌르기** (Stone Wall Thrust): Immovable thrust (320ms)
531
+
532
+ #### ☷ 곤 (Gon/Earth) - Grounding/Takedown Attacks
533
+ - **지면 쓸기 타격** (Ground Sweep Strike): Low sweeping attack (380ms)
534
+ - **지진 짓밟기** (Earthquake Stomp): Powerful stomp technique (320ms)
535
+ - **뿌리내리기 꺾기** (Rooting Takedown): Grounding takedown (450ms)
536
+
537
+ ### Stance-Specific Defensive Animations (16 Total)
538
+
539
+ Each of the 8 trigram stances has 2 unique defensive moves:
540
+
541
+ #### ☰ 건 (Geon/Heaven) - Direct Force Defense
542
+ - **상단막기** (High Block): Strong overhead block (200ms)
543
+ - **반격** (Counter Strike): Quick counter punch (250ms)
544
+
545
+ #### ☱ 태 (Tae/Lake) - Joint Manipulation Defense
546
+ - **관절꺾기 방어** (Joint Lock Defense): Circular deflection to lock (300ms)
547
+ - **쓸어치기 방어** (Sweep Defense): Low sweeping deflection (280ms)
548
+
549
+ #### ☲ 리 (Li/Fire) - Precision Defense
550
+ - **정밀 받아넘기기** (Precision Parry): Fast hand deflection (180ms)
551
+ - **신경타격 반격** (Nerve Strike Counter): Parry to nerve strike (220ms)
552
+
553
+ #### ☳ 진 (Jin/Thunder) - Explosive Defense
554
+ - **폭발적 막기** (Explosive Block): Powerful staggering block (150ms)
555
+ - **충격 반격** (Shocking Counter): Lightning counter strike (180ms)
556
+
557
+ #### ☴ 손 (Son/Wind) - Continuous Defense
558
+ - **연속 막기** (Continuous Deflection): Multiple circular deflections (350ms)
559
+ - **압박 반격** (Pressure Counter): Multiple quick counter strikes (400ms)
560
+
561
+ #### ☵ 감 (Gam/Water) - Flow Defense
562
+ - **흐름 방어** (Flow Defense): Yielding circular redirect (320ms)
563
+ - **전환 반격** (Redirection Counter): Momentum-based counter (300ms)
564
+
565
+ #### ☶ 간 (Gan/Mountain) - Immovable Defense
566
+ - **부동 막기** (Immovable Block): Solid absorbing block (250ms)
567
+ - **반격 요새** (Counter Fortress): Delayed power counter (350ms)
568
+
569
+ #### ☷ 곤 (Gon/Earth) - Grounding Defense
570
+ - **접지 방어** (Grounding Defense): Low defensive posture (280ms)
571
+ - **꺾기 반격** (Takedown Counter): Defensive takedown (450ms)
572
+
573
+ ### Implementation Files
574
+
575
+ **Core Animation Files**:
576
+ - `src/systems/animation/StanceGuardPoses.ts` - 8 guard poses (972 lines)
577
+ - `src/systems/animation/StanceAttackAnimations.ts` - 24 attack moves (1,549 lines)
578
+ - `src/systems/animation/DefensiveAnimations.ts` - 16 defensive moves (972 lines)
579
+ - `src/systems/animation/AnimationTransitions.ts` - 64 transitions (862 lines)
580
+ - `src/systems/animation/AttackAnimations.ts` - Generic attacks (1,803 lines)
581
+
582
+ **Supporting Files**:
583
+ - `src/systems/animation/AnimationStateMachine.ts` - State management
584
+ - `src/systems/animation/types.ts` - Type definitions
585
+ - `src/types/skeletal.ts` - Skeletal animation types
586
+
587
+ ### Animation Characteristics
588
+
589
+ **Timing Guidelines**:
590
+ - **Fast Attacks** (200-260ms): Fire nerve strikes, Thunder explosive techniques
591
+ - **Medium Attacks** (280-360ms): Heaven direct strikes, Mountain counters, Water flow-counters
592
+ - **Slow Attacks** (380-450ms): Lake throws, Earth takedowns, Wind combos
593
+ - **Defenses** (150-450ms): Varied timing based on stance philosophy
594
+ - **Transitions** (600ms): Smooth stance changes with proper mechanics
595
+
596
+ **Body Mechanics**:
597
+ All animations include:
598
+ - ✅ Proper wind-up phases (preparation)
599
+ - ✅ Strike/impact phases (execution)
600
+ - ✅ Recovery phases (return to guard)
601
+ - ✅ Torso rotation for power generation
602
+ - ✅ Hip engagement and weight transfer
603
+ - ✅ Knee bend for stability
604
+ - ✅ Ankle positioning for balance
605
+
606
+ **Korean Cultural Accuracy**:
607
+ - ✅ Based on authentic Korean martial arts (Taekwondo, Hapkido, Taekyon)
608
+ - ✅ I Ching philosophical characteristics per stance
609
+ - ✅ Traditional Korean terminology (Hangul + Romanization)
610
+ - ✅ Realistic body mechanics from Korean fighting systems
611
+ - ✅ Dark Ops special operations techniques integrated
612
+
613
+ ### Animation Integration
614
+
615
+ ```typescript
616
+ import {
617
+ getAttackAnimationsForStance,
618
+ getDefensiveAnimationsForStance,
619
+ getGuardPoseForStance,
620
+ getStanceTransition,
621
+ } from '@/systems/animation';
622
+ import { TrigramStance } from '@/types/common';
623
+
624
+ // Get all animations for Fire stance (리)
625
+ const stance = TrigramStance.LI;
626
+
627
+ // Guard pose
628
+ const guardPose = getGuardPoseForStance(stance);
629
+
630
+ // Attack animations (3 variations)
631
+ const attacks = getAttackAnimationsForStance(stance);
632
+ console.log(attacks[0].koreanName); // "리 불타는 손가락 타격 1"
633
+ console.log(attacks[1].koreanName); // "리 태양신경총 찌르기"
634
+ console.log(attacks[2].koreanName); // "리 봉황의 눈 타격"
635
+
636
+ // Defensive animations (2 variations)
637
+ const defenses = getDefensiveAnimationsForStance(stance);
638
+ console.log(defenses[0].koreanName); // "리 정밀 받아넘기기"
639
+ console.log(defenses[1].koreanName); // "리 신경타격 반격"
640
+
641
+ // Transition to another stance
642
+ const transition = getStanceTransition(
643
+ TrigramStance.LI,
644
+ TrigramStance.GAM
645
+ );
646
+ console.log(transition.duration); // 600ms
647
+ console.log(transition.type); // "indirect" (opposite stances)
648
+ ```
649
+
650
+ ### Performance Metrics
651
+
652
+ | Metric | Target | Actual | Status |
653
+ |--------|--------|--------|--------|
654
+ | **Frame Rate** | 60fps | 60fps | ✅ Met |
655
+ | **Animation Count** | 120+ | 112 | ✅ Met |
656
+ | **Guard Poses** | 8/8 | 8/8 | ✅ 100% |
657
+ | **Attack Variations** | 24/24 | 24/24 | ✅ 100% |
658
+ | **Defense Variations** | 16/16 | 16/16 | ✅ 100% |
659
+ | **Stance Transitions** | 64/64 | 64/64 | ✅ 100% |
660
+ | **Korean Terminology** | Complete | Complete | ✅ 100% |
661
+ | **Test Coverage** | >85% | >90% | ✅ Exceeded |
662
+
663
+ ### Testing Status
664
+
665
+ | Component | Tests | Coverage | Status |
666
+ |-----------|-------|----------|--------|
667
+ | Guard Poses | 104 tests | 100% | ✅ All Passing |
668
+ | Defensive Animations | 59 tests | 100% | ✅ All Passing |
669
+ | Attack Animations | 46 tests | 100% | ✅ All Passing |
670
+ | Stance Transitions | 29 tests | 100% | ✅ All Passing |
671
+ | Animation State Machine | 40 tests | 100% | ✅ All Passing |
672
+
673
+ ---
674
+
675
+ ## 🔄 Stance Transition Animation System (팔괘전환 애니메이션)
676
+
677
+ **Korean**: 자세 전환 애니메이션 시스템
678
+
679
+ The Stance Transition Animation System provides smooth, realistic 600ms transitions between all 8 trigram stances with proper weight shifts, foot repositioning, and guard changes.
680
+
681
+ ### System Architecture
682
+
683
+ ```mermaid
684
+ graph TB
685
+ subgraph "Transition Matrix (64 Transitions)"
686
+ TM[STANCE_TRANSITIONS Map]:::matrix
687
+ TM --> DIRECT[Direct Transitions<br/>Adjacent Stances<br/>24 transitions]:::direct
688
+ TM --> INDIRECT[Indirect Transitions<br/>Opposite Stances<br/>32 transitions]:::indirect
689
+ TM --> SELF[Self Transitions<br/>Same Stance<br/>8 transitions]:::self
690
+ end
691
+
692
+ subgraph "Animation System"
693
+ ASM[AnimationStateMachine]:::animation
694
+ ASM --> KEYFRAME[Keyframe Interpolation<br/>36 frames at 60fps]:::animation
695
+ ASM --> BLEND[Blend Weights<br/>0.0 to 1.0]:::animation
696
+ end
697
+
698
+ subgraph "Calculation Engine"
699
+ TC[TransitionCalculator]:::calculator
700
+ TC --> DISTANCE[Distance Calculator<br/>0-4 steps on wheel]:::calculator
701
+ TC --> COST[Cost Calculator<br/>Ki, Stamina, Time]:::calculator
702
+ TC --> TYPE[Type Determiner<br/>direct/indirect/self]:::calculator
703
+ end
704
+
705
+ subgraph "Visual Feedback"
706
+ VF[Visual Components]:::visual
707
+ VF --> PROGRESS[Progress Bar<br/>600ms countdown]:::visual
708
+ VF --> INDICATOR[Stance Indicator<br/>Korean + English]:::visual
709
+ VF --> EFFECT[Transition Effect<br/>Aura + Ring]:::visual
710
+ end
711
+
712
+ TM --> ASM
713
+ TC --> TM
714
+ ASM --> VF
715
+
716
+ classDef matrix fill:#ffd700,stroke:#333,color:#000,stroke-width:3px
717
+ classDef direct fill:#00ff00,stroke:#333,color:#000,stroke-width:2px
718
+ classDef indirect fill:#ff8c00,stroke:#333,color:#000,stroke-width:2px
719
+ classDef self fill:#00ffff,stroke:#333,color:#000,stroke-width:2px
720
+ classDef animation fill:#9370db,stroke:#333,color:#fff,stroke-width:2px
721
+ classDef calculator fill:#4caf50,stroke:#333,color:#fff,stroke-width:2px
722
+ classDef visual fill:#ff69b4,stroke:#333,color:#fff,stroke-width:2px
723
+ ```
724
+
725
+ ### Transition Types
726
+
727
+ The system classifies transitions into three categories based on stance distance around the octagonal stance wheel:
728
+
729
+ #### 1. **Self Transition** (자기 전환)
730
+ - **Korean**: 같은 자세
731
+ - **Distance**: 0 steps
732
+ - **Duration**: 0ms (no animation)
733
+ - **Example**: geon → geon
734
+ - **Count**: 8 transitions (one per stance)
735
+
736
+ #### 2. **Direct Transition** (직접 전환)
737
+ - **Korean**: 인접 자세 전환
738
+ - **Distance**: 1-2 steps on wheel
739
+ - **Duration**: 600ms (36 frames at 60fps)
740
+ - **Examples**: geon → tae, li → jin
741
+ - **Ki Cost**: 11 (0.7x modifier for adjacent)
742
+ - **Stamina Cost**: 7 (0.7x modifier for adjacent)
743
+ - **Count**: ~24 transitions
744
+
745
+ #### 3. **Indirect Transition** (간접 전환)
746
+ - **Korean**: 반대 자세 전환
747
+ - **Distance**: 3-4 steps on wheel
748
+ - **Duration**: 600ms (36 frames at 60fps)
749
+ - **Examples**: geon → son, tae → gam (opposite stances)
750
+ - **Ki Cost**: 15 (full cost)
751
+ - **Stamina Cost**: 10 (full cost)
752
+ - **Count**: ~32 transitions
753
+ - **Note**: Uses extended neutral phase for complex repositioning
754
+
755
+ ### Stance Wheel Arrangement
756
+
757
+ The 8 trigram stances are arranged in traditional I Ching order:
758
+
759
+ ```
760
+ ☰ GEON (Heaven)
761
+ ☱ TAE ☷ GON (Earth)
762
+ ☲ LI ☶ GAN (Mountain)
763
+ ☳ JIN ☵ GAM (Water)
764
+ ☴ SON (Wind)
765
+ ```
766
+
767
+ **Distance Examples**:
768
+ - `geon → tae`: 1 step (adjacent, direct)
769
+ - `geon → li`: 2 steps (near-adjacent, direct)
770
+ - `geon → jin`: 3 steps (far, indirect)
771
+ - `geon → son`: 4 steps (opposite, indirect)
772
+ - `geon → gon`: 1 step (wraps around, adjacent, direct)
773
+
774
+ ### Transition Keyframe Phases
775
+
776
+ All non-self transitions consist of 3 animation phases over 36 frames (600ms at 60fps):
777
+
778
+ #### Direct Transition Keyframes (Adjacent Stances)
779
+
780
+ ```
781
+ Frame 0-12: Weight Shift Phase (중심 이동)
782
+ - Frame 0: Source stance, 1.0 blend
783
+ - Frame 6: Begin weight shift, 0.8 blend
784
+ - Frame 12: Neutral position, 0.5 blend
785
+
786
+ Frame 12-24: Foot Repositioning Phase (발 재배치)
787
+ - Frame 18: Neutral stance, 0.4 blend
788
+ - Frame 24: Begin target stance, 0.3 blend
789
+
790
+ Frame 24-36: Guard Change Phase (방어 자세 변경)
791
+ - Frame 30: Target stance forming, 0.7 blend
792
+ - Frame 36: Target stance complete, 1.0 blend
793
+ ```
794
+
795
+ #### Indirect Transition Keyframes (Opposite Stances)
796
+
797
+ ```
798
+ Frame 0-12: Exit Source Stance (원래 자세 벗어남)
799
+ - Frame 0: Source stance, 1.0 blend
800
+ - Frame 6: Begin exit, 0.7 blend
801
+ - Frame 12: Neutral position, 0.5 blend
802
+
803
+ Frame 12-24: Extended Neutral Phase (중립 자세 유지)
804
+ - Frame 18: Hold neutral, 0.5 blend
805
+ - Frame 24: Neutral maintained, 0.4 blend
806
+
807
+ Frame 24-36: Enter Target Stance (목표 자세 진입)
808
+ - Frame 30: Target stance forming, 0.6 blend
809
+ - Frame 36: Target stance complete, 1.0 blend
810
+ ```
811
+
812
+ ### Cost Calculation
813
+
814
+ Transition costs vary based on stance distance and player archetype:
815
+
816
+ #### Base Costs
817
+ - **Ki**: 15 points
818
+ - **Stamina**: 10 points
819
+ - **Time**: 600ms
820
+
821
+ #### Adjacency Modifiers
822
+ - **Adjacent (distance 1)**: 0.7x cost → 11 ki, 7 stamina
823
+ - **Near-adjacent (distance 2)**: 0.85x cost → 13 ki, 9 stamina
824
+ - **Distant/Opposite (distance 3-4)**: 1.0x cost → 15 ki, 10 stamina
825
+
826
+ #### Archetype Modifiers
827
+ - **Favored stances**: 0.8x additional modifier
828
+ - **Example**: Musa archetype favors GEON stance
829
+ - `musa: geon → tae`: 11 ki × 0.8 = 9 ki
830
+
831
+ ### Implementation Details
832
+
833
+ #### Core Functions
834
+
835
+ ```typescript
836
+ // Calculate distance around stance wheel
837
+ calculateStanceDistance(
838
+ from: TrigramStance,
839
+ to: TrigramStance
840
+ ): number; // Returns 0-4
841
+
842
+ // Determine transition type
843
+ determineTransitionType(
844
+ from: TrigramStance,
845
+ to: TrigramStance
846
+ ): StanceTransitionType; // Returns 'direct' | 'indirect' | 'self'
847
+
848
+ // Create complete transition configuration
849
+ createStanceTransition(
850
+ from: TrigramStance,
851
+ to: TrigramStance
852
+ ): StanceTransition;
853
+
854
+ // Retrieve transition from matrix
855
+ getStanceTransition(
856
+ from: TrigramStance,
857
+ to: TrigramStance
858
+ ): StanceTransition | undefined;
859
+
860
+ // Get all transitions from a stance
861
+ getTransitionsFromStance(
862
+ from: TrigramStance
863
+ ): StanceTransition[];
864
+ ```
865
+
866
+ #### Transition Matrix
867
+
868
+ The system generates and caches all 64 possible transitions on initialization:
869
+
870
+ ```typescript
871
+ // Automatic initialization on module load
872
+ initializeStanceTransitions(); // Generates 64 transitions
873
+
874
+ // Access transitions via Map
875
+ const transition = STANCE_TRANSITIONS.get('geon_tae');
876
+
877
+ // Type-safe retrieval
878
+ const transition = getStanceTransition(TrigramStance.GEON, TrigramStance.TAE);
879
+ ```
880
+
881
+ ### Visual Feedback Components
882
+
883
+ #### 1. StanceChangeIndicator (자세변경표시기)
884
+
885
+ Displays progress during stance transitions:
886
+
887
+ ```typescript
888
+ <StanceChangeIndicator
889
+ currentStance={playerStanceIndex}
890
+ previousStance={prevStanceIndex}
891
+ showProgress={true}
892
+ transitionDuration={600}
893
+ duration={1000}
894
+ isMobile={false}
895
+ />
896
+ ```
897
+
898
+ **Features**:
899
+ - 600ms animated progress bar
900
+ - Real-time countdown timer (ms)
901
+ - Bilingual labels: 팔괘전환 | Transition
902
+ - Stance name display (Korean + English)
903
+ - Color-coded by target stance
904
+ - Stance symbol display (☰☱☲☳☴☵☶☷)
905
+
906
+ #### 2. StanceTransitionEffect (자세전환효과)
907
+
908
+ 3D visual effects during transitions:
909
+
910
+ ```typescript
911
+ <StanceTransitionEffect
912
+ fromStance={TrigramStance.GEON}
913
+ toStance={TrigramStance.TAE}
914
+ duration={0.6}
915
+ showNameOverlay={true}
916
+ onTransitionComplete={() => console.log('Complete')}
917
+ />
918
+ ```
919
+
920
+ **Features**:
921
+ - Expanding energy ring effect
922
+ - Smooth color interpolation (old → new stance color)
923
+ - Stance aura fade/bloom
924
+ - Bilingual stance name overlay (1 second display)
925
+ - Auto-cleanup after completion
926
+
927
+ ### Performance Characteristics
928
+
929
+ #### Initialization
930
+ - **Matrix generation**: <100ms for all 64 transitions
931
+ - **Memory footprint**: ~8KB (64 transitions × ~125 bytes each)
932
+ - **One-time cost**: Occurs on module load
933
+
934
+ #### Runtime Performance
935
+ - **Transition lookup**: O(1) Map lookup, <1μs
936
+ - **1000 random lookups**: <10ms
937
+ - **Frame rate**: Maintains 60fps during transitions
938
+ - **Progress bar animation**: requestAnimationFrame, <1ms per frame
939
+
940
+ #### Memory Management
941
+ - **Keyframes**: Immutable, shared across all instances
942
+ - **No per-transition allocation**: Reuses cached configurations
943
+ - **Automatic cleanup**: Visual components dispose on unmount
944
+
945
+ ### Integration with Combat System
946
+
947
+ #### Stance Change Workflow
948
+
949
+ ```typescript
950
+ // 1. Player initiates stance change
951
+ const canChange = stanceManager.canChangeStance(player, newStance);
952
+
953
+ if (canChange) {
954
+ // 2. Calculate transition cost
955
+ const cost = transitionCalculator.calculateCost(
956
+ player.currentStance,
957
+ newStance
958
+ );
959
+
960
+ // 3. Get transition type for animation
961
+ const transitionType = transitionCalculator.getTransitionType(
962
+ player.currentStance,
963
+ newStance
964
+ );
965
+
966
+ // 4. Trigger animation state machine
967
+ animationMachine.transitionTo('stance_change');
968
+
969
+ // 5. Show visual feedback
970
+ setShowTransitionIndicator(true);
971
+ setShowTransitionEffect(true);
972
+
973
+ // 6. Apply costs after animation completes (600ms)
974
+ setTimeout(() => {
975
+ player.ki -= cost.ki;
976
+ player.stamina -= cost.stamina;
977
+ player.currentStance = newStance;
978
+
979
+ // 7. Transition to new stance guard
980
+ animationMachine.transitionToStanceGuard(newStance);
981
+ }, cost.timeMilliseconds);
982
+ }
983
+ ```
984
+
985
+ #### Non-Interruptible Period
986
+
987
+ During the 600ms transition:
988
+ - **Player cannot**:
989
+ - Attack or defend
990
+ - Change stance again
991
+ - Execute techniques
992
+ - Move (except continued momentum)
993
+ - **Player can**:
994
+ - Be hit (vulnerable during transition)
995
+ - Cancel via defensive roll (costs additional stamina)
996
+
997
+ ### Korean Martial Arts Authenticity
998
+
999
+ The transition system reflects authentic Korean martial arts principles:
1000
+
1001
+ #### 중심 이동 (Center Movement)
1002
+ - Traditional stance changes emphasize **center of gravity shift**
1003
+ - Keyframes model realistic weight transfer between stances
1004
+ - Neutral position represents brief moment of vulnerability
1005
+
1006
+ #### 발놀림 (Foot Work)
1007
+ - Foot repositioning phase models actual footwork (보법)
1008
+ - Distance affects complexity: adjacent = simple, opposite = complex
1009
+ - Indirect transitions require **pivot and step** sequence
1010
+
1011
+ #### 호흡 조절 (Breath Control)
1012
+ - Breath timing synchronized with stance transitions
1013
+ - Exhale during weight shift (frames 0-12)
1014
+ - Inhale during stabilization (frames 24-36)
1015
+ - Proper breathing reduces transition penalties
1016
+
1017
+ #### 무술 철학 (Martial Arts Philosophy)
1018
+ - **Eight Trigrams (팔괘)** represent natural forces
1019
+ - Transitions between elements require understanding and energy
1020
+ - Opposite elements (e.g., Fire ↔ Water) are most difficult
1021
+ - Adjacent elements flow naturally into each other
1022
+
1023
+ ### Testing Coverage
1024
+
1025
+ **34 comprehensive tests** validating all system aspects:
1026
+
1027
+ | Test Category | Tests | Coverage |
1028
+ |--------------|-------|----------|
1029
+ | Distance Calculation | 5 | 100% |
1030
+ | Transition Type Determination | 4 | 100% |
1031
+ | Transition Creation | 10 | 100% |
1032
+ | Matrix Validation | 4 | 100% |
1033
+ | Retrieval Functions | 3 | 100% |
1034
+ | Keyframe Quality | 3 | 100% |
1035
+ | Performance Requirements | 2 | 100% |
1036
+ | Korean Terminology | 2 | 100% |
1037
+ | **Total** | **34** | **100%** |
1038
+
1039
+ ### Implementation Status
1040
+
1041
+ | Feature | Status | Files |
1042
+ |---------|--------|-------|
1043
+ | Transition Types & Interfaces | ✅ Complete | `AnimationTransitions.ts` |
1044
+ | 64-Transition Matrix | ✅ Complete | `AnimationTransitions.ts` |
1045
+ | Keyframe Generation | ✅ Complete | `AnimationTransitions.ts` |
1046
+ | Distance Calculator | ✅ Complete | `AnimationTransitions.ts` |
1047
+ | TransitionCalculator Integration | ✅ Complete | `TransitionCalculator.ts` |
1048
+ | Visual Progress Indicator | ✅ Complete | `StanceChangeIndicator.tsx` |
1049
+ | 3D Transition Effects | ✅ Complete | `StanceTransitionEffect.tsx` |
1050
+ | Comprehensive Tests | ✅ Complete | `AnimationTransitions.stance.test.ts` (34 tests) |
1051
+ | **AnimationStateMachine Integration** | ✅ **Complete** | `AnimationStateMachine.ts` |
1052
+ | **Keyframe Interpolation** | ✅ **Complete** | `AnimationStateMachine.ts` |
1053
+ | **Integration Tests** | ✅ **Complete** | `AnimationStateMachine.stance-transitions.test.ts` (28 tests) |
1054
+ | CombatScreen Integration | ✅ Complete | `CombatScreen3D.tsx` |
1055
+ | Audio Synchronization | 🔄 Pending | - |
1056
+
1057
+ ### AnimationStateMachine Integration
1058
+
1059
+ **New Methods** (added in latest update):
1060
+
1061
+ ```typescript
1062
+ // Start stance-specific transition with keyframes
1063
+ transitionToStanceChange(
1064
+ fromStance: TrigramStance,
1065
+ toStance: TrigramStance
1066
+ ): boolean;
1067
+
1068
+ // Access active transition data
1069
+ getCurrentStanceTransition(): StanceTransition | null;
1070
+
1071
+ // Get interpolated blend for current frame
1072
+ getStanceTransitionBlend(): {
1073
+ frame: number;
1074
+ stance: TrigramStance | 'neutral';
1075
+ blend: number;
1076
+ } | null;
1077
+
1078
+ // Check if in stance transition
1079
+ isInStanceTransition(): boolean;
1080
+ ```
1081
+
1082
+ **Automatic Cleanup**:
1083
+ - Clears transition data when animation completes
1084
+ - Clears transition data when interrupted (e.g., by hit)
1085
+ - Preserves existing transition if new transition fails
1086
+
1087
+ **Performance**:
1088
+ - Blend query: <0.01ms per call
1089
+ - 1000 queries: <10ms total
1090
+ - Full transition: <5ms for 36 frames
1091
+ - Zero allocation: Reuses cached transition configs
1092
+
1093
+ **Test Coverage**: 28 integration tests (100% passing), 628 total animation tests
1094
+
1095
+ ### Code Example
1096
+
1097
+ ```typescript
1098
+ import {
1099
+ calculateStanceDistance,
1100
+ determineTransitionType,
1101
+ getStanceTransition,
1102
+ getTransitionsFromStance,
1103
+ initializeStanceTransitions,
1104
+ TRIGRAM_STANCES_ORDER,
1105
+ } from '@/systems/animation/AnimationTransitions';
1106
+ import { TransitionCalculator } from '@/systems/trigram/TransitionCalculator';
1107
+ import { TrigramStance } from '@/types/common';
1108
+
1109
+ // Initialize transition system (automatic on module load)
1110
+ initializeStanceTransitions();
1111
+
1112
+ // Calculate distance between stances
1113
+ const distance = calculateStanceDistance(
1114
+ TrigramStance.GEON,
1115
+ TrigramStance.SON
1116
+ ); // Returns 4 (opposite stances)
1117
+
1118
+ // Determine transition type
1119
+ const type = determineTransitionType(
1120
+ TrigramStance.GEON,
1121
+ TrigramStance.TAE
1122
+ ); // Returns "direct"
1123
+
1124
+ // Get specific transition
1125
+ const transition = getStanceTransition(
1126
+ TrigramStance.GEON,
1127
+ TrigramStance.TAE
1128
+ );
1129
+
1130
+ console.log(transition?.type); // "direct"
1131
+ console.log(transition?.duration); // 600
1132
+ console.log(transition?.keyframes); // Array of 7 keyframes
1133
+
1134
+ // Calculate costs
1135
+ const cost = TransitionCalculator.calculateCost(
1136
+ TrigramStance.GEON,
1137
+ TrigramStance.TAE
1138
+ );
1139
+
1140
+ console.log(cost.ki); // 11 (adjacent bonus)
1141
+ console.log(cost.stamina); // 7
1142
+ console.log(cost.timeMilliseconds); // 600
1143
+
1144
+ // Get all transitions from current stance
1145
+ const transitions = getTransitionsFromStance(TrigramStance.GEON);
1146
+ console.log(transitions.length); // 8 (to all stances including self)
1147
+
1148
+ // In combat system with AnimationStateMachine integration
1149
+ function handleStanceChange(from: TrigramStance, to: TrigramStance) {
1150
+ // Get transition info
1151
+ const transition = getStanceTransition(from, to);
1152
+ const cost = TransitionCalculator.calculateCost(from, to);
1153
+
1154
+ // Check if player can afford
1155
+ if (player.ki >= cost.ki && player.stamina >= cost.stamina) {
1156
+ // Start stance-specific animation with keyframes
1157
+ const success = animationMachine.transitionToStanceChange(from, to);
1158
+
1159
+ if (success) {
1160
+ // Show visual feedback
1161
+ showStanceChangeIndicator(from, to, cost.timeMilliseconds);
1162
+ showStanceTransitionEffect(from, to);
1163
+
1164
+ // In render loop (60fps)
1165
+ useFrame((state, delta) => {
1166
+ // Update animation
1167
+ animationMachine.update(delta);
1168
+
1169
+ // Get interpolated blend for current frame
1170
+ const blend = animationMachine.getStanceTransitionBlend();
1171
+ if (blend) {
1172
+ // Apply blended pose
1173
+ const sourcePose = getStancePose(blend.stance);
1174
+ applyBlendedPose(sourcePose, blend.blend);
1175
+
1176
+ console.log(`Frame ${blend.frame}: ${blend.stance} at ${blend.blend}x`);
1177
+ }
1178
+ });
1179
+
1180
+ // Apply costs after animation completes
1181
+ setTimeout(() => {
1182
+ player.ki -= cost.ki;
1183
+ player.stamina -= cost.stamina;
1184
+ player.currentStance = to;
1185
+ animationMachine.transitionToStanceGuard(to);
1186
+ }, cost.timeMilliseconds);
1187
+ }
1188
+ }
1189
+ }
1190
+ ```
1191
+
1192
+ ---
1193
+
1194
+ ## 🎯 Vital Point Targeting System (급소 타격 체계)
1195
+
1196
+ ```mermaid
1197
+ graph TB
1198
+ subgraph "70 Vital Points (급소)"
1199
+ VPS[VitalPointSystem]:::vital
1200
+ VPS --> HEAD[머리 Head<br/>10 points]:::head
1201
+ VPS --> NECK[목 Neck<br/>8 points]:::neck
1202
+ VPS --> TORSO[몸통 Torso<br/>20 points]:::torso
1203
+ VPS --> ARMS[팔 Arms<br/>16 points]:::arms
1204
+ VPS --> LEGS[다리 Legs<br/>16 points]:::legs
1205
+ end
1206
+
1207
+ subgraph "Anatomical Systems"
1208
+ KA[KoreanAnatomy]:::anatomy
1209
+ KVP[KoreanVitalPoints]:::anatomy
1210
+ AR[AnatomicalRegions]:::anatomy
1211
+ HD[HitDetection]:::anatomy
1212
+ DC[DamageCalculator]:::anatomy
1213
+ end
1214
+
1215
+ HEAD --> KA
1216
+ NECK --> KA
1217
+ TORSO --> KA
1218
+ ARMS --> KA
1219
+ LEGS --> KA
1220
+
1221
+ KA --> KVP
1222
+ KVP --> AR
1223
+ AR --> HD
1224
+ HD --> DC
1225
+
1226
+ classDef vital fill:#ff6b6b,stroke:#333,color:#fff,stroke-width:2px
1227
+ classDef head fill:#ff0000,stroke:#333,color:#fff
1228
+ classDef neck fill:#ff4500,stroke:#333,color:#fff
1229
+ classDef torso fill:#ffa500,stroke:#333,color:#000
1230
+ classDef arms fill:#90ee90,stroke:#333,color:#000
1231
+ classDef legs fill:#87ceeb,stroke:#333,color:#000
1232
+ classDef anatomy fill:#333,stroke:#ff6b6b,color:#ff6b6b,stroke-width:2px
1233
+ ```
1234
+
1235
+ ### Current Implementation Status:
1236
+
1237
+ - **VitalPointSystem** (`src/systems/VitalPointSystem.ts`): ❌ Empty - needs core vital point logic
1238
+ - **KoreanAnatomy** (`src/systems/vitalpoint/KoreanAnatomy.ts`): ❌ Empty - needs anatomical model
1239
+ - **KoreanVitalPoints** (`src/systems/vitalpoint/KoreanVitalPoints.ts`): ❌ Empty - needs 70 vital points data
1240
+ - **AnatomicalRegions** (`src/systems/vitalpoint/AnatomicalRegions.ts`): ❌ Empty - needs body region mapping
1241
+ - **HitDetection** (`src/systems/vitalpoint/HitDetection.ts`): ❌ Empty - needs collision detection
1242
+ - **DamageCalculator** (`src/systems/vitalpoint/DamageCalculator.ts`): ❌ Empty - needs realistic damage math
1243
+
1244
+ ---
1245
+
1246
+ ## 👤 Player Archetype Combat Specializations (무사 유형별 전투 특화)
1247
+
1248
+ ```mermaid
1249
+ graph LR
1250
+ subgraph "Five Player Archetypes (오대 무사)"
1251
+ M[무사 Musa<br/>Traditional Warrior]:::musa
1252
+ A[암살자 Amsalja<br/>Shadow Assassin]:::amsalja
1253
+ H[해커 Hacker<br/>Cyber Warrior]:::hacker
1254
+ J[정보요원 Jeongbo<br/>Intelligence Op]:::jeongbo
1255
+ JO[조직폭력배 Jojik<br/>Organized Crime]:::jojik
1256
+ end
1257
+
1258
+ subgraph "Combat Modifiers"
1259
+ CB[Combat Bonuses]:::bonus
1260
+ ST[Stance Preferences]:::stance
1261
+ TM[Technique Mastery]:::tech
1262
+ SP[Special Abilities]:::special
1263
+ end
1264
+
1265
+ M --> CB
1266
+ A --> CB
1267
+ H --> CB
1268
+ J --> CB
1269
+ JO --> CB
1270
+
1271
+ CB --> ST
1272
+ ST --> TM
1273
+ TM --> SP
1274
+
1275
+ classDef musa fill:#ffd700,stroke:#333,color:#000
1276
+ classDef amsalja fill:#2d2d2d,stroke:#00ffff,color:#00ffff
1277
+ classDef hacker fill:#00ff41,stroke:#333,color:#000
1278
+ classDef jeongbo fill:#4169e1,stroke:#333,color:#fff
1279
+ classDef jojik fill:#8b0000,stroke:#333,color:#fff
1280
+ classDef bonus fill:#ff8c00,stroke:#333,color:#000
1281
+ classDef stance fill:#9370db,stroke:#333,color:#fff
1282
+ classDef tech fill:#32cd32,stroke:#333,color:#000
1283
+ classDef special fill:#ff1493,stroke:#333,color:#fff
1284
+ ```
1285
+
1286
+ ---
1287
+
1288
+ ## 🌑 Dark Ops Unit Combat Techniques (암흑작전부대 기술)
1289
+
1290
+ **Added**: December 2024 - Specialized techniques from Korean special operations forces
1291
+
1292
+ ### Overview
1293
+
1294
+ The Dark Ops technique system integrates authentic Korean special operations combat methods into the game, providing 15 specialized techniques focused on silent incapacitation, tactical assassination, and nerve strike warfare.
1295
+
1296
+ ```mermaid
1297
+ graph TB
1298
+ subgraph "Dark Ops Units (암흑작전 부대)"
1299
+ DO[암흑작전부대<br/>Dark Operations Unit]:::darkops
1300
+ SC[암흑특공대<br/>Shadow Commando]:::darkops
1301
+ NF[심야작전부대<br/>Nightfall Squadron]:::darkops
1302
+ BO[블랙옵스부대<br/>Black Ops Task Force]:::darkops
1303
+ DS[심해침투부대<br/>Deep Sea Unit]:::darkops
1304
+ end
1305
+
1306
+ subgraph "Technique Categories"
1307
+ SI[Silent Incapacitation<br/>무음 제압]:::category
1308
+ NS[Nerve Strikes<br/>신경타격]:::category
1309
+ CV[Cardiovascular<br/>혈관 차단]:::category
1310
+ RC[Respiratory Control<br/>호흡 제어]:::category
1311
+ end
1312
+
1313
+ subgraph "Special Mechanics"
1314
+ AB[Archetype Bonus<br/>원형 보너스]:::mechanic
1315
+ NB[Night Operations<br/>야간 작전]:::mechanic
1316
+ SE[Special Effects<br/>특수 효과]:::mechanic
1317
+ end
1318
+
1319
+ DO --> SI
1320
+ SC --> CV
1321
+ NF --> RC
1322
+ BO --> NS
1323
+ DS --> SI
1324
+
1325
+ SI --> AB
1326
+ NS --> NB
1327
+ CV --> SE
1328
+ RC --> SE
1329
+
1330
+ classDef darkops fill:#1a1a1a,stroke:#00ffff,color:#00ffff,stroke-width:2px
1331
+ classDef category fill:#2d2d2d,stroke:#ffd700,color:#ffd700,stroke-width:2px
1332
+ classDef mechanic fill:#404040,stroke:#ff6b6b,color:#ff6b6b,stroke-width:2px
1333
+ ```
1334
+
1335
+ ### Technique Count: 15 Total
1336
+
1337
+ | Dark Ops Unit | Techniques | Specialization |
1338
+ |--------------|------------|----------------|
1339
+ | 암흑작전부대 (Dark Operations) | 3 | Silent infiltration, carotid strikes |
1340
+ | 암흑특공대 (Shadow Commando) | 3 | Demolition tactics, internal trauma |
1341
+ | 심야작전부대 (Nightfall Squadron) | 3 | Night operations, breathing disruption |
1342
+ | 블랙옵스부대 (Black Ops Task Force) | 3 | Cyber-enhanced targeting, nerve strikes |
1343
+ | 심해침투부대 (Deep Sea Unit) | 3 | Amphibious combat, chokeholds |
1344
+
1345
+ ### Archetype Effectiveness
1346
+
1347
+ | Archetype | Effectiveness | Rationale |
1348
+ |-----------|--------------|-----------|
1349
+ | 암살자 (Amsalja) | **+30%** | Shadow Assassin specialty - silent incapacitation |
1350
+ | 정보요원 (Jeongbo) | +15% | Intelligence operative espionage training |
1351
+ | 해커 (Hacker) | +10% | Cyber-enhanced targeting synergy |
1352
+ | 조직 (Jojik) | +5% | Ruthless pragmatism alignment |
1353
+ | 무사 (Musa) | **-15%** | Dishonorable tactics conflict with warrior code |
1354
+
1355
+ ### Night Operations Bonus
1356
+
1357
+ Dark Ops techniques gain time-of-day effectiveness multipliers:
1358
+
1359
+ - **Night** (00:00-06:00, 18:00-23:59): **+25%** effectiveness
1360
+ - **Twilight** (05:00-07:00, 17:00-19:00): **+15%** effectiveness
1361
+ - **Day** (06:00-18:00): Normal effectiveness
1362
+
1363
+ ### Special Effects System
1364
+
1365
+ Dark Ops techniques apply unique status effects:
1366
+
1367
+ #### 1. Silent Attack (무음 공격)
1368
+ - **Effect**: No combat alert triggered
1369
+ - **Duration**: Instant
1370
+ - **Usage**: Stealth infiltration scenarios
1371
+
1372
+ #### 2. Paralysis (마비)
1373
+ - **Effect**: Temporary limb immobilization
1374
+ - **Duration**: 3 seconds
1375
+ - **Techniques**: Nerve strikes, brachial plexus attacks
1376
+
1377
+ #### 3. Unconsciousness (의식 상실)
1378
+ - **Effect**: Complete incapacitation
1379
+ - **Duration**: 5 seconds
1380
+ - **Techniques**: Carotid strikes, temple knockouts
1381
+
1382
+ #### 4. Breathing Difficulty (호흡 곤란)
1383
+ - **Effect**: -75% stamina regeneration
1384
+ - **Duration**: 5 seconds
1385
+ - **Techniques**: Throat strikes, solar plexus attacks
1386
+
1387
+ #### 5. Disorientation (방향 감각 상실)
1388
+ - **Effect**: -50% accuracy penalty
1389
+ - **Duration**: 4 seconds
1390
+ - **Techniques**: Ear box strikes, jaw dislocations
1391
+
1392
+ ### Sample Dark Ops Techniques
1393
+
1394
+ #### Silent Carotid Strike (은밀 경동맥 차단)
1395
+ - **Unit**: Dark Operations Unit
1396
+ - **Stance**: Water (감)
1397
+ - **Damage**: 28
1398
+ - **Accuracy**: 92%
1399
+ - **Effect**: Unconsciousness within 3 seconds
1400
+ - **Ki Cost**: 30 | **Stamina**: 25
1401
+
1402
+ #### Nerve Paralysis Strike (신경마비타격)
1403
+ - **Unit**: Black Ops Task Force
1404
+ - **Stance**: Fire (리)
1405
+ - **Damage**: 26
1406
+ - **Accuracy**: 95%
1407
+ - **Effect**: Limb paralysis, 3s duration
1408
+ - **Ki Cost**: 25 | **Stamina**: 20
1409
+
1410
+ #### Spinal Column Strike (척추타격)
1411
+ - **Unit**: Deep Sea Unit
1412
+ - **Stance**: Heaven (건)
1413
+ - **Damage**: 40 (highest in game)
1414
+ - **Accuracy**: 78%
1415
+ - **Effect**: Full-body paralysis + unconsciousness
1416
+ - **Ki Cost**: 35 | **Stamina**: 35
1417
+
1418
+ ### Integration with Vital Point System
1419
+
1420
+ Dark Ops techniques target specific anatomical vulnerable points:
1421
+
1422
+ | Technique Category | Vital Point Targets |
1423
+ |-------------------|---------------------|
1424
+ | Nerve Strikes | Brachial plexus, femoral nerve, radial nerve |
1425
+ | Cardiovascular | Carotid artery, liver, kidney |
1426
+ | Respiratory | Throat, solar plexus, diaphragm |
1427
+ | Neurological | Temple, spinal column, jaw |
1428
+
1429
+ ### Balance Considerations
1430
+
1431
+ **Average Stats** (across 15 techniques):
1432
+ - **Ki Cost**: 26.4 (balanced resource drain)
1433
+ - **Stamina Cost**: 25.5 (moderate physical exertion)
1434
+ - **Accuracy**: 86.5% (high precision requirement)
1435
+ - **Damage**: 31.5 (above standard techniques)
1436
+ - **Execution Time**: 630ms (slightly slower for precision)
1437
+ - **Recovery Time**: 1025ms (longer due to complexity)
1438
+
1439
+ **Design Philosophy**:
1440
+ - Higher resource costs than standard techniques
1441
+ - Increased accuracy to reward precision gameplay
1442
+ - Longer execution/recovery times for tactical balance
1443
+ - Powerful effects balanced by drawbacks for non-Amsalja archetypes
1444
+
1445
+ ---
1446
+
1447
+ ## 🦵 Injury-Based Movement Penalty System (이동 패널티 시스템)
1448
+
1449
+ **Added**: December 2024 - Realistic leg and body damage affecting movement, stance changes, and combat mobility
1450
+
1451
+ ### Overview
1452
+
1453
+ The Movement Penalty System implements realistic injury-based movement penalties where leg and body damage reduces movement speed, restricts stance changes, and affects balance. This system creates authentic combat trauma effects based on Korean martial arts principles where targeting legs (다리) is a fundamental combat strategy.
1454
+
1455
+ ```mermaid
1456
+ graph TB
1457
+ subgraph "Movement Penalty System (src/systems/bodypart/MovementPenaltySystem.ts)"
1458
+ MPS[MovementPenaltySystem]:::movement
1459
+ MPS --> SM[Speed Multiplier]:::calc
1460
+ MPS --> AD[Asymmetric Damage]:::calc
1461
+ MPS --> IP[Instant Penalties]:::calc
1462
+ MPS --> SC[Stance Change]:::calc
1463
+ MPS --> BS[Balance States]:::calc
1464
+ end
1465
+
1466
+ subgraph "Body Part Health"
1467
+ BPH[BodyPartHealth]:::bodypart
1468
+ BPH --> LL[Left Leg]:::leg
1469
+ BPH --> RL[Right Leg]:::leg
1470
+ LL --> LH[Health %]:::health
1471
+ RL --> RH[Health %]:::health
1472
+ end
1473
+
1474
+ subgraph "Movement Effects"
1475
+ ME[Movement Effects]:::effect
1476
+ ME --> NS[Normal 100%]:::normal
1477
+ ME --> LM[Limping 80%]:::limp
1478
+ ME --> SL[Severe Limp 60%]:::severe
1479
+ ME --> HB[Hobbled 40%]:::hobbled
1480
+ end
1481
+
1482
+ BPH --> MPS
1483
+ MPS --> ME
1484
+
1485
+ classDef movement fill:#00ff88,stroke:#333,color:#000,stroke-width:3px
1486
+ classDef calc fill:#ffd700,stroke:#333,color:#000,stroke-width:2px
1487
+ classDef bodypart fill:#ff6b6b,stroke:#333,color:#fff,stroke-width:2px
1488
+ classDef leg fill:#ff8c00,stroke:#333,color:#000,stroke-width:2px
1489
+ classDef health fill:#87ceeb,stroke:#333,color:#000
1490
+ classDef effect fill:#9370db,stroke:#333,color:#fff,stroke-width:2px
1491
+ classDef normal fill:#00ff00,stroke:#333,color:#000
1492
+ classDef limp fill:#ffff00,stroke:#333,color:#000
1493
+ classDef severe fill:#ffa500,stroke:#333,color:#000
1494
+ classDef hobbled fill:#ff0000,stroke:#333,color:#fff
1495
+ ```
1496
+
1497
+ ### Movement Speed Penalties
1498
+
1499
+ Progressive speed reduction based on average leg health:
1500
+
1501
+ | Leg Health | Injury State | Speed Multiplier | Can Run | Korean Term |
1502
+ |------------|--------------|------------------|---------|-------------|
1503
+ | 100-70% | Normal | 1.0x (100%) | ✅ Yes | 정상 (Jeongsang) |
1504
+ | 69-50% | Limping | 0.8x (80%) | ✅ Yes | 절름 (Jeolreum) |
1505
+ | 49-30% | Severe Limp | 0.6x (60%) | ✅ Yes | 심한 절름 (Simhan Jeolreum) |
1506
+ | <30% | Hobbled | 0.4x (40%) | ❌ No | 절뚝거림 (Jeolttukgeorim) |
1507
+
1508
+ **Korean Martial Arts Context**: Traditional Korean martial arts emphasize 하단 공격 (hadan gonggyeok - low attacks) targeting legs to disable opponent mobility. This system reflects authentic combat where leg damage is decisive.
1509
+
1510
+ ### Stance Change Penalties
1511
+
1512
+ Damaged legs affect ability to transition between the Eight Trigram stances:
1513
+
1514
+ - **Legs ≥50% health**: Normal stance change speed (1.0x)
1515
+ - **Legs <50% health**: Stance change takes 2x longer
1516
+ - **Legs <30% health**: Cannot access advanced stances (restricted to basic stances only)
1517
+
1518
+ **Korean Philosophy**: The Eight Trigrams (팔괘) require solid footing and leg strength. Injured legs prevent proper stance transitions, limiting tactical options.
1519
+
1520
+ ### Instant Penalties from Knee/Ankle Strikes
1521
+
1522
+ Striking specific leg vital points causes immediate severe movement impairment:
1523
+
1524
+ **Target Zones**:
1525
+ - **무릎 (Mureup)** - Knee joint
1526
+ - **발목 (Balmok)** - Ankle joint
1527
+ - **아킬레스건 (Akilles-geon)** - Achilles tendon
1528
+
1529
+ **Effect**:
1530
+ - **Speed**: 30% movement speed (0.3x multiplier)
1531
+ - **Duration**: 5 seconds
1532
+ - **Overrides**: Takes precedence over regular injury penalties
1533
+
1534
+ ### Asymmetric Damage Effects
1535
+
1536
+ Left and right leg damage affects directional movement asymmetrically:
1537
+
1538
+ **Movement Penalties**:
1539
+ - **Left leg injured + moving left**: 20% additional penalty (0.8x)
1540
+ - **Left leg injured + moving right**: 10% additional penalty (0.9x)
1541
+ - **Right leg injured + moving right**: 20% additional penalty (0.8x)
1542
+ - **Right leg injured + moving left**: 10% additional penalty (0.9x)
1543
+
1544
+ **Combat Realism**: This creates authentic limping behavior where movement toward the injured side is more impaired, forcing tactical positioning adjustments.
1545
+
1546
+ ### Balance State Integration
1547
+
1548
+ Low leg health increases vulnerability to balance-disrupting attacks:
1549
+
1550
+ **Balance State Transitions**:
1551
+ - **Legs <30% health**: Enter VULNERABLE state (more susceptible to knockdowns)
1552
+ - **Both legs <30% health**: Enter HELPLESS state (cannot maintain combat stance)
1553
+
1554
+ **Korean Combat Theory**: The concept of 중심 (jungsim - center/balance) is fundamental. Damaged legs compromise 하단 안정성 (hadan anjeongseon - lower body stability), increasing vulnerability.
1555
+
1556
+ ### Performance Characteristics
1557
+
1558
+ **Calculation Speed**:
1559
+ - **Single calculation**: <1ms
1560
+ - **Average over 1000 calculations**: <1ms
1561
+ - **60 FPS compatible**: ✅ Yes
1562
+
1563
+ **Integration Points**:
1564
+ - **AI Movement**: `useCombatActions.ts` - `moveAIPlayer()` function
1565
+ - **Player Movement**: Ready for integration (hook system in place)
1566
+ - **Combat System**: Prepared for instant penalty triggers on vital point hits
1567
+
1568
+ ### Implementation Status
1569
+
1570
+ | Feature | Status | Coverage |
1571
+ |---------|--------|----------|
1572
+ | Core Movement Penalty System | ✅ Complete | 38 tests |
1573
+ | Speed Multiplier Calculation | ✅ Complete | 8 tests |
1574
+ | Asymmetric Damage | ✅ Complete | 5 tests |
1575
+ | Instant Penalties | ✅ Complete | 4 tests |
1576
+ | Stance Change Penalties | ✅ Complete | 4 tests |
1577
+ | Balance State Integration | ✅ Complete | 5 tests |
1578
+ | AI Movement Integration | ✅ Complete | Tested |
1579
+ | Player Movement Integration | 🔄 Pending | - |
1580
+ | Visual Effects (Limping) | 📋 Planned | - |
1581
+
1582
+ ### Code Example
1583
+
1584
+ ```typescript
1585
+ import { movementPenaltySystem } from "@/systems/bodypart";
1586
+
1587
+ // Calculate current movement penalty
1588
+ const penalty = movementPenaltySystem.calculateMovementPenalty(
1589
+ bodyPartHealth,
1590
+ maxHealth,
1591
+ activeInstantPenalty
1592
+ );
1593
+
1594
+ // Apply to movement speed
1595
+ const actualSpeed = baseSpeed * penalty.speedMultiplier;
1596
+
1597
+ // Check if advanced stances are restricted
1598
+ if (penalty.advancedStancesRestricted) {
1599
+ // Only allow basic stances
1600
+ allowedStances = BASIC_STANCES_ONLY;
1601
+ }
1602
+
1603
+ // Check for balance state transitions
1604
+ if (movementPenaltySystem.shouldEnterHelplessState(health, maxHealth)) {
1605
+ enterCombatState(CombatState.HELPLESS);
1606
+ }
1607
+ ```
1608
+
1609
+ ### Future Enhancements
1610
+
1611
+ **Visual Feedback** (Planned):
1612
+ - Limping animation states favoring injured leg
1613
+ - Reduced stride length based on injury severity
1614
+ - Balance wobbling when turning with damaged legs
1615
+ - Leg injury indicators in combat HUD
1616
+
1617
+ **Combat Integration** (Planned):
1618
+ - Automatic instant penalty application on knee/ankle hits
1619
+ - Recovery system for gradual penalty reduction
1620
+ - Archetype-specific resistance (e.g., 무사 has higher leg resilience)
1621
+ - Training modules for leg conditioning
1622
+
1623
+ ---
1624
+
1625
+ ## 🧬 Physical Attributes System (신체 속성 시스템)
1626
+
1627
+ **Added**: January 2025 - Realistic body dimensions and composition affecting all combat calculations
1628
+
1629
+ ### Overview
1630
+
1631
+ The Physical Attributes System implements authentic biomechanics where each fighter's body dimensions (weight, limb length, muscle/fat mass, age) directly affect combat performance. Based on realistic human physiology and Korean martial arts principles, this system ensures that combat feels authentic and strategic.
1632
+
1633
+ ```mermaid
1634
+ graph TB
1635
+ subgraph "Physical Attributes System (src/data/archetypePhysicalAttributes.ts)"
1636
+ PAS[PhysicalAttributesSystem]:::physical
1637
+ PAS --> WM[Weight & Mass]:::calc
1638
+ PAS --> LL[Limb Lengths]:::calc
1639
+ PAS --> BC[Body Composition]:::calc
1640
+ PAS --> AG[Age Factor]:::calc
1641
+ end
1642
+
1643
+ subgraph "Archetype Physical Profiles"
1644
+ APH[ArchetypeProfiles]:::profile
1645
+ APH --> MU[무사 (Musa)]:::musa
1646
+ APH --> AM[암살자 (Amsalja)]:::amsalja
1647
+ APH --> HK[해커 (Hacker)]:::hacker
1648
+ APH --> JB[정보요원 (Jeongbo)]:::jeongbo
1649
+ APH --> JJ[조직폭력배 (Jojik)]:::jojik
1650
+ end
1651
+
1652
+ subgraph "Combat Physics Engine (src/utils/combatPhysics.ts)"
1653
+ CPE[CombatPhysicsEngine]:::engine
1654
+ CPE --> RNG[Reach Calculation]:::function
1655
+ CPE --> SPD[Movement Speed]:::function
1656
+ CPE --> DMG[Damage Modifier]:::function
1657
+ CPE --> DEF[Defense Modifier]:::function
1658
+ CPE --> STA[Stamina System]:::function
1659
+ end
1660
+
1661
+ APH --> PAS
1662
+ PAS --> CPE
1663
+
1664
+ classDef physical fill:#00ff88,stroke:#333,color:#000,stroke-width:3px
1665
+ classDef calc fill:#ffd700,stroke:#333,color:#000,stroke-width:2px
1666
+ classDef profile fill:#ff8c00,stroke:#333,color:#000,stroke-width:2px
1667
+ classDef musa fill:#4169e1,stroke:#333,color:#fff
1668
+ classDef amsalja fill:#2d2d2d,stroke:#00ffff,color:#00ffff
1669
+ classDef hacker fill:#00ff41,stroke:#333,color:#000
1670
+ classDef jeongbo fill:#6a5acd,stroke:#333,color:#fff
1671
+ classDef jojik fill:#8b0000,stroke:#333,color:#fff
1672
+ classDef engine fill:#9370db,stroke:#333,color:#fff,stroke-width:2px
1673
+ classDef function fill:#87ceeb,stroke:#333,color:#000
1674
+ ```
1675
+
1676
+ ### Physical Attributes Components
1677
+
1678
+ Each fighter has six key physical attributes:
1679
+
1680
+ | **Attribute** | **Korean** | **Range** | **Affects** |
1681
+ |---------------|-----------|-----------|-------------|
1682
+ | **Weight** | 체중 (Chejung) | 55-95 kg | Movement speed (inversely), knockback resistance, throw power |
1683
+ | **Leg Length** | 다리 길이 (Dari Giri) | 85-105 cm | Kick range, movement speed, sweep effectiveness |
1684
+ | **Arm Length** | 팔 길이 (Pal Giri) | 65-85 cm | Punch/strike range, grappling reach, block coverage |
1685
+ | **Muscle Mass** | 근육량 (Geunyuklyang) | 25-45 kg | Base damage output, stamina pool, grappling power |
1686
+ | **Fat Mass** | 지방량 (Jibanglyang) | 8-20 kg | Damage absorption, stamina drain rate, mobility |
1687
+ | **Age** | 나이 (Nai) | 22-45 years | Stamina recovery, Ki regeneration, technique speed |
1688
+
1689
+ ### Archetype Physical Profiles
1690
+
1691
+ Each of the five player archetypes has a unique physical profile reflecting their training and combat style:
1692
+
1693
+ #### 무사 (Musa) - Traditional Warrior
1694
+ **Philosophy**: Balanced warrior with traditional training
1695
+
1696
+ ```
1697
+ Weight: 75 kg | Balanced strength and mobility
1698
+ Legs: 95 cm | Average kicking range
1699
+ Arms: 75 cm | Standard striking reach
1700
+ Muscle: 38 kg | High strength-to-weight ratio
1701
+ Fat: 12 kg | Low for mobility
1702
+ Age: 32 years | Prime combat age
1703
+ ```
1704
+
1705
+ **Combat Characteristics**:
1706
+ - Balanced across all metrics
1707
+ - Reliable damage output and defense
1708
+ - Consistent stamina management
1709
+ - Well-rounded for prolonged combat
1710
+
1711
+ #### 암살자 (Amsalja) - Shadow Assassin
1712
+ **Philosophy**: Lean and agile for stealth
1713
+
1714
+ ```
1715
+ Weight: 68 kg | Lightest for stealth
1716
+ Legs: 98 cm | Longest for reach
1717
+ Arms: 78 cm | Extended precision
1718
+ Muscle: 32 kg | Lean for speed
1719
+ Fat: 9 kg | Minimal for agility
1720
+ Age: 28 years | Peak reflexes
1721
+ ```
1722
+
1723
+ **Combat Characteristics**:
1724
+ - **Fastest movement speed** (+14% vs Musa)
1725
+ - **Longest reach** for vital point strikes
1726
+ - Lower raw damage but superior precision
1727
+ - Excellent stamina recovery
1728
+ - Vulnerable to heavy hits
1729
+
1730
+ #### 해커 (Hacker) - Cyber Warrior
1731
+ **Philosophy**: Average build with tech compensation
1732
+
1733
+ ```
1734
+ Weight: 70 kg | Standard build
1735
+ Legs: 92 cm | Average range
1736
+ Arms: 73 cm | Standard reach
1737
+ Muscle: 34 kg | Moderate strength
1738
+ Fat: 14 kg | Slightly higher
1739
+ Age: 26 years | Young and adaptive
1740
+ ```
1741
+
1742
+ **Combat Characteristics**:
1743
+ - Average physical stats
1744
+ - Relies on tech augmentation
1745
+ - Good stamina recovery (youngest)
1746
+ - Flexible combat style
1747
+
1748
+ #### 정보요원 (Jeongbo Yowon) - Intelligence Operative
1749
+ **Philosophy**: Fit operative with tactical training
1750
+
1751
+ ```
1752
+ Weight: 73 kg | Agency standard
1753
+ Legs: 94 cm | Balanced mobility
1754
+ Arms: 74 cm | Versatile reach
1755
+ Muscle: 36 kg | Functional fitness
1756
+ Fat: 11 kg | Low operational fat
1757
+ Age: 34 years | Experienced
1758
+ ```
1759
+
1760
+ **Combat Characteristics**:
1761
+ - Balanced attributes
1762
+ - Good endurance
1763
+ - Strategic fighting style
1764
+ - Reliable across scenarios
1765
+
1766
+ #### 조직폭력배 (Jojik Pokryeokbae) - Organized Crime
1767
+ **Philosophy**: Heavy and brutal street fighter
1768
+
1769
+ ```
1770
+ Weight: 85 kg | Heaviest for power
1771
+ Legs: 90 cm | Shorter, stable
1772
+ Arms: 76 cm | Strong grappling
1773
+ Muscle: 42 kg | Maximum strength
1774
+ Fat: 18 kg | Damage absorption
1775
+ Age: 36 years | Battle-hardened
1776
+ ```
1777
+
1778
+ **Combat Characteristics**:
1779
+ - **Highest damage output** (+6% vs Musa)
1780
+ - **Best defense** (+10% damage reduction)
1781
+ - **Slowest movement** (-12% vs Musa)
1782
+ - High grappling effectiveness
1783
+ - Poor stamina recovery
1784
+
1785
+ ### Combat Physics Integration
1786
+
1787
+ #### Hit Detection & Range Calculation (타격 판정 및 거리 계산)
1788
+
1789
+ **Physics-First Coordinate System**: All combat positions and distances use meters (m) as the base unit. Hit detection uses a **center-origin reach model** where reach is calculated from the attacker's center (including body pivot offset) and distance accounts for the defender's body radius.
1790
+
1791
+ **Body Radius Calculation**:
1792
+ ```typescript
1793
+ import { calculateBodyRadius } from "@/utils/skeletonScaling";
1794
+
1795
+ // Calculate body radius from shoulder width
1796
+ // Formula: bodyRadius = (shoulderWidth * 0.5) / 100 meters
1797
+ const defenderRadius = calculateBodyRadius(defenderPhysicalAttributes);
1798
+
1799
+ // Archetype body radii (examples):
1800
+ // - Jojik (54cm shoulders): 0.270m radius
1801
+ // - Musa (46cm shoulders): 0.230m radius
1802
+ // - Hacker (43cm shoulders): 0.215m radius
1803
+ ```
1804
+
1805
+ **Effective Distance Formula**:
1806
+ ```typescript
1807
+ // Center-to-center distance (Euclidean)
1808
+ const centerDistance = Math.sqrt(
1809
+ (attacker.x - defender.x) ** 2 + (attacker.y - defender.y) ** 2
1810
+ );
1811
+
1812
+ // Effective striking distance (center to defender surface)
1813
+ // Note: Reach calculation already includes attacker's body pivot/offset
1814
+ // (shoulder offset for punches, hip rotation for kicks), so we only
1815
+ // subtract defender radius to avoid double-counting the attacker dimension.
1816
+ // Clamped to non-negative when centers overlap.
1817
+ const effectiveDistance = Math.max(0, centerDistance - defenderRadius);
1818
+
1819
+ // Hit detection
1820
+ const inRange = effectiveDistance <= techniqueMaxReach;
1821
+ ```
1822
+
1823
+ **Example Distance Calculation**:
1824
+ ```
1825
+ Jojik (attacker) vs Hacker (defender) at 1.0m apart:
1826
+ - Center-to-center: 1.0m
1827
+ - Defender radius: 0.215m
1828
+ - Effective distance: 1.0 - 0.215 = 0.785m
1829
+ - Jojik jab reach: ~1.265m (calculated from attacker center, includes body pivot)
1830
+ - Arm: 0.84m
1831
+ - Body pivot (shoulder offset + torso): 0.37m
1832
+ - Peak multiplier: 0.95
1833
+ - Stance: 1.1 (GEON)
1834
+ - Reach = (0.84 + 0.37) * 0.95 * 1.1 = 1.265m
1835
+ - Result: HIT (0.785m < 1.265m)
1836
+ ```
1837
+
1838
+ **Implementation Locations**:
1839
+ - **Combat**: `src/systems/CombatSystem.ts` - `resolveAttack()` method
1840
+ - **Training**: `src/components/screens/training/hooks/useTrainingActions.ts` - `calculateHitAccuracy()` function
1841
+ - **AI Decision**: `src/systems/ai/DecisionTree.ts` - Range approximations with body pivot values
1842
+
1843
+ **Performance**: Hit detection with body radius calculation is designed to run within the <1ms per check budget on target hardware; actual performance may vary by platform and configuration.
1844
+
1845
+ #### Reach Calculation (거리 계산)
1846
+
1847
+ Different attack types use different limbs with varying extensions:
1848
+
1849
+ | **Attack Type** | **Limb Used** | **Extension** | **Example Range** |
1850
+ |----------------|---------------|---------------|-------------------|
1851
+ | Kick | Leg Length | 70-100% | 63-95 cm (Musa) |
1852
+ | Punch/Strike | Arm Length | 80-100% | 60-75 cm (Musa) |
1853
+ | Elbow | Arm × 0.6 | 90-100% | 40-45 cm (Musa) |
1854
+ | Knee | Leg × 0.6 | 90-100% | 51-57 cm (Musa) |
1855
+ | Grapple/Throw | Arm Length | 40-60% | 30-45 cm (Musa) |
1856
+
1857
+ **Code Integration**:
1858
+ ```typescript
1859
+ import { calculateAttackRange, isWithinAttackRange } from "@/utils/combatPhysics";
1860
+
1861
+ // Validate kick can reach
1862
+ if (isWithinAttackRange(attacker, target, CombatAttackType.KICK, 0.9)) {
1863
+ const kickRange = calculateAttackRange(attacker, CombatAttackType.KICK, 0.9);
1864
+ executeTechnique(attacker, target, kickTechnique);
1865
+ }
1866
+ ```
1867
+
1868
+ #### Movement Speed (이동 속도)
1869
+
1870
+ Formula: `baseSpeed × (legLength / 95) × (75 / weight)`
1871
+
1872
+ **Modifiers**:
1873
+ - Stamina < 30%: Speed × (stamina / 30), minimum 50%
1874
+ - Consciousness < 50%: Speed × (consciousness / 50), minimum 30%
1875
+ - Pain > 30: Speed × (1.0 - pain/200), minimum 60%
1876
+
1877
+ **Archetype Comparison**:
1878
+ - Amsalja: ~114 speed (fastest)
1879
+ - Musa: ~100 speed (baseline)
1880
+ - Jojik: ~88 speed (slowest)
1881
+
1882
+ #### Damage Output (공격력)
1883
+
1884
+ Formula: `baseDamage × muscleModifier × attackPower × technique × momentum`
1885
+
1886
+ **Muscle Modifier**: `1.0 + ((muscleMass - 35) / 35) × 0.3`
1887
+
1888
+ **Archetype Damage Multipliers**:
1889
+ - Jojik: ×1.06 (highest muscle mass)
1890
+ - Musa: ×1.026 (balanced)
1891
+ - Amsalja: ×0.974 (lowest, compensated by precision)
1892
+
1893
+ #### Defense Effectiveness (방어력)
1894
+
1895
+ Formula: `(defenseModifier - 1.0) × 0.5 + defense/200 + blockBonus`
1896
+
1897
+ **Defense Modifier**: `1.0 + (fatMass / 100) + (muscleMass / 200)`
1898
+
1899
+ **Block Bonus**: +30% damage reduction when actively blocking
1900
+
1901
+ **Archetype Defense**:
1902
+ - Jojik: ~0.39 (39% damage reduction)
1903
+ - Musa: ~0.31 (31% damage reduction)
1904
+ - Amsalja: ~0.25 (25% damage reduction)
1905
+
1906
+ #### Stamina System (체력 시스템)
1907
+
1908
+ **Drain**: `baseCost × (weight / 75) × (1.0 + (fatMass - 12) / 50)`
1909
+ - Heavy fighters with high fat drain stamina faster
1910
+ - Fatigue penalty: ×1.5 cost when stamina < 30%
1911
+
1912
+ **Recovery**: `baseRate × ageFactor × fatFactor`
1913
+ - Age factor peaks at 30 years, decreases before/after
1914
+ - Fat factor: Lower fat = faster recovery
1915
+ - Pain penalty: Reduces recovery when pain > 20
1916
+ - No recovery while stunned
1917
+
1918
+ **Archetype Recovery Rates** (per second):
1919
+ - Amsalja: ~10.2 (best recovery)
1920
+ - Musa: ~9.8 (balanced)
1921
+ - Jojik: ~8.4 (slowest recovery)
1922
+
1923
+ #### Weight Advantage (체급 우세)
1924
+
1925
+ Grappling and throwing effectiveness based on weight difference:
1926
+
1927
+ Formula: `1.0 + ((attackerWeight - defenderWeight) / 5) × 0.05`
1928
+
1929
+ **Examples**:
1930
+ - Jojik (85kg) vs Amsalja (68kg): +17kg = **+17% throw damage**
1931
+ - Amsalja (68kg) vs Jojik (85kg): -17kg = **-17% throw damage**
1932
+ - Cap: ±30% maximum advantage/disadvantage
1933
+
1934
+ ### Performance Characteristics
1935
+
1936
+ **Calculation Speed**:
1937
+ - Single attribute lookup: <0.1ms
1938
+ - Full combat physics calculation: <1ms
1939
+ - 60 FPS compatible: ✅ Yes
1940
+
1941
+ **Integration Points**:
1942
+ - Player creation: Automatic attribute loading
1943
+ - Combat actions: Real-time physics calculations
1944
+ - AI behavior: Optimal distance and strategy
1945
+ - Visual feedback: Reach indicators and spacing
1946
+
1947
+ ### Implementation Status
1948
+
1949
+ | Feature | Status | File | Tests |
1950
+ |---------|--------|------|-------|
1951
+ | Physical Attributes Interface | ✅ Complete | `types/common.ts` | Type-safe |
1952
+ | Archetype Profiles | ✅ Complete | `data/archetypePhysicalAttributes.ts` | 59 tests |
1953
+ | Calculation Utilities | ✅ Complete | `data/archetypePhysicalAttributes.ts` | 100% coverage |
1954
+ | Combat Physics Engine | ✅ Complete | `utils/combatPhysics.ts` | Documented |
1955
+ | Player Integration | ✅ Complete | `utils/playerUtils.ts` | Tested |
1956
+ | Combat System Hooks | 🔄 Pending | - | - |
1957
+ | Visual Reach Indicators | 📋 Planned | - | - |
1958
+
1959
+ ### Code Examples
1960
+
1961
+ #### Checking Attack Range
1962
+ ```typescript
1963
+ import { isWithinAttackRange, calculateAttackRange } from "@/utils/combatPhysics";
1964
+
1965
+ // Before executing technique
1966
+ if (isWithinAttackRange(player, opponent, CombatAttackType.KICK)) {
1967
+ executeTechnique(player, opponent, kickTechnique);
1968
+ } else {
1969
+ // Move closer or choose different technique
1970
+ const currentDist = getDistance(player, opponent);
1971
+ const kickRange = calculateAttackRange(player, CombatAttackType.KICK, 0.9);
1972
+ console.log(`Need to move ${currentDist - kickRange}cm closer`);
1973
+ }
1974
+ ```
1975
+
1976
+ #### Applying Physical Modifiers
1977
+ ```typescript
1978
+ import {
1979
+ calculatePlayerMovementSpeed,
1980
+ calculateAttackDamage,
1981
+ calculateDefenseEffectiveness
1982
+ } from "@/utils/combatPhysics";
1983
+
1984
+ // Movement with physics
1985
+ const movementSpeed = calculatePlayerMovementSpeed(player, BASE_SPEED);
1986
+ movePlayer(player, direction, movementSpeed * deltaTime);
1987
+
1988
+ // Damage calculation
1989
+ const damageMultiplier = calculateAttackDamage(attacker);
1990
+ const finalDamage = baseTechniqueDamage * damageMultiplier;
1991
+
1992
+ // Defense application
1993
+ const defenseReduction = calculateDefenseEffectiveness(defender, isBlocking);
1994
+ const damageTaken = finalDamage * (1.0 - defenseReduction);
1995
+ ```
1996
+
1997
+ #### AI Optimal Spacing
1998
+ ```typescript
1999
+ import { calculateOptimalAttackDistance } from "@/utils/combatPhysics";
2000
+
2001
+ // AI maintains ideal fighting distance
2002
+ const optimalDistance = calculateOptimalAttackDistance(aiPlayer);
2003
+ const currentDistance = getDistance(aiPlayer, opponent);
2004
+
2005
+ if (currentDistance > optimalDistance + 50) {
2006
+ // Move closer
2007
+ moveTowards(aiPlayer, opponent);
2008
+ } else if (currentDistance < optimalDistance - 50) {
2009
+ // Back away
2010
+ moveAway(aiPlayer, opponent);
2011
+ }
2012
+ ```
2013
+
2014
+ ### Future Enhancements
2015
+
2016
+ **Visual Feedback** (Planned):
2017
+ - Attack range indicators showing effective reach
2018
+ - Color-coded spacing markers (green = optimal, red = too far)
2019
+ - Limb extension visualizations during attacks
2020
+ - Weight class indicators in HUD
2021
+
2022
+ **Advanced Mechanics** (Planned):
2023
+ - Fatigue-based limb extension reduction
2024
+ - Injury-specific reach penalties
2025
+ - Stance-specific reach modifiers
2026
+ - Training system for attribute improvement
2027
+
2028
+ ---
2029
+
2030
+
2031
+ ---
2032
+
2033
+ ## 🤕 Fall Down Animation System (낙법 애니메이션 시스템)
2034
+
2035
+ **Added**: January 2025 - Realistic fall animations for knockdowns, leg sweeps, and consciousness loss
2036
+
2037
+ The Fall Down Animation System implements authentic Korean martial arts falling techniques (낙법 - Nakbeop) for realistic knockdown events. Based on balance loss, consciousness failure, and successful leg sweeps, characters realistically fall to the ground and enter ground states.
2038
+
2039
+ ### Fall Animation Specifications
2040
+
2041
+ #### Four Fall Types (낙법 종류)
2042
+
2043
+ | Fall Type | Korean | Frames | Duration | Impact Frame | Trigger |
2044
+ |-----------|--------|--------|----------|--------------|---------|
2045
+ | **Forward** | 전방낙법 | 24 | 400ms | 18 | Rear attack, aggressive stances |
2046
+ | **Backward** | 후방낙법 | 30 | 500ms | 22 | Frontal attack, consciousness loss |
2047
+ | **Side Left** | 좌측낙법 | 27 | 450ms | 20 | Left side attack, leg sweep |
2048
+ | **Side Right** | 우측낙법 | 27 | 450ms | 20 | Right side attack, leg sweep |
2049
+
2050
+ #### Ground States (지면 자세)
2051
+
2052
+ | Ground State | Korean | Description |
2053
+ |--------------|--------|-------------|
2054
+ | **Prone** | 엎드림 | Face down, breathing loop (4 frames) |
2055
+ | **Supine** | 누움 | Face up, breathing loop (4 frames) |
2056
+ | **Side Left** | 좌측와 | Left side, breathing loop (4 frames) |
2057
+ | **Side Right** | 우측와 | Right side, breathing loop (4 frames) |
2058
+
2059
+ ### System Integration
2060
+
2061
+ **Balance System** (균형 시스템):
2062
+ - Triggers fall when balance < 20% (FALLING state)
2063
+ - Determines fall direction from attack angle and stance
2064
+ - Method: `balanceSystem.shouldTriggerFall(player)`
2065
+ - Method: `balanceSystem.determineFallType(player, attackAngle, attackHeight)`
2066
+
2067
+ **Consciousness System** (의식 시스템):
2068
+ - Triggers fall when consciousness < 10% (UNCONSCIOUS state)
2069
+ - Uses last impact angle or stance bias for direction
2070
+ - Method: `consciousnessSystem.shouldTriggerFall(player)`
2071
+ - Method: `consciousnessSystem.determineFallType(player, lastImpactAngle)`
2072
+
2073
+ **Animation Priority**:
2074
+ - Falls have highest priority (Priority 8, above KO=7)
2075
+ - Can interrupt any animation including attacks and stance changes
2076
+ - Automatically transition to ground states upon completion
2077
+
2078
+ ### Implementation Status
2079
+
2080
+ | Feature | Status | Tests | File |
2081
+ |---------|--------|-------|------|
2082
+ | Fall Animation Types | ✅ Complete | 39 | `FallAnimations.ts` |
2083
+ | Fall Direction Logic | ✅ Complete | 39 | `FallAnimations.ts` |
2084
+ | Keyframe Definitions | ✅ Complete | 39 | `FallAnimations.ts` |
2085
+ | Balance Integration | ✅ Complete | 25 | `BalanceSystem.ts` |
2086
+ | Consciousness Integration | ✅ Complete | - | `ConsciousnessSystem.ts` |
2087
+ | Animation State Machine | ✅ Complete | - | `AnimationStateMachine.ts` |
2088
+ | Transition Rules | ✅ Complete | - | `AnimationTransitions.ts` |
2089
+ | Priority System | ✅ Complete | - | `AnimationPriority.ts` |
2090
+ | Impact Effects | 📋 Planned | - | Future enhancement |
2091
+ | Visual Rendering | 📋 Pending | - | Requires 3D integration |
2092
+
2093
+ ### Korean Terminology
2094
+
2095
+ - **낙법 (Nakbeop)**: Falling technique/method
2096
+ - **기상 (Gisang)**: Rising/standing up
2097
+ - **전방낙법 (Jeonbang Nakbeop)**: Forward fall
2098
+ - **후방낙법 (Hubang Nakbeop)**: Backward fall
2099
+ - **측방낙법 (Cheukbang Nakbeop)**: Side fall
2100
+ - **의식상실낙법 (Uisik Sangsil Nakbeop)**: Consciousness loss fall
2101
+ - **기절낙하 (Gijeol Nakha)**: Knockout collapse
2102
+
2103
+ ### Future Enhancements
2104
+
2105
+ - Camera shake on ground impact (2-frame duration)
2106
+ - Ground dust particle effects at impact point
2107
+ - Body impact audio cues
2108
+ - Ground combat actions (ground strikes, grappling)
2109
+ - Archetype-specific fall variations
2110
+
2111
+ ## 🏃 Recovery Animation System (기상 애니메이션 시스템)
2112
+
2113
+ **Added**: January 2025 - Recovery animations for getting up from ground states with Korean martial arts principles
2114
+
2115
+ The Recovery Animation System completes the knockdown-recovery cycle by implementing authentic Korean martial arts recovery techniques (기상 - Gisang) from fallen states. Players can choose between quick standard recovery, fast roll recovery (costs stamina), or slow defensive getup (provides protection).
2116
+
2117
+ ### Recovery Animation Specifications
2118
+
2119
+ #### Four Recovery Types (기상 종류)
2120
+
2121
+ | Recovery Type | Korean | Frames | Duration | Stamina Cost | Special |
2122
+ |---------------|--------|--------|----------|--------------|---------|
2123
+ | **Prone Stand-Up** | 엎드린 기상 | 30 | 500ms | 0 | Push up from face-down |
2124
+ | **Supine Stand-Up** | 누운 기상 | 36 | 600ms | 0 | Sit up, roll forward, stand |
2125
+ | **Roll Recovery** | 회전기상 | 24 | 400ms | 20 | Fastest, roll to side |
2126
+ | **Defensive Getup** | 방어기상 | 42 | 700ms | 0 | Slow but 50% damage reduction |
2127
+
2128
+ #### Recovery Animation Details
2129
+
2130
+ **Prone Stand-Up (엎드린 기상)**:
2131
+ - **Frames 0-8**: Hands push ground, torso lifts
2132
+ - **Frames 9-18**: Legs swing under body, kneeling position
2133
+ - **Frames 19-24**: Rise from kneeling to standing (vulnerable)
2134
+ - **Frames 25-29**: Final stance adjustment (interruptible)
2135
+
2136
+ **Supine Stand-Up (누운 기상)**:
2137
+ - **Frames 0-10**: Abs crunch sit-up motion
2138
+ - **Frames 11-22**: Forward roll onto feet
2139
+ - **Frames 23-30**: Feet plant, rise to standing (vulnerable)
2140
+ - **Frames 31-35**: Final stance adjustment (interruptible)
2141
+
2142
+ **Roll Recovery (회전기상)**:
2143
+ - **Frames 0-6**: Roll to side, momentum building
2144
+ - **Frames 7-14**: Spring to feet with explosive movement
2145
+ - **Frames 15-18**: Quick stance (vulnerable)
2146
+ - **Frames 19-23**: Combat ready (interruptible)
2147
+ - **Cost**: 20 stamina for speed advantage
2148
+
2149
+ **Defensive Getup (방어기상)**:
2150
+ - **Frames 0-14**: Slow rise with arms guarding head/torso
2151
+ - **Frames 15-28**: Gradual stand with maintained guard
2152
+ - **Frames 29-36**: Stance formation with guard (50% damage reduction)
2153
+ - **Frames 37-41**: Ready stance (interruptible)
2154
+
2155
+ #### Ground State to Recovery Mapping
2156
+
2157
+ | Ground State | Default Recovery | Alternative Options |
2158
+ |--------------|------------------|---------------------|
2159
+ | **Prone (엎드림)** | Prone Stand-Up | Roll, Defensive |
2160
+ | **Supine (누움)** | Supine Stand-Up | Roll, Defensive |
2161
+ | **Side Left (좌측와)** | Roll Recovery | Prone/Supine, Defensive |
2162
+ | **Side Right (우측와)** | Roll Recovery | Prone/Supine, Defensive |
2163
+
2164
+ ### Keyboard Controls (키보드 조작)
2165
+
2166
+ **When Grounded (지면 상태)**:
2167
+ - **Space**: Quick/default recovery (based on ground position)
2168
+ - **R or Enter**: Roll recovery (회전기상) - fastest, costs 20 stamina
2169
+ - **Shift**: Defensive getup (방어기상) - slow but protected
2170
+ - **All other inputs**: Blocked (cannot attack/move while down)
2171
+
2172
+ **Input Queue Display**:
2173
+ - "기상 (Quick Recovery)" - Space
2174
+ - "회전기상 (Roll Recovery)" - R/Enter
2175
+ - "방어기상 (Defensive Getup)" - Shift
2176
+
2177
+ ### System Integration
2178
+
2179
+ **Balance System Integration** (균형 시스템):
2180
+ ```typescript
2181
+ // Detect grounded state
2182
+ balanceSystem.isGrounded(animationState) // true if in ground_* state
2183
+ balanceSystem.getGroundState(animationState) // "prone" | "supine" | "side_left" | "side_right"
2184
+
2185
+ // Check stamina for roll recovery
2186
+ balanceSystem.canRecoverWithType(player, "roll_recovery") // true if stamina >= 20
2187
+
2188
+ // Apply stamina cost
2189
+ const updatedPlayer = balanceSystem.applyRecoveryCost(player, "roll_recovery")
2190
+
2191
+ // Get damage multiplier during recovery
2192
+ const multiplier = balanceSystem.getRecoveryDamageMultiplier("defensive_getup", frame)
2193
+ // Returns 0.5 for defensive getup, 1.0 for others
2194
+ ```
2195
+
2196
+ **Animation State Machine** (애니메이션 상태 머신):
2197
+ ```typescript
2198
+ // Determine recovery type from ground state
2199
+ const recoveryType = determineRecoveryType(groundState)
2200
+
2201
+ // Get animation state name
2202
+ const animationState = getRecoveryAnimationState(recoveryType)
2203
+
2204
+ // Transition to recovery animation
2205
+ animationMachine.transitionTo(animationState)
2206
+ // Auto-transitions to "idle" when complete
2207
+ ```
2208
+
2209
+ **Keyboard Controls Hook**:
2210
+ ```typescript
2211
+ useKeyboardControls({
2212
+ currentAnimationState: player1Animation.currentState,
2213
+ onAction: (action) => {
2214
+ if (action === "recovery_quick") {
2215
+ // Handle quick recovery
2216
+ } else if (action === "recovery_roll") {
2217
+ // Handle roll recovery
2218
+ } else if (action === "recovery_defensive") {
2219
+ // Handle defensive getup
2220
+ }
2221
+ }
2222
+ })
2223
+ ```
2224
+
2225
+ ### Vulnerable Frames & Interruptibility
2226
+
2227
+ **Vulnerability Windows**:
2228
+ - **Prone/Supine Stand-Up**: First 80% of animation (frames 0-24/0-30)
2229
+ - **Roll Recovery**: First 75% of animation (frames 0-18)
2230
+ - **Defensive Getup**: All frames (but 50% damage reduction)
2231
+
2232
+ **Interruptibility**:
2233
+ - Last 6 frames (100ms) of each recovery are interruptible
2234
+ - High-priority states (hit, ko, falls) can interrupt at any time
2235
+ - Normal actions cannot interrupt recovery
2236
+
2237
+ **Animation Priority**:
2238
+ - Recovery has highest priority (Priority 9)
2239
+ - Only falls (8), KO (7), and hits (6) can interrupt
2240
+ - Cannot switch between recovery types mid-execution
2241
+
2242
+ ### Implementation Status
2243
+
2244
+ | Feature | Status | Tests | File |
2245
+ |---------|--------|-------|------|
2246
+ | Recovery Animation Types | ✅ Complete | 31 | `RecoveryAnimations.ts` |
2247
+ | Keyframe Definitions | ✅ Complete | 31 | `RecoveryAnimations.ts` |
2248
+ | Stamina Cost System | ✅ Complete | 38 | `BalanceSystem.ts` |
2249
+ | Damage Reduction | ✅ Complete | 38 | `BalanceSystem.ts` |
2250
+ | Ground State Detection | ✅ Complete | 38 | `BalanceSystem.ts` |
2251
+ | Animation State Machine | ✅ Complete | 25 | `AnimationStateMachine.ts` |
2252
+ | Transition Rules | ✅ Complete | - | `AnimationTransitions.ts` |
2253
+ | Priority System | ✅ Complete | - | `AnimationPriority.ts` |
2254
+ | Keyboard Input Detection | ✅ Complete | - | `useKeyboardControls.ts` |
2255
+ | Combat Screen Integration | ✅ Complete | - | `CombatScreen3D.tsx` |
2256
+ | Visual Rendering | 📋 Pending | - | Requires 3D keyframe rendering |
2257
+
2258
+ ### Korean Terminology (한국어 용어)
2259
+
2260
+ **Recovery Types**:
2261
+ - **기상 (Gisang)**: Rising/standing up
2262
+ - **낙법 (Nakbeop)**: Falling/recovery technique
2263
+ - **엎드린 기상 (Eopdeurin Gisang)**: Prone stand-up
2264
+ - **누운 기상 (Nuun Gisang)**: Supine stand-up
2265
+ - **회전기상 (Hoejeon Gisang)**: Roll recovery
2266
+ - **방어기상 (Bangeo Gisang)**: Defensive getup
2267
+
2268
+ **Ground States**:
2269
+ - **엎드림 (Eopdeurim)**: Prone (face down)
2270
+ - **누움 (Nueum)**: Supine (face up)
2271
+ - **좌측와 (Jwacheukwa)**: Left side
2272
+ - **우측와 (Ucheukwa)**: Right side
2273
+
2274
+ **Combat Terms**:
2275
+ - **취약프레임 (Chwiyak Frame)**: Vulnerable frames
2276
+ - **방어배율 (Bangeo Baeyul)**: Damage reduction multiplier
2277
+ - **체력소모 (Cheryeok Somo)**: Stamina cost
2278
+
2279
+ ### Usage Example
2280
+
2281
+ ```typescript
2282
+ // Complete fall-ground-recovery cycle
2283
+ // 1. Player falls forward
2284
+ animationMachine.transitionTo("fall_forward");
2285
+
2286
+ // 2. Fall completes, auto-transition to ground_prone
2287
+ // (handled by AnimationStateMachine)
2288
+
2289
+ // 3. Player presses Space while grounded
2290
+ if (balanceSystem.isGrounded(currentState)) {
2291
+ const groundState = balanceSystem.getGroundState(currentState); // "prone"
2292
+ const recoveryType = determineRecoveryType(groundState); // "prone_standup"
2293
+ const animationState = getRecoveryAnimationState(recoveryType); // "recovery_prone_standup"
2294
+
2295
+ animationMachine.transitionTo(animationState);
2296
+ }
2297
+
2298
+ // 4. Recovery completes, auto-transition to idle
2299
+ // (handled by AnimationStateMachine)
2300
+ ```
2301
+
2302
+ ### Design Philosophy
2303
+
2304
+ Recovery animations follow Black Trigram's Korean martial arts principles:
2305
+
2306
+ **정확한 타격 (Precise Targeting)**:
2307
+ - Vulnerable frame tracking for realistic combat
2308
+ - Damage reduction mechanics for defensive options
2309
+
2310
+ **최대 효과 (Maximum Effectiveness)**:
2311
+ - Stamina costs balance speed advantage
2312
+ - Risk/reward for different recovery types
2313
+
2314
+ **전통 지식 (Traditional Knowledge)**:
2315
+ - Based on Korean 낙법 (nakbeop) principles
2316
+ - Authentic martial arts recovery techniques
2317
+
2318
+ **원형 특화 (Archetype Specialization)**:
2319
+ - Ready for archetype-specific recovery bonuses
2320
+ - Musa: Faster prone recovery
2321
+ - Amsalja: Stealthier roll recovery
2322
+ - Hacker: Enhanced defensive getup
2323
+
2324
+ ### Performance Targets
2325
+
2326
+ - **60 FPS**: All recovery animations maintain 60fps
2327
+ - **Frame Accuracy**: Precise timing for vulnerable windows
2328
+ - **Instant Response**: Recovery input detection < 16ms
2329
+ - **Smooth Transitions**: No animation stuttering during recovery
2330
+
2331
+ ## 🎮 Combat Component Architecture
2332
+
2333
+ ```mermaid
2334
+ graph TB
2335
+ subgraph "React Components Layer"
2336
+ CS[CombatScreen]:::react
2337
+ CS --> CA[CombatArena]:::react
2338
+ CS --> CH[CombatHUD]:::react
2339
+ CS --> CC[CombatControls]:::react
2340
+ end
2341
+
2342
+ subgraph "PixiJS Rendering Layer"
2343
+ PL[Player Visuals]:::pixi
2344
+ HL[HitEffectsLayer]:::pixi
2345
+ DB[DojangBackground]:::pixi
2346
+ UI[UI Components]:::pixi
2347
+ end
2348
+
2349
+ subgraph "Game Logic Layer"
2350
+ GE[GameEngine]:::logic
2351
+ PS[PlayerState]:::logic
2352
+ GS[GameState]:::logic
2353
+ end
2354
+
2355
+ CS --> PL
2356
+ CA --> HL
2357
+ CH --> DB
2358
+ CC --> UI
2359
+
2360
+ PL --> GE
2361
+ HL --> PS
2362
+ DB --> GS
2363
+ UI --> GE
2364
+
2365
+ classDef react fill:#61dafb,stroke:#333,color:#000
2366
+ classDef pixi fill:#ff6b9d,stroke:#333,color:#fff
2367
+ classDef logic fill:#f7df1e,stroke:#333,color:#000
2368
+ ```
2369
+
2370
+ ---
2371
+
2372
+ ## 🔊 Audio System Integration
2373
+
2374
+ ```mermaid
2375
+ graph LR
2376
+ subgraph "Traditional Korean Instruments (국악)"
2377
+ GAY[가야금 Gayageum]:::traditional
2378
+ BUK[북 Buk Drums]:::traditional
2379
+ KKW[꽹과리 Kkwaenggwari]:::traditional
2380
+ HAE[해금 Haegeum]:::traditional
2381
+ end
2382
+
2383
+ subgraph "Combat Audio Events"
2384
+ HIT[타격음 Hit Sounds]:::combat
2385
+ TECH[기법음 Technique Sounds]:::combat
2386
+ VITAL[급소음 Vital Point Sounds]:::combat
2387
+ STANCE[자세음 Stance Sounds]:::combat
2388
+ end
2389
+
2390
+ subgraph "Cyberpunk Elements"
2391
+ SYNTH[신스 Synth Drones]:::cyber
2392
+ GLITCH[글리치 Digital Glitches]:::cyber
2393
+ NEON[네온 Neon Ambience]:::cyber
2394
+ end
2395
+
2396
+ GAY --> HIT
2397
+ BUK --> TECH
2398
+ KKW --> VITAL
2399
+ HAE --> STANCE
2400
+
2401
+ HIT --> SYNTH
2402
+ TECH --> GLITCH
2403
+ VITAL --> NEON
2404
+ STANCE --> SYNTH
2405
+
2406
+ classDef traditional fill:#8b4513,stroke:#ffd700,color:#ffd700
2407
+ classDef combat fill:#ff4500,stroke:#333,color:#fff
2408
+ classDef cyber fill:#00ffff,stroke:#333,color:#000
2409
+ ```
2410
+
2411
+ ---
2412
+
2413
+ ## 📊 Type System Foundation
2414
+
2415
+ ### Core Combat Types Structure:
2416
+
2417
+ ```typescript
2418
+ // Current Type System Implementation Status:
2419
+
2420
+ // ✅ COMPLETE - Well-defined interfaces
2421
+ interface CombatResult {
2422
+ damage: number;
2423
+ hit: boolean;
2424
+ critical: boolean;
2425
+ vitalPointsHit: VitalPoint[];
2426
+ // ... comprehensive combat result data
2427
+ }
2428
+
2429
+ // ✅ COMPLETE - Player archetype definitions
2430
+ type PlayerArchetype =
2431
+ | "musa"
2432
+ | "amsalja"
2433
+ | "hacker"
2434
+ | "jeongbo_yowon"
2435
+ | "jojik_pokryeokbae";
2436
+
2437
+ // ✅ COMPLETE - Trigram stance system
2438
+ type TrigramStance =
2439
+ | "geon"
2440
+ | "tae"
2441
+ | "li"
2442
+ | "jin"
2443
+ | "son"
2444
+ | "gam"
2445
+ | "gan"
2446
+ | "gon";
2447
+
2448
+ // ✅ COMPLETE - Vital point system
2449
+ interface VitalPoint {
2450
+ id: string;
2451
+ name: KoreanText;
2452
+ category: VitalPointCategory;
2453
+ severity: VitalPointSeverity;
2454
+ // ... anatomical positioning and effects
2455
+ }
2456
+
2457
+ // ❌ NEEDS IMPLEMENTATION - Combat techniques
2458
+ interface KoreanTechnique {
2459
+ // Defined but needs population with authentic Korean martial arts data
2460
+ }
2461
+ ```
2462
+
2463
+ ---
2464
+
2465
+ ## 💀 Complete 70 Vital Points System (70개 급소 완전 체계)
2466
+
2467
+ **Implementation Status**: Q1 2026 - All 70 vital points operational with damage calculation
2468
+
2469
+ ### Overview (개요)
2470
+
2471
+ The Black Trigram combat system implements all **70 authentic vital points (급소)** from Korean martial arts, organized by anatomical system for realistic combat damage calculation.
2472
+
2473
+ **Distribution**:
2474
+ - **Nervous System** (신경계): 25 points
2475
+ - **Circulatory System** (순환계): 15 points
2476
+ - **Respiratory System** (호흡기계): 10 points
2477
+ - **Musculoskeletal System** (근골격계): 20 points
2478
+
2479
+ **Cross-Reference**: See [docs/vital-points/VITAL_POINTS_REFERENCE.md](./docs/vital-points/VITAL_POINTS_REFERENCE.md) for complete anatomical documentation including TCM meridian associations, medical references, and Korean martial arts techniques.
2480
+
2481
+ ### 🧠 Nervous System Targets (신경계 급소) - 25 Points
2482
+
2483
+ Critical points targeting the neurological system for instant incapacitation, paralysis, and unconsciousness.
2484
+
2485
+ | # | Korean Name | Romanization | English Name | Location | Acupoint | Base Damage | Duration | Effects |
2486
+ |---|-------------|--------------|--------------|----------|----------|-------------|----------|---------|
2487
+ | 1 | 백회혈 | Baekhoehyeol | Crown Point | Top of skull, midline | GV20 | 45 | Instant | Unconsciousness, vertigo, KO |
2488
+ | 2 | 인영 | Inyeong | Carotid Sinus | Neck, lateral to Adam's apple | ST9 | 50 | 2-5s | Blood pressure drop, unconsciousness |
2489
+ | 3 | 명문 | Myeongmun | Gate of Life | Lumbar spine, L2-L3 | GV4 | 38 | Instant | Paralysis, severe pain, kidney shock |
2490
+ | 4 | 삼초수 | Samchosu | Triple Burner | Behind ear, mastoid process | TB10 | 32 | Instant | Disorientation, balance loss, nausea |
2491
+ | 5 | 대추 | Daechu | Great Hammer | C7 vertebra, base of neck | GV14 | 40 | Instant | Paralysis, respiratory disruption |
2492
+ | 6 | 풍지 | Pungji | Wind Pool | Base of skull, trapezius | GB20 | 36 | 2-3s | Unconsciousness, cranial nerve disruption |
2493
+ | 7 | 천주 | Cheonju | Celestial Pillar | Upper neck, 1.3 cun lateral | BL10 | 34 | Instant | Severe pain, cervical nerve damage |
2494
+ | 8 | 태양혈 | Taeyanghyeol | Temple | Lateral to eye, temporal bone | ST8 | 42 | Instant | Concussion, unconsciousness, death risk |
2495
+ | 9 | 곡지 | Gokji | Pool at the Bend | Elbow crease, lateral end | LI11 | 26 | 1-2s | Arm paralysis, nerve shock |
2496
+ | 10 | 수삼리 | Susamni | Arm Three Miles | 3 cun below elbow, forearm | LI10 | 24 | 1-2s | Forearm numbness, grip loss |
2497
+ | 11 | 합곡 | Hapgok | Joining Valley | Hand, between thumb-index | LI4 | 22 | Instant | Hand paralysis, severe pain |
2498
+ | 12 | 족삼리 | Joksamni | Leg Three Miles | 3 cun below knee, tibia | ST36 | 28 | 1-3s | Leg weakness, balance loss |
2499
+ | 13 | 승산 | Seungsan | Mountain Support | Calf, belly of gastrocnemius | BL57 | 30 | Instant | Leg cramp, mobility loss |
2500
+ | 14 | 곤륜 | Gonnryun | Kunlun Mountain | Ankle, lateral malleolus-Achilles | BL60 | 26 | 1-2s | Ankle dysfunction, severe pain |
2501
+ | 15 | 용천 | Yongcheon | Bubbling Spring | Sole, ball of foot depression | KI1 | 32 | Instant | Shock, balance loss, unconsciousness |
2502
+ | 16 | 영도 | Yeongdo | Spirit Path | Wrist, ulnar side | HT4 | 24 | Instant | Hand numbness, nerve pain |
2503
+ | 17 | 신문 | Sinmun | Spirit Gate | Wrist crease, ulnar side | HT7 | 26 | 1-2s | Wrist paralysis, cardiac shock |
2504
+ | 18 | 내관 | Naegwan | Inner Gate | Forearm, 2 cun above wrist | PC6 | 24 | 1-2s | Nausea, cardiac rhythm disruption |
2505
+ | 19 | 양릉천 | Yangnyeongcheon | Yang Mound Spring | Knee, fibula head depression | GB34 | 30 | 1-2s | Knee dysfunction, leg weakness |
2506
+ | 20 | 환도 | Hwando | Jumping Round | Hip, greater trochanter | GB30 | 34 | Instant | Hip paralysis, sciatica, immobility |
2507
+ | 21 | 견정 | Gyeonjeong | Shoulder Well | Shoulder, trapezius midpoint | GB21 | 28 | Instant | Shoulder drop, arm weakness |
2508
+ | 22 | 풍부 | Pungbu | Wind Mansion | Skull base, below external occipital | GV16 | 48 | Instant | Medulla damage, death risk, paralysis |
2509
+ | 23 | 아문 | Amun | Mute Gate | C1-C2, below skull | GV15 | 46 | Instant | Speech loss, paralysis, death risk |
2510
+ | 24 | 영대 | Yeongdae | Spirit Platform | T6-T7, between shoulder blades | GV10 | 30 | Instant | Respiratory difficulty, back spasm |
2511
+ | 25 | 요양관 | Yoyangkwan | Lumbar Yang Gate | L3-L4, lumbar spine | GV3 | 36 | Instant | Lower body paralysis, kidney shock |
2512
+
2513
+ **Archetype Modifiers** (무사 유형별 계수):
2514
+ - **무사 (Musa)**: 1.2x damage to GV points (척추 중심)
2515
+ - **암살자 (Amsalja)**: 1.5x damage to neck points (경부 특화)
2516
+ - **해커 (Hacker)**: 1.0x baseline (기술 의존)
2517
+ - **정보요원 (Jeongbo)**: 1.3x precision multiplier to small targets
2518
+ - **조직폭력배 (Jojik)**: 1.1x to all nervous system points
2519
+
2520
+ ### 🩸 Circulatory System Targets (순환계 급소) - 15 Points
2521
+
2522
+ Vital points disrupting blood flow, causing hemorrhage, and inducing unconsciousness through vascular trauma.
2523
+
2524
+ | # | Korean Name | Romanization | English Name | Location | Artery | Base Damage | Duration | Effects |
2525
+ |---|-------------|--------------|--------------|----------|--------|-------------|----------|---------|
2526
+ | 26 | 경동맥 | Gyeongdongmaek | Carotid Artery | Neck, lateral to thyroid | N/A | 55 | 3-8s | Unconsciousness, death risk, hemorrhage |
2527
+ | 27 | 목동맥굴 | Mokdongmaekgul | Carotid Sinus | Neck, bifurcation point | N/A | 50 | 2-5s | Baroreceptor shock, BP drop, KO |
2528
+ | 28 | 쇄골하동맥 | Swaegolhadongmaek | Subclavian Artery | Clavicle, deep strike | N/A | 48 | 5-10s | Arm ischemia, internal bleeding |
2529
+ | 29 | 액와동맥 | Aekwadongmaek | Axillary Artery | Armpit, deep medial | N/A | 46 | 5-12s | Severe arm hemorrhage |
2530
+ | 30 | 상완동맥 | Sangwandongmaek | Brachial Artery | Inner bicep, midpoint | N/A | 40 | 3-8s | Forearm ischemia, hemorrhage |
2531
+ | 31 | 요골동맥 | Yogoldongmaek | Radial Artery | Wrist, thumb side pulse | N/A | 35 | 2-5s | Hand ischemia, blood loss |
2532
+ | 32 | 척골동맥 | Cheokgoldongmaek | Ulnar Artery | Wrist, pinky side | N/A | 35 | 2-5s | Hand ischemia, blood loss |
2533
+ | 33 | 대퇴동맥 | Daetoedongmaek | Femoral Artery | Groin, inguinal ligament | N/A | 60 | 3-10s | Massive hemorrhage, death risk |
2534
+ | 34 | 슬와동맥 | Seulwadongmaek | Popliteal Artery | Behind knee, deep | N/A | 42 | 5-12s | Lower leg ischemia, hemorrhage |
2535
+ | 35 | 경골동맥 | Gyeonggoldongmaek | Tibial Artery | Ankle, medial malleolus | N/A | 38 | 3-8s | Foot ischemia, bleeding |
2536
+ | 36 | 족배동맥 | Jokbaedongmaek | Dorsalis Pedis | Foot dorsum, pulse point | N/A | 32 | 2-5s | Foot blood loss |
2537
+ | 37 | 복부대동맥 | Bokbudaedongmaek | Abdominal Aorta | Solar plexus, deep | N/A | 58 | Instant | Aortic trauma, internal bleeding, death |
2538
+ | 38 | 장골동맥 | Janggoldongmaek | Iliac Artery | Lower abdomen, iliac crest | N/A | 52 | 5-10s | Pelvic hemorrhage, shock |
2539
+ | 39 | 간문맥 | Ganmunmaek | Hepatic Portal | Right upper abdomen | N/A | 50 | Instant | Liver hemorrhage, death risk |
2540
+ | 40 | 신동맥 | Sindongmaek | Renal Artery | Flank, kidney region | N/A | 48 | Instant | Kidney hemorrhage, shock |
2541
+
2542
+ **Archetype Modifiers**:
2543
+ - **무사 (Musa)**: 1.1x to major arteries
2544
+ - **암살자 (Amsalja)**: 1.4x to neck arteries (carotid specialization)
2545
+ - **해커 (Hacker)**: 0.9x (less effective without precision)
2546
+ - **정보요원 (Jeongbo)**: 1.2x to all circulatory targets
2547
+ - **조직폭력배 (Jojik)**: 1.3x to accessible arteries (limbs)
2548
+
2549
+ ### 🫁 Respiratory System Targets (호흡기계 급소) - 10 Points
2550
+
2551
+ Targets disrupting breathing, causing suffocation, and inducing respiratory failure.
2552
+
2553
+ | # | Korean Name | Romanization | English Name | Location | Structure | Base Damage | Duration | Effects |
2554
+ |---|-------------|--------------|--------------|----------|-----------|-------------|----------|---------|
2555
+ | 41 | 인후 | Inho | Throat | Front of neck, trachea | Larynx | 50 | Instant | Airway closure, suffocation, death risk |
2556
+ | 42 | 염천돌기 | Yeomcheon-dolgi | Xiphoid Process | Sternum base, solar plexus | Diaphragm | 42 | Instant | Diaphragm spasm, breathlessness |
2557
+ | 43 | 단중 | Danjung | Chest Center | Sternum, between nipples | CV17 | 40 | 2-5s | Cardiac shock, breath disruption |
2558
+ | 44 | 늑간 | Neukgan | Intercostal | Ribs, between bones | Intercostals | 35 | Instant | Rib fracture, lung puncture risk |
2559
+ | 45 | 폐유 | Paeyu | Lung Shu | Upper back, T3 paraspinal | BL13 | 38 | Instant | Lung trauma, breathing difficulty |
2560
+ | 46 | 중완 | Jungwan | Middle Epigastrium | Upper abdomen, below sternum | CV12 | 36 | Instant | Diaphragm shock, nausea |
2561
+ | 47 | 기해 | Gihae | Sea of Qi | Lower abdomen, below navel | CV6 | 34 | 1-3s | Core breath disruption |
2562
+ | 48 | 천돌 | Cheondol | Celestial Chimney | Suprasternal notch | CV22 | 44 | Instant | Trachea collapse, suffocation |
2563
+ | 49 | 결분 | Gyeolbun | Empty Basin | Supraclavicular fossa | ST12 | 32 | Instant | Lung apex trauma |
2564
+ | 50 | 유문 | Yumun | Gate of Seclusion | Lower ribs, floating ribs | KI21 | 38 | Instant | Diaphragm disruption, liver trauma |
2565
+
2566
+ **Archetype Modifiers**:
2567
+ - **무사 (Musa)**: 1.2x to chest targets
2568
+ - **암살자 (Amsalja)**: 1.5x to throat (silent kills)
2569
+ - **해커 (Hacker)**: 1.0x baseline
2570
+ - **정보요원 (Jeongbo)**: 1.1x precision
2571
+ - **조직폭력배 (Jojik)**: 1.3x to throat/chest
2572
+
2573
+ ### 🦴 Musculoskeletal System Targets (근골격계 급소) - 20 Points
2574
+
2575
+ Joint locks, bone strikes, and structural damage points targeting mobility and skeletal integrity.
2576
+
2577
+ | # | Korean Name | Romanization | English Name | Location | Structure | Base Damage | Duration | Effects |
2578
+ |---|-------------|--------------|--------------|----------|-----------|-------------|----------|---------|
2579
+ | 51 | 턱관절 | Teokgwanjeol | Jaw Joint | TMJ, in front of ear | Mandible | 38 | Instant | Jaw dislocation, KO, concussion |
2580
+ | 52 | 코뼈 | Kobbyeo | Nasal Bone | Nose bridge, upper | Nasal bones | 32 | Instant | Nasal fracture, eye trauma, bleeding |
2581
+ | 53 | 관골 | Gwangol | Cheekbone | Zygomatic arch | Zygomatic | 36 | Instant | Facial fracture, orbital damage |
2582
+ | 54 | 쇄골 | Swaegol | Clavicle | Collarbone, midpoint | Clavicle | 40 | Instant | Clavicle fracture, shoulder dysfunction |
2583
+ | 55 | 흉골 | Heunggol | Sternum | Breastbone, center | Sternum | 42 | Instant | Sternal fracture, cardiac trauma |
2584
+ | 56 | 견갑골 | Gyeonggapgol | Scapula | Shoulder blade, spine | Scapula | 34 | Instant | Shoulder immobility, fracture |
2585
+ | 57 | 견관절 | Gyeongwanjeol | Shoulder Joint | Glenohumeral joint | Shoulder | 38 | Instant | Dislocation, rotator cuff tear |
2586
+ | 58 | 주관절 | Jugwanjeol | Elbow Joint | Humeroulnar joint | Elbow | 40 | Instant | Hyperextension, dislocation, fracture |
2587
+ | 59 | 손목관절 | Sonmokgwanjeol | Wrist Joint | Radiocarpal joint | Wrist | 30 | Instant | Wrist fracture, ligament tear |
2588
+ | 60 | 손가락관절 | Songaraggwanjeol | Finger Joints | Metacarpophalangeal | Fingers | 22 | Instant | Finger dislocation, break |
2589
+ | 61 | 척추 | Cheokchu | Spinal Column | Vertebrae, various levels | Spine | 50 | Instant | Vertebral fracture, paralysis, death |
2590
+ | 62 | 늑골 | Neukgol | Ribs | Rib cage, lateral | Ribs | 36 | Instant | Rib fracture, lung puncture |
2591
+ | 63 | 고관절 | Gogwanjeol | Hip Joint | Acetabulofemoral | Hip | 42 | Instant | Hip dislocation, immobility |
2592
+ | 64 | 슬관절 | Seulgwanjeol | Knee Joint | Tibiofemoral | Knee | 40 | Instant | ACL tear, dislocation, mobility loss |
2593
+ | 65 | 정강이 | Jeonggangai | Shin | Tibia, anterior | Tibia | 32 | Instant | Tibial fracture, severe pain |
2594
+ | 66 | 발목관절 | Balmokgwanjeol | Ankle Joint | Talocrural joint | Ankle | 34 | Instant | Ankle fracture, sprain, mobility loss |
2595
+ | 67 | 아킬레스건 | Akilleseugeon | Achilles Tendon | Heel, posterior | Tendon | 38 | Instant | Tendon rupture, immobility |
2596
+ | 68 | 슬개골 | Seulgaegol | Kneecap | Patella, anterior knee | Patella | 36 | Instant | Patellar fracture, knee dysfunction |
2597
+ | 69 | 발등뼈 | Baldeungbyeo | Metatarsal | Foot dorsum, bones | Metatarsals | 28 | Instant | Foot fracture, mobility loss |
2598
+ | 70 | 발가락관절 | Balgaraggwanjeol | Toe Joints | Phalanges, foot | Toes | 20 | Instant | Toe fracture, balance disruption |
2599
+
2600
+ **Archetype Modifiers**:
2601
+ - **무사 (Musa)**: 1.3x to skeletal targets (bone-breaking focus)
2602
+ - **암살자 (Amsalja)**: 0.9x (less effective with structural damage)
2603
+ - **해커 (Hacker)**: 1.0x baseline
2604
+ - **정보요원 (Jeongbo)**: 1.1x to joints (technical precision)
2605
+ - **조직폭력배 (Jojik)**: 1.4x to limbs and joints (street fighting)
2606
+
2607
+ ---
2608
+
2609
+ ## ⚙️ Damage Calculation System (데미지 계산 시스템)
2610
+
2611
+ **Implementation Status**: Q1 2026 - Fully operational with multi-factor calculation
2612
+
2613
+ For an overview of the TypeScript implementation approach and damage formula reference, see the [Damage Calculation Guide](./docs/combat/damage-calculation-guide.md). Three worked examples are provided below.
2614
+
2615
+ ### Quick Reference: Damage Formula
2616
+
2617
+ ```
2618
+ Final Damage = max(1, (Base * Archetype * Stance * Anatomy * Critical) * (1 - DefenseReduction))
2619
+ ```
2620
+
2621
+ **Multipliers**:
2622
+ - **Archetype**: 0.9x-1.5x (specialization bonus)
2623
+ - **Stance**: 0.8x-1.5x (I Ching synergy)
2624
+ - **Anatomy**: 1.0x-2.0x (precision targeting)
2625
+ - **Critical**: 1.0x or 2.0x (random with skill influence)
2626
+ - **Defense Reduction**: 0-0.8x (max 80% reduction, based on defender defense stat / 200)
2627
+
2628
+ **Minimum Damage**: Always deals at least 1 HP damage
2629
+
2630
+ > **Implementation Note**: The canonical damage calculation including defense reduction logic and minimum damage floor is in `src/systems/vitalpoint/DamageCalculator.ts` (lines 172-177).
2631
+
2632
+ **Example**: Musa striking Baekhoehyeol (Crown) with Geon stance:
2633
+ - Base: 45 HP
2634
+ - Archetype: 1.2x (Musa vs Nervous)
2635
+ - Stance: 1.2x (Geon vs Son)
2636
+ - Anatomy: 1.5x (75% accuracy)
2637
+ - Critical: 2.0x (successful roll)
2638
+ - Raw: 45 × 1.2 × 1.2 × 1.5 × 2.0 = **194 HP**
2639
+ - Defense Reduction: 0.21x (41 defense / 200 = 21% reduction)
2640
+ - **Final: max(1, 194 × (1 - 0.21)) = 153 HP damage** + Stun (3s) + Disorientation (5s)
2641
+
2642
+ ---
2643
+
2644
+ ## 🦴 28-Bone Skeletal Animation System (28개 뼈 골격 애니메이션)
2645
+
2646
+ **Implementation Status**: Q1 2026 - Fully operational skeletal rig with 7 hand poses
2647
+
2648
+ Black Trigram uses a **28-bone hierarchical skeletal system** for realistic combat animations, hand pose articulation, and vital point strike visualization.
2649
+
2650
+ ### Bone Hierarchy (뼈 계층 구조)
2651
+
2652
+ **Core Spine** (4 bones): Pelvis → Spine_Lower → Spine_Upper → Chest
2653
+ **Head & Neck** (2 bones): Neck → Head
2654
+ **Left Arm** (6 bones): Shoulder_L → Upper_Arm_L → Elbow_L → Forearm_L → Wrist_L → Hand_L
2655
+ **Right Arm** (6 bones): Shoulder_R → Upper_Arm_R → Elbow_R → Forearm_R → Wrist_R → Hand_R
2656
+ **Left Leg** (5 bones): Hip_L → Thigh_L → Knee_L → Shin_L → Ankle_L
2657
+ **Right Leg** (5 bones): Hip_R → Thigh_R → Knee_R → Shin_R → Ankle_R
2658
+
2659
+ **Total**: 28 bones for full-body animation at 60fps
2660
+
2661
+ ### 7 Hand Pose System (7개 수형 체계)
2662
+
2663
+ Korean martial arts hand formations optimized for different vital point targets:
2664
+
2665
+ | # | Korean | Romanization | English | Use | Vital Points | Multiplier |
2666
+ |---|--------|--------------|---------|-----|--------------|------------|
2667
+ | 1 | 주먹 | Jumeok | Closed Fist | Bone strikes | Jaw, temple, sternum, ribs | 1.2x |
2668
+ | 2 | 손바닥 | Sonbadak | Open Palm | Push, slap strikes | Face, chest, solar plexus | 1.1x |
2669
+ | 3 | 타격 | Tagyeok | Knife-Hand | Precise strikes | Neck, throat, nerve points | 1.3x |
2670
+ | 4 | 잡기 | Japgi | Grasping | Joint locks | Wrist, elbow, neck | 1.1x |
2671
+ | 5 | 막기 | Makgi | Blocking | Defense | N/A (defensive) | 0.8x |
2672
+ | 6 | 가리키기 | Garikigi | Pointing | Eye strikes | Eyes, throat, acupoints | 1.4x |
2673
+ | 7 | 이완 | Ewan | Relaxed | Neutral | N/A (transition) | 1.0x |
2674
+
2675
+ ### Combat Technique Animation
2676
+
2677
+ Each technique defines:
2678
+ - **Bone Transforms**: Position/rotation/scale for all 28 bones across keyframes
2679
+ - **Hand Poses**: Left and right hand formations at each keyframe
2680
+ - **Muscle Tension**: Core/upper/lower body activation levels (0-100)
2681
+ - **Impact Frame**: Exact frame where strike connects with vital point
2682
+
2683
+ **Example**: 천둥벽력 (Heaven Strike)
2684
+ - Duration: 800ms (48 frames at 60fps)
2685
+ - Impact Frame: 48
2686
+ - Hand Pose: 주먹 (Closed Fist)
2687
+ - Target: 백회혈 (Crown), 쇄골 (Clavicle), 대추 (C7)
2688
+
2689
+ ---
2690
+
2691
+ ## 💊 Status Effect System (상태 효과 시스템)
2692
+
2693
+ **Implementation Status**: Q1 2026 - 5 primary status effects operational
2694
+
2695
+ Status effects are applied based on vital point anatomical system and damage severity.
2696
+
2697
+ ### Status Effects Table
2698
+
2699
+ | Effect | Korean | Duration | Application | Stack Limit | Visual Indicator | Gameplay Impact |
2700
+ |--------|--------|----------|-------------|-------------|------------------|-----------------|
2701
+ | **기절 (Stun)** | 기절 | 1-5s | Nervous system critical hits | None (refreshes) | ⚡ Lightning icon, wobble animation | Cannot act, vulnerable to followups |
2702
+ | **출혈 (Bleed)** | 출혈 | 5-15s | Circulatory hits ≥45 damage | 3 stacks | 🩸 Blood particles, red pulse | 5 HP/sec per stack (15 HP/sec max at 3 stacks) |
2703
+ | **피로 (Fatigue)** | 피로 | 10-30s | Stamina depletion, heavy hits | None (stacks additively) | 😓 Sweat particles, slow movement | -20% movement speed, +25% stamina cost |
2704
+ | **마비 (Paralysis)** | 마비 | 3-10s | Nerve strikes, spine hits | None (refreshes) | ⚠️ Yellow icon, shaking limbs | Reduced attack speed (-40%), mobility loss |
2705
+ | **혼란 (Disorientation)** | 혼란 | 3-8s | Head trauma, vestibular damage | None (refreshes) | 🌀 Dizzy icon, screen blur | Accuracy -50%, vision impaired, controls inverted |
2706
+
2707
+ ### Stacking Rules
2708
+
2709
+ - **Stun**: Cannot stack, refreshes duration to longest value
2710
+ - **Bleed**: Stacks up to 3x, each adds independent DoT (15 HP/sec max)
2711
+ - **Fatigue**: Duration extends additively, effects compound
2712
+ - **Paralysis**: Cannot stack, refreshes to longest duration
2713
+ - **Disorientation**: Cannot stack, most severe effect takes priority
2714
+
2715
+ ### Status Removal
2716
+
2717
+ **Natural Expiration**: All effects expire after duration
2718
+ **Cleansing**: Healing items/abilities can remove specific effects
2719
+ **Death**: All effects removed on knockout/death
2720
+ **Stance Change**: Some stances provide status resistance (-30% duration)
2721
+
2722
+ ---
2723
+
2724
+ ## 🤖 Combat AI Behavior System (전투 AI 행동 시스템)
2725
+
2726
+ **Implementation Status**: Q1 2026 - 50% complete (basic decision tree operational)
2727
+
2728
+ AI fighters utilize behavior trees for dynamic combat decision-making based on health, stance, and tactical situation.
2729
+
2730
+ ### AI Decision Flow
2731
+
2732
+ ```mermaid
2733
+ graph TB
2734
+ START[Combat AI Tick]:::start --> ASSESS[Assess Situation]:::process
2735
+
2736
+ ASSESS --> HP{Health Check}:::decision
2737
+ HP -->|>70%| AGG[Aggressive Mode]:::aggressive
2738
+ HP -->|30-70%| BAL[Balanced Mode]:::balanced
2739
+ HP -->|<30%| DEF[Defensive Mode]:::defensive
2740
+
2741
+ AGG --> PICK_ATK[Select Attack]:::action
2742
+ BAL --> EVAL[Evaluate Stance]:::process
2743
+ DEF --> RETREAT[Retreat & Guard]:::action
2744
+
2745
+ PICK_ATK --> VP1[Target Vital Point]:::action
2746
+ EVAL --> STANCE{Stance Advantage?}:::decision
2747
+ STANCE -->|Yes| PICK_ATK
2748
+ STANCE -->|No| SWITCH[Change Stance]:::action
2749
+
2750
+ VP1 --> CALC1[Calculate Threat Score]:::process
2751
+ SWITCH --> PICK_ATK
2752
+ RETREAT --> GUARD[Defensive Stance]:::action
2753
+
2754
+ CALC1 --> EXEC[Execute Technique]:::action
2755
+ GUARD --> WAIT[Wait for Opening]:::action
2756
+
2757
+ EXEC --> END[End AI Tick]:::end
2758
+ WAIT --> END
2759
+
2760
+ classDef start fill:#00ff00,stroke:#333,color:#000
2761
+ classDef process fill:#4da6ff,stroke:#333,color:#fff
2762
+ classDef decision fill:#ffcc00,stroke:#333,color:#000
2763
+ classDef aggressive fill:#ff0000,stroke:#333,color:#fff
2764
+ classDef balanced fill:#ff8c00,stroke:#333,color:#fff
2765
+ classDef defensive fill:#0066cc,stroke:#333,color:#fff
2766
+ classDef action fill:#9370db,stroke:#333,color:#fff
2767
+ classDef end fill:#808080,stroke:#333,color:#fff
2768
+ ```
2769
+
2770
+ ### Aggression Levels
2771
+
2772
+ **Aggressive (>70% HP)**:
2773
+ - Prioritizes offense over defense
2774
+ - Selects high-damage vital points (head, neck, chest)
2775
+ - Uses power stances (Geon, Li, Jin)
2776
+ - 80% attack frequency, 20% defense
2777
+
2778
+ **Balanced (30-70% HP)**:
2779
+ - Evaluates stance matchups before committing
2780
+ - Targets medium-risk vital points (limbs, torso)
2781
+ - Adapts stance based on opponent
2782
+ - 50% attack, 30% defense, 20% positioning
2783
+
2784
+ **Defensive (<30% HP)**:
2785
+ - Prioritizes survival and creating distance
2786
+ - Counter-attacks only with high success probability
2787
+ - Uses defensive stances (Gam, Son, Gon)
2788
+ - 20% attack, 60% defense, 20% evasion
2789
+
2790
+ ### Vital Point Selection Logic
2791
+
2792
+ AI calculates **Threat Score** for each available vital point:
2793
+
2794
+ ```
2795
+ Threat Score = (Base Damage × Archetype Bonus × Stance Synergy) / (Distance × Difficulty)
2796
+ ```
2797
+
2798
+ **Factors**:
2799
+ - **Base Damage**: Vital point's inherent damage value
2800
+ - **Archetype Bonus**: AI's archetype effectiveness multiplier
2801
+ - **Stance Synergy**: Current stance advantage vs target
2802
+ - **Distance**: Range to target (penalties for distant targets)
2803
+ - **Difficulty**: Anatomical precision requirement
2804
+
2805
+ AI selects highest Threat Score target that is within range and line-of-sight.
2806
+
2807
+ ### Stance Adaptation
2808
+
2809
+ AI changes stance when:
2810
+ 1. **Disadvantage Detected**: Current stance has <0.9x multiplier vs opponent
2811
+ 2. **Health Threshold**: Drops below 30% HP (switches to defensive stance)
2812
+ 3. **Tactical Reset**: After being hit 3+ times consecutively
2813
+ 4. **Opportunity**: Opponent vulnerable during stance transition
2814
+
2815
+ **Stance Selection Priority**:
2816
+ 1. Counter opponent's current stance (I Ching advantage)
2817
+ 2. Match archetype specialization (Musa → Geon, Amsalja → Gam)
2818
+ 3. Adapt to combat situation (Aggressive/Defensive mode)
2819
+
2820
+ ---
2821
+
2822
+ ## ⚡ Performance Optimization for 60fps (60fps 성능 최적화)
2823
+
2824
+ **Implementation Status**: Q1 2026 - Desktop 60fps achieved, Mobile 30fps target
2825
+
2826
+ Black Trigram maintains 60fps during intense combat through aggressive optimization across rendering, physics, and animation systems.
2827
+
2828
+ ### Rendering Optimizations
2829
+
2830
+ **Instanced Rendering**:
2831
+ - Particle effects (blood, sparks, impact) use GPU instancing
2832
+ - Reduces draw calls by 80% (500 → 100 per frame)
2833
+
2834
+ **Level of Detail (LOD)**:
2835
+ - 3 LOD levels for character models based on camera distance
2836
+ - High: <3m (28 bones, full detail)
2837
+ - Medium: 3-8m (14 bones, simplified)
2838
+ - Low: >8m (6 bones, billboard sprites)
2839
+
2840
+ **Frustum Culling**:
2841
+ - Objects outside camera view not rendered
2842
+ - Spatial hash grid for O(1) visibility queries
2843
+ - Saves 30-40% rendering cost in large arenas
2844
+
2845
+ **Occlusion Culling**:
2846
+ - Objects behind solid geometry culled
2847
+ - Portal system for indoor environments
2848
+ - Reduces overdraw by 50%
2849
+
2850
+ ### Physics Optimizations
2851
+
2852
+ **Fixed Timestep**:
2853
+ - Physics updates at consistent 60Hz
2854
+ - Decoupled from variable frame rate
2855
+ - Prevents physics instability
2856
+
2857
+ **Spatial Hashing**:
2858
+ - Combat arena divided into 1m grid cells
2859
+ - Collision detection only checks nearby cells
2860
+ - Reduces collision checks from O(n²) to O(n)
2861
+
2862
+ **Collision Narrowing**:
2863
+ - Broad phase: AABB bounding boxes
2864
+ - Narrow phase: Precise skeletal collision only for potential hits
2865
+ - 95% of checks eliminated in broad phase
2866
+
2867
+ **Sleep States**:
2868
+ - Idle fighters enter sleep state (no physics updates)
2869
+ - Wake on proximity or impact
2870
+ - Saves 60% physics CPU for spectators
2871
+
2872
+ ### Animation Optimizations
2873
+
2874
+ **Bone Culling**:
2875
+ - Invisible bones (occluded or off-screen) not updated
2876
+ - Hand bones culled when >10m from camera
2877
+ - Reduces animation CPU by 40%
2878
+
2879
+ **Keyframe Interpolation**:
2880
+ - Linear interpolation for most bones
2881
+ - Cubic interpolation only for visible extremities (hands, head)
2882
+ - 50% faster animation updates
2883
+
2884
+ **Blend Tree Caching**:
2885
+ - Animation blend results cached for 2 frames
2886
+ - Cache hit rate >80% for repetitive movements
2887
+ - Eliminates redundant blend calculations
2888
+
2889
+ **Pose Reuse**:
2890
+ - Common stance poses precomputed and cached
2891
+ - Transitions interpolate between cached poses
2892
+ - 70% reduction in skeletal calculations
2893
+
2894
+ ### Achieved Metrics
2895
+
2896
+ **Desktop (RTX 3060, Ryzen 5 5600X)**:
2897
+ - **Average FPS**: 62 fps (consistent 60+ during combat)
2898
+ - **Frame Time**: 16ms (with 2ms headroom)
2899
+ - **Rendering**: 10ms (62% of budget)
2900
+ - **Physics**: 4ms (25% of budget)
2901
+ - **Logic**: 2ms (13% of budget)
2902
+
2903
+ **Mobile (Snapdragon 888, 6GB RAM)**:
2904
+ - **Average FPS**: 32 fps (target 30fps maintained)
2905
+ - **Frame Time**: 33ms
2906
+ - **Rendering**: 22ms (LOD aggressive, particles reduced)
2907
+ - **Physics**: 8ms (simpler collision)
2908
+ - **Logic**: 3ms
2909
+
2910
+ ### Profiling Tools
2911
+
2912
+ **Built-in Profiler**:
2913
+ - F12 toggle in development builds
2914
+ - Real-time frame time graph
2915
+ - CPU/GPU breakdown by system
2916
+
2917
+ **Bottleneck Detection**:
2918
+ - Automatic alerts when system exceeds 60% budget
2919
+ - Highlights expensive operations
2920
+ - Suggests optimization strategies
2921
+
2922
+ ---
2923
+
2924
+ ## ⚖️ Balance Considerations (밸런스 고려사항)
2925
+
2926
+ **Implementation Status**: Q1 2026 - Core balance established, ongoing tuning
2927
+
2928
+ ### Design Philosophy
2929
+
2930
+ **Authentic vs. Fun**:
2931
+ - Authentic Korean martial arts principles (70% weight)
2932
+ - Fun, competitive gameplay (30% weight)
2933
+ - No vital point is "auto-win" - all have counterplay
2934
+
2935
+ **Rock-Paper-Scissors**:
2936
+ - 8 Trigram stances have circular advantages (I Ching)
2937
+ - 5 Archetypes have situational strengths
2938
+ - No single dominant strategy
2939
+
2940
+ **Skill Expression**:
2941
+ - High-skill players rewarded with precision targeting
2942
+ - Low-skill players can compete with fundamentals
2943
+ - Skill ceiling is very high (professional esports potential)
2944
+
2945
+ ### Tuning Parameters
2946
+
2947
+ **Damage Scaling**:
2948
+ - Base vital point damage: 16-60 HP
2949
+ - Multipliers keep range reasonable (15-400 HP final)
2950
+ - Average combat duration: 30-60 seconds
2951
+ - 3-5 successful vital point hits = knockout
2952
+
2953
+ **Cooldowns**:
2954
+ - Basic techniques: 0.8-1.5s cooldown
2955
+ - Advanced techniques: 2-4s cooldown
2956
+ - Ultimate techniques: 8-12s cooldown + resource cost
2957
+
2958
+ **Stamina Costs**:
2959
+ - Light attacks: 10-15 stamina
2960
+ - Medium attacks: 20-30 stamina
2961
+ - Heavy attacks: 35-50 stamina
2962
+ - Stamina regen: 25/sec (full bar = 200 stamina)
2963
+ - Empty stamina = vulnerable state (3s recovery)
2964
+
2965
+ ### Archetype Balance
2966
+
2967
+ **Target Win Rates** (1v1, equal skill):
2968
+ - All archetypes: 48-52% win rate
2969
+ - No archetype hard-counters another
2970
+ - Matchup variance ≤8% difference
2971
+
2972
+ **Current Status**:
2973
+ - Musa: 51% (slightly overtuned)
2974
+ - Amsalja: 50% (balanced)
2975
+ - Hacker: 47% (needs +3% damage buff)
2976
+ - Jeongbo: 52% (slightly overtuned)
2977
+ - Jojik: 50% (balanced)
2978
+
2979
+ ### Vital Point Balance
2980
+
2981
+ **High-Damage Points Have Counterplay**:
2982
+ - **백회혈 (Crown)** - 45 damage, but requires overhead position
2983
+ - **인영 (Carotid)** - 50 damage, but small target (92% accuracy needed)
2984
+ - **대퇴동맥 (Femoral)** - 60 damage, but low stance required, long recovery
2985
+
2986
+ **Accessibility**:
2987
+ - 30% vital points: Easy to hit (torso, limbs)
2988
+ - 50% vital points: Medium difficulty (joints, neck)
2989
+ - 20% vital points: Hard to hit (eyes, acupoints)
2990
+
2991
+ ### Playtesting Guidelines
2992
+
2993
+ **Balance Testing Protocol**:
2994
+ 1. **100-Match Samples**: Gather win rates over 100 1v1 matches per matchup
2995
+ 2. **Skill Brackets**: Test at Low/Medium/High/Pro skill levels
2996
+ 3. **Stance Distribution**: Ensure all 8 stances see >10% usage
2997
+ 4. **Vital Point Heat Maps**: Identify over-used or under-used targets
2998
+ 5. **Time-to-Kill Analysis**: Average combat duration 30-60s
2999
+
3000
+ **Red Flags**:
3001
+ - ❌ Any archetype >55% or <45% win rate
3002
+ - ❌ Any stance >60% or <5% usage rate
3003
+ - ❌ Any vital point >30% of all hits
3004
+ - ❌ Average TTK <20s or >90s
3005
+ - ❌ "One-shot" combos dealing >200 damage
3006
+
3007
+ **Iteration Process**:
3008
+ 1. Identify imbalance through data
3009
+ 2. Propose tuning changes (±5% increments)
3010
+ 3. Test changes with focus group (20 players)
3011
+ 4. Deploy to public test realm (PTR)
3012
+ 5. Monitor for 2 weeks, gather feedback
3013
+ 6. Implement final changes in production
3014
+
3015
+ ---
3016
+
3017
+ ## 🚀 Implementation Priority Matrix
3018
+
3019
+ ### Phase 1: Core Combat Foundation (Current Priority)
3020
+
3021
+ 1. **CombatSystemController** - Central orchestration logic
3022
+ 2. **StanceManager** - Trigram stance transitions and validation
3023
+ 3. **KoreanVitalPoints** - 70 authentic vital points database
3024
+ 4. **DamageCalculator** - Realistic anatomical damage calculation
3025
+
3026
+ ### Phase 2: Trigram System (High Priority)
3027
+
3028
+ 1. **TrigramCalculator** - I Ching effectiveness relationships
3029
+ 2. **TransitionCalculator** - Ki/Stamina cost calculation
3030
+ 3. **KoreanTechniques** - Authentic technique implementations
3031
+ 4. **KoreanCulture** - Philosophy integration
3032
+
3033
+ ### Phase 3: Advanced Features (Medium Priority)
3034
+
3035
+ 1. **HitDetection** - Precise anatomical collision detection
3036
+ 2. **AnatomicalRegions** - Body region mapping system
3037
+ 3. **Enhanced Audio** - Korean traditional instrument integration
3038
+ 4. **Combat Analytics** - Performance and effectiveness tracking
3039
+
3040
+ ### Phase 4: Combat Enhancements (Complete ✅)
3041
+
3042
+ 1. **GrappleSystem** ✅ - Hapkido/Ssireum grappling mechanics (95% complete, 34 tests)
3043
+ 2. **LimbExposureSystem** ✅ - Vulnerability windows and counter-attacks (100% complete, 132 tests)
3044
+ 3. **AI Counter-Attack Integration** ✅ - Defensive AI exploits exposed limbs (18 tests)
3045
+ 4. **Visual Indicators** ✅ - 3D glow effects and timing HUD (49 tests)
3046
+ 5. **Grappling Animations** ✅ - 4 animation states with audio hooks (34 tests)
3047
+
3048
+ ---
3049
+
3050
+ ## 🤜 Grappling System (잡기 체계)
3051
+
3052
+ **Status**: ✅ 95% Complete | **Implementation**: `src/systems/combat/GrappleSystem.ts` | **Tests**: 34 passing
3053
+
3054
+ ### Overview
3055
+
3056
+ The Grappling System implements authentic Korean martial arts grappling techniques from **Hapkido (합기도)** and traditional Korean wrestling **Ssireum (씨름)**. It features realistic grip decay mechanics, escape difficulty calculations, and stance-based advantages.
3057
+
3058
+ ### Core Components
3059
+
3060
+ **Grip Mechanics**:
3061
+ - **Initial Grip Strength**: 100% at grapple initiation
3062
+ - **Decay Rate**: -5% to -15% per second based on stamina
3063
+ - **Minimum Threshold**: Grapple automatically breaks at <30% grip strength
3064
+ - **Refresh**: Successful resistance checks can restore +10% grip
3065
+
3066
+ **Escape System**:
3067
+ - **Base Difficulty**: 60% escape chance at full stamina
3068
+ - **Stamina Impact**: -10% success per 20% stamina lost
3069
+ - **Stance Modifiers**:
3070
+ - **GON (☷ Earth)**: +30% grip strength, +15% grapple success, +30% escape (grounded wrestling expertise)
3071
+ - **GAN (☶ Mountain)**: +15% grip strength, +15% escape (immovable defensive stance)
3072
+ - **Other Stances**: Standard grapple mechanics
3073
+
3074
+ **State Transitions**:
3075
+ ```
3076
+ IDLE → GRAPPLING (controlling opponent)
3077
+ IDLE → GRAPPLED (being controlled)
3078
+ GRAPPLING → IDLE (release or break)
3079
+ GRAPPLED → IDLE (successful escape)
3080
+ ```
3081
+
3082
+ **Movement Penalties**:
3083
+ - **GRAPPLING**: -80% movement speed (20% remaining)
3084
+ - **GRAPPLED**: -100% movement speed (cannot move)
3085
+
3086
+ ### Animation States (4 Total)
3087
+
3088
+ | State | Duration | Frames @ 60fps | Description |
3089
+ |-------|----------|----------------|-------------|
3090
+ | **GRAPPLE_ENTRY** | 133ms | 8 frames | Initial grab connection |
3091
+ | **GRAPPLE_CONTROL** | 167ms | 10 frames | Maintaining grip (loops) |
3092
+ | **GRAPPLE_STRUGGLE** | 200ms | 12 frames | Escape attempts |
3093
+ | **GRAPPLE_ESCAPE** | 250ms | 15 frames | Successful release |
3094
+
3095
+ ### Visual Feedback
3096
+
3097
+ **GrapplingIndicator3D Component** (`src/components/shared/three/effects/GrapplingIndicator3D.tsx`):
3098
+ - **Particle System**: 20-50 particles showing struggle intensity
3099
+ - **Grip Strength Meter**: HTML overlay with bilingual labels (잡기 힘 / Grip Strength)
3100
+ - **Color Coding**: Blue (controlling) vs Red (being controlled)
3101
+ - **Mobile Optimization**: 60% particle reduction for 55fps+ performance
3102
+
3103
+ ### Audio Integration
3104
+
3105
+ **useGrapplingAudio Hook** (`src/components/screens/combat/hooks/useGrapplingAudio.ts`):
3106
+ - **6 Audio Functions**: Connect, struggle, escape, break, counter, warning
3107
+ - **Rate Limiting**: 100-300ms cooldowns between sounds
3108
+ - **Volume Modifiers**: Hand (0.8x), Arm (1.1x), Both Arms (1.3x), Full Control (1.3x)
3109
+ - **Placeholder Mapping**: Uses existing combat audio until custom grappling sounds are created
3110
+
3111
+ ### Implementation Details
3112
+
3113
+ ```typescript
3114
+ // Core grapple mechanics (simplified)
3115
+ interface GrappleState {
3116
+ isGrappling: boolean;
3117
+ gripStrength: number; // 0-100%
3118
+ escapeAttempts: number;
3119
+ duration: number; // ms
3120
+ }
3121
+
3122
+ // Grip decay calculation
3123
+ const gripDecay = baseDecayRate * (1 + staminaPenalty) * stanceModifier;
3124
+
3125
+ // Escape success probability
3126
+ const escapeChance = baseChance * (stamina / 100) * stanceBonus;
3127
+ ```
3128
+
3129
+ ### Usage in Combat
3130
+
3131
+ The GrappleSystem is integrated into `CombatSystem.ts`:
3132
+ - `resolveAttack()` handles GRAPPLE type attacks
3133
+ - `handleGrappleTechnique()` initiates grapple control
3134
+ - `updateGrappleState()` maintains control over time (called each frame)
3135
+ - Automatic release on escape or grip strength < 30%
3136
+
3137
+ ---
3138
+
3139
+ ## ⚡ Limb Exposure & Counter-Attack System (사지 노출 및 반격 체계)
3140
+
3141
+ **Status**: ✅ 100% Complete | **Implementation**: `src/systems/combat/LimbExposureSystem.ts` | **Tests**: 132 passing
3142
+
3143
+ ### Overview
3144
+
3145
+ The Limb Exposure System implements Korean martial arts principles of **허점공격 (Heojeom Gonggyeok - attacking openings)** and **후수필승 (Husu Pilseung - victory through counter-timing)**. It detects when attackers expose vulnerable limbs during technique execution, creating counter-attack opportunities with damage multipliers.
3146
+
3147
+ ### Core Concepts
3148
+
3149
+ **Vulnerability Windows**:
3150
+ - **Wind-up Phase** (0-50% of execution): Low vulnerability (1.1x damage multiplier)
3151
+ - **Peak Phase** (50-70% of execution): Maximum vulnerability (2.0x damage multiplier)
3152
+ - **Recovery Phase** (70-100% of execution): Medium vulnerability (1.5x damage multiplier)
3153
+ - **Window Duration**: 300-400ms typical exposure time
3154
+
3155
+ **Exposed Limb Types**: 12 total (left/right × 6 body parts)
3156
+ - `right_arm`, `left_arm`, `right_elbow`, `left_elbow`, `right_wrist`, `left_wrist`
3157
+ - `right_leg`, `left_leg`, `right_knee`, `left_knee`, `right_ankle`, `left_ankle`
3158
+
3159
+ **Breaking Techniques**:
3160
+ - **Target Joints**: Ankle, knee, elbow, wrist
3161
+ - **Severity Calculation**: Based on force (40-80 damage) → 0.0-1.0 severity
3162
+ - **Status Effects**: Broken limbs receive injury status (BROKEN_ANKLE, BROKEN_KNEE, etc.)
3163
+ - **Movement Impact**: Broken legs reduce movement speed, broken arms reduce attack damage
3164
+
3165
+ ### AI Integration
3166
+
3167
+ **DecisionTree Integration** (`src/systems/ai/DecisionTree.ts`):
3168
+ - **Priority Level 2**: Counter-attack evaluation (after survival, before standard attacks)
3169
+ - **Archetype Priorities**:
3170
+ - **Musa (무사)**: Priority 10.5-11.1 (high defensiveness, honor through counters)
3171
+ - **Amsalja (암살자)**: Priority 10.5-11.1 (tactical exploitation of weakness)
3172
+ - **Jeongbo (정보요원)**: Priority 13.0 (intelligence operative, analytical counters)
3173
+ - **Jojik/Hacker**: Priority 9.6-10.8 (offensive-focused, lower counter priority)
3174
+ - **Bonus Modifiers**:
3175
+ - Breaking opportunities: +2 priority
3176
+ - High vulnerability (>2.0x): +1 priority
3177
+
3178
+ **Counter Selection Logic**:
3179
+ ```typescript
3180
+ // AI evaluates counter opportunities each decision frame
3181
+ const opportunity = calculateCounterOpportunity(opponentTechnique, elapsedTime);
3182
+
3183
+ if (opportunity && opportunity.confidence > 0.7) {
3184
+ const priority = baseCounterPriority + (defensiveness * 1.5) +
3185
+ (opportunity.allowsBreaking ? 2 : 0) +
3186
+ (opportunity.vulnerabilityMultiplier > 2.0 ? 1 : 0);
3187
+
3188
+ if (priority >= decisionThreshold) {
3189
+ selectCounterTechnique(opportunity.exposedLimb);
3190
+ }
3191
+ }
3192
+ ```
3193
+
3194
+ ### Visual Indicators
3195
+
3196
+ **LimbExposureIndicator3D** (`src/components/shared/three/effects/LimbExposureIndicator3D.tsx`):
3197
+ - **3D Glow Effect**: Three.js `pointLight` attached to exposed limb position
3198
+ - **Intensity Scaling**: 1.0-3.0 based on vulnerability multiplier
3199
+ - **Color Coding**:
3200
+ - Gold (`#ffaa00`): Low vulnerability (<1.5x)
3201
+ - Orange (`#ff6600`): Medium vulnerability (1.5-2.0x)
3202
+ - Red (`#ff0000`): High vulnerability / Breaking opportunity (≥2.0x)
3203
+ - **Fade Animation**: Smooth fade in/out during 300-400ms exposure window
3204
+ - **Performance**: <0.5ms overhead per frame, 60fps maintained
3205
+
3206
+ **VulnerabilityWindowHUD** (`src/components/shared/three/ui/VulnerabilityWindowHUD.tsx`):
3207
+ - **Circular Timer**: Progress ring showing remaining opportunity time
3208
+ - **Bilingual Labels**: "반격 기회" (Korean) / "Counter Opportunity" (English)
3209
+ - **Urgency Colors**:
3210
+ - Early (0-50%): Gold (plenty of time)
3211
+ - Mid (50-75%): Orange (closing window)
3212
+ - Late (75-100%): Red (last moment)
3213
+ - **Mobile Layout**: Compact design, 70% scale on mobile devices
3214
+
3215
+ ### Type Extensions
3216
+
3217
+ **PlayerState Extended**:
3218
+ ```typescript
3219
+ interface PlayerState {
3220
+ // ... existing fields
3221
+ currentTechnique?: KoreanTechnique; // Technique being executed
3222
+ techniqueElapsedTime?: number; // Time elapsed in technique (ms)
3223
+ }
3224
+ ```
3225
+
3226
+ **CombatContext Extended**:
3227
+ ```typescript
3228
+ interface CombatContext {
3229
+ // ... existing fields
3230
+ opponentTechnique?: KoreanTechnique;
3231
+ opponentTechniqueTime?: number;
3232
+ counterOpportunity?: CounterOpportunity;
3233
+ opponentVulnerability: number; // 1.0-2.5x multiplier
3234
+ }
3235
+ ```
3236
+
3237
+ ### Implementation Example
3238
+
3239
+ ```typescript
3240
+ // Detect limb exposure during attack
3241
+ const opportunity = calculateCounterOpportunity(
3242
+ opponentTechnique,
3243
+ elapsedTime // 450ms into 800ms technique
3244
+ );
3245
+
3246
+ if (opportunity) {
3247
+ console.log(opportunity);
3248
+ // {
3249
+ // exposedLimb: "right_leg",
3250
+ // vulnerabilityMultiplier: 2.0,
3251
+ // allowsBreaking: true,
3252
+ // recommendedCounters: ["ankle_stomp", "knee_kick"],
3253
+ // remainingWindow: 350, // ms
3254
+ // confidence: 0.85
3255
+ // }
3256
+ }
3257
+ ```
3258
+
3259
+ ### Test Coverage
3260
+
3261
+ - **36 tests**: LimbExposureSystem core functions
3262
+ - **14 tests**: Full attack-counter integration flow
3263
+ - **15 tests**: BreakingStatusEffects validation
3264
+ - **18 tests**: AI DecisionTree counter-attack integration
3265
+ - **19 tests**: LimbExposureIndicator3D visual component
3266
+ - **30 tests**: VulnerabilityWindowHUD UI component
3267
+ - **Total: 132/132 tests passing (100%)** ✅
3268
+
3269
+ ### Korean Martial Arts Philosophy
3270
+
3271
+ The system embodies traditional principles:
3272
+ - **허점공격** (Heojeom Gonggyeok): Attacking openings/weaknesses
3273
+ - **후수필승** (Husu Pilseung): Victory through counter-attack timing
3274
+ - **이순응변** (Isun Eungbyeon): Adapt and exploit opponent's mistakes
3275
+ - **파쇄기** (Paswaegi): Breaking techniques for overextended attacks
3276
+
3277
+ ---
3278
+
3279
+ ## 💡 Technical Specifications
3280
+
3281
+ ### Performance Requirements:
3282
+
3283
+ - **Target FPS**: 60 FPS during intense combat
3284
+ - **Memory Usage**: < 512MB for full combat simulation
3285
+ - **Audio Latency**: < 100ms for responsive feedback
3286
+ - **Input Lag**: < 16ms for precise control
3287
+
3288
+ ### Cultural Authenticity Standards:
3289
+
3290
+ - **Korean Terminology**: Bilingual Korean-English throughout
3291
+ - **Martial Arts Accuracy**: Traditional techniques with proper names
3292
+ - **Philosophy Integration**: I Ching principles in combat mechanics
3293
+ - **Respectful Representation**: Honor Korean martial arts heritage
3294
+
3295
+ ### Combat Realism Targets:
3296
+
3297
+ - **Anatomical Accuracy**: 70 precise vital points
3298
+ - **Damage Calculation**: Physics-based trauma simulation
3299
+ - **Status Effects**: Pain, consciousness, balance, blood loss
3300
+ - **Recovery Systems**: Realistic healing and regeneration
3301
+
3302
+ ---
3303
+
3304
+ ## 🎯 Success Metrics
3305
+
3306
+ ```mermaid
3307
+ graph LR
3308
+ subgraph "Combat Effectiveness Metrics"
3309
+ ACC[정확도 Accuracy<br/>85%+ hit detection]:::metric
3310
+ REA[사실성 Realism<br/>Authentic damage calc]:::metric
3311
+ CUL[문화성 Culture<br/>100% Korean terms]:::metric
3312
+ PER[성능 Performance<br/>60 FPS target]:::metric
3313
+ end
3314
+
3315
+ classDef metric fill:#00ff00,stroke:#333,color:#000,stroke-width:2px
3316
+ ```
3317
+
3318
+ **흑괘의 길을 걸어라** - _Walk the Path of the Black Trigram_
3319
+
3320
+ ---
3321
+
3322
+ _This architecture document reflects the current implementation state of Black Trigram's combat system as of the latest codebase analysis. All empty system files represent planned implementations following authentic Korean martial arts principles._