blacktrigram 0.7.47 → 0.7.49

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 (471) hide show
  1. package/lib/App2.js.map +1 -1
  2. package/lib/audio/AudioAssetLoader.js.map +1 -1
  3. package/lib/audio/AudioAssetRegistry.js.map +1 -1
  4. package/lib/audio/AudioCache.js.map +1 -1
  5. package/lib/audio/AudioManager.js.map +1 -1
  6. package/lib/audio/AudioMonitor.js.map +1 -1
  7. package/lib/audio/AudioPool.js.map +1 -1
  8. package/lib/audio/AudioProvider.js.map +1 -1
  9. package/lib/audio/AudioUtils.js.map +1 -1
  10. package/lib/audio/BoneImpactAudioMap.js.map +1 -1
  11. package/lib/audio/VariantSelector.js.map +1 -1
  12. package/lib/audio/types.js.map +1 -1
  13. package/lib/components/screens/combat/CombatScreen3D.d.ts.map +1 -1
  14. package/lib/components/screens/combat/CombatScreen3D.js +29 -25
  15. package/lib/components/screens/combat/CombatScreen3D.js.map +1 -1
  16. package/lib/components/screens/combat/components/controls/CombatButtons.js.map +1 -1
  17. package/lib/components/screens/combat/components/controls/CombatControlsPanel.js.map +1 -1
  18. package/lib/components/screens/combat/components/controls/ControlsGuide.js.map +1 -1
  19. package/lib/components/screens/combat/components/controls/KeyboardHints.js.map +1 -1
  20. package/lib/components/screens/combat/components/controls/PauseMenu.js.map +1 -1
  21. package/lib/components/screens/combat/components/controls/PauseMenuButton.js.map +1 -1
  22. package/lib/components/screens/combat/components/controls/QuickSettings.js.map +1 -1
  23. package/lib/components/screens/combat/components/effects/BloodDecals3D.js.map +1 -1
  24. package/lib/components/screens/combat/components/effects/BloodLossOverlayHtml.js.map +1 -1
  25. package/lib/components/screens/combat/components/effects/BloodParticles3D.js.map +1 -1
  26. package/lib/components/screens/combat/components/effects/BloodViscosity3D.js.map +1 -1
  27. package/lib/components/screens/combat/components/effects/CombatParticleEffects3D.js.map +1 -1
  28. package/lib/components/screens/combat/components/effects/ConsciousnessBlur.js.map +1 -1
  29. package/lib/components/screens/combat/components/effects/InternalDamage3D.js.map +1 -1
  30. package/lib/components/screens/combat/components/effects/PainVignette.js.map +1 -1
  31. package/lib/components/screens/combat/components/effects/ParticleAudio3D.js.map +1 -1
  32. package/lib/components/screens/combat/components/effects/TraumaOverlay3D.js.map +1 -1
  33. package/lib/components/screens/combat/components/feedback/MatchCountdown.js.map +1 -1
  34. package/lib/components/screens/combat/components/feedback/RoundAnnouncementOverlayHtml.js.map +1 -1
  35. package/lib/components/screens/combat/components/feedback/RoundDisplayStatus.js.map +1 -1
  36. package/lib/components/screens/combat/components/feedback/RoundStartAnnouncementOverlayHtml.js.map +1 -1
  37. package/lib/components/screens/combat/components/hud/CombatBottomHUD.d.ts.map +1 -1
  38. package/lib/components/screens/combat/components/hud/CombatBottomHUD.js +2 -2
  39. package/lib/components/screens/combat/components/hud/CombatBottomHUD.js.map +1 -1
  40. package/lib/components/screens/combat/components/hud/CombatLeftHUD.js.map +1 -1
  41. package/lib/components/screens/combat/components/hud/CombatPortraitStatusStrip.js +1 -1
  42. package/lib/components/screens/combat/components/hud/CombatPortraitStatusStrip.js.map +1 -1
  43. package/lib/components/screens/combat/components/hud/CombatRightHUD.js.map +1 -1
  44. package/lib/components/screens/combat/components/hud/CombatTopHUD.d.ts.map +1 -1
  45. package/lib/components/screens/combat/components/hud/CombatTopHUD.js +2 -1
  46. package/lib/components/screens/combat/components/hud/CombatTopHUD.js.map +1 -1
  47. package/lib/components/screens/combat/components/hud/DifficultyIndicator.js.map +1 -1
  48. package/lib/components/screens/combat/components/hud/FPSMonitor.js.map +1 -1
  49. package/lib/components/screens/combat/components/hud/MobileControlsWrapper.js.map +1 -1
  50. package/lib/components/screens/combat/components/hud/PlayerStateOverlayHtml.js.map +1 -1
  51. package/lib/components/screens/combat/components/indicators/BalanceIndicator.js.map +1 -1
  52. package/lib/components/screens/combat/components/indicators/InputBufferDisplay.js.map +1 -1
  53. package/lib/components/screens/combat/components/indicators/StaminaWarning.js.map +1 -1
  54. package/lib/components/screens/combat/components/indicators/TechniqueNameDisplay.js.map +1 -1
  55. package/lib/components/screens/combat/helpers/AnimationUpdater.d.ts.map +1 -1
  56. package/lib/components/screens/combat/helpers/AnimationUpdater.js +4 -2
  57. package/lib/components/screens/combat/helpers/AnimationUpdater.js.map +1 -1
  58. package/lib/components/screens/combat/helpers/combatHelpers.js.map +1 -1
  59. package/lib/components/screens/combat/hooks/useAICombat.js.map +1 -1
  60. package/lib/components/screens/combat/hooks/useCombatActions.js.map +1 -1
  61. package/lib/components/screens/combat/hooks/useCombatAttackMovement.js.map +1 -1
  62. package/lib/components/screens/combat/hooks/useCombatAudio.js.map +1 -1
  63. package/lib/components/screens/combat/hooks/useCombatLayout.d.ts.map +1 -1
  64. package/lib/components/screens/combat/hooks/useCombatLayout.js +11 -5
  65. package/lib/components/screens/combat/hooks/useCombatLayout.js.map +1 -1
  66. package/lib/components/screens/combat/hooks/useCombatState.js.map +1 -1
  67. package/lib/components/screens/controls/ControlsScreen3D.js +1 -1
  68. package/lib/components/screens/controls/ControlsScreen3D.js.map +1 -1
  69. package/lib/components/screens/controls/components/ControlBindingsOverlayHtml.js.map +1 -1
  70. package/lib/components/screens/controls/components/ControlCategoryTabsOverlayHtml.js.map +1 -1
  71. package/lib/components/screens/controls/components/GamepadVisualization3D.js.map +1 -1
  72. package/lib/components/screens/controls/components/InteractiveControlDemoOverlayHtml.js.map +1 -1
  73. package/lib/components/screens/controls/components/Key3D.js.map +1 -1
  74. package/lib/components/screens/controls/components/VisualKeyboard3D.js.map +1 -1
  75. package/lib/components/screens/controls/constants/ControlsConstants.js.map +1 -1
  76. package/lib/components/screens/controls/hooks/useControlsState.js.map +1 -1
  77. package/lib/components/screens/endscreen/EndScreen3D.js.map +1 -1
  78. package/lib/components/screens/endscreen/components/DefeatAnimation3D.js.map +1 -1
  79. package/lib/components/screens/endscreen/components/MatchStatisticsDisplayOverlayHtml.js.map +1 -1
  80. package/lib/components/screens/endscreen/components/NavigationButtonsOverlayHtml.js.map +1 -1
  81. package/lib/components/screens/endscreen/components/PerformanceBreakdownOverlayHtml.js.map +1 -1
  82. package/lib/components/screens/endscreen/components/PerformanceRatingOverlayHtml.js.map +1 -1
  83. package/lib/components/screens/endscreen/components/VictoryAnimation3D.js.map +1 -1
  84. package/lib/components/screens/endscreen/components/WinnerDisplayOverlayHtml.js.map +1 -1
  85. package/lib/components/screens/intro/IntroScreen3D.js +1 -1
  86. package/lib/components/screens/intro/IntroScreen3D.js.map +1 -1
  87. package/lib/components/screens/intro/components/AbilityListOverlayHtml.js.map +1 -1
  88. package/lib/components/screens/intro/components/ArchetypeCardGridOverlayHtml.js.map +1 -1
  89. package/lib/components/screens/intro/components/ArchetypeCardOverlayHtml.js.map +1 -1
  90. package/lib/components/screens/intro/components/ArchetypeDisplayOverlayHtml.js.map +1 -1
  91. package/lib/components/screens/intro/components/EnhancedArchetypeDisplayOverlayHtml.js.map +1 -1
  92. package/lib/components/screens/intro/components/MenuButtonsOverlayHtml.js.map +1 -1
  93. package/lib/components/screens/intro/components/MenuSectionOverlayHtml.js.map +1 -1
  94. package/lib/components/screens/intro/components/StatBarOverlayHtml.js.map +1 -1
  95. package/lib/components/screens/philosophy/PhilosophyScreen3D.js +1 -1
  96. package/lib/components/screens/philosophy/PhilosophyScreen3D.js.map +1 -1
  97. package/lib/components/screens/training/TrainingScreen3D.d.ts.map +1 -1
  98. package/lib/components/screens/training/TrainingScreen3D.js +3 -11
  99. package/lib/components/screens/training/TrainingScreen3D.js.map +1 -1
  100. package/lib/components/screens/training/components/AnatomyControlsOverlayHtml.js.map +1 -1
  101. package/lib/components/screens/training/components/AnatomyOverlay3D.js.map +1 -1
  102. package/lib/components/screens/training/components/FootPlacementMarkers3D.js.map +1 -1
  103. package/lib/components/screens/training/components/FootworkDrillsOverlayHtml.js.map +1 -1
  104. package/lib/components/screens/training/components/HitFeedbackEffect3D.js.map +1 -1
  105. package/lib/components/screens/training/components/TrainingButtonsOverlayHtml.js.map +1 -1
  106. package/lib/components/screens/training/components/TrainingControlsOverlayHtml.js.map +1 -1
  107. package/lib/components/screens/training/components/TrainingDummy3D.js.map +1 -1
  108. package/lib/components/screens/training/components/TrainingFeedbackOverlayHtml.js.map +1 -1
  109. package/lib/components/screens/training/components/TrainingModeSelectorOverlayHtml.js.map +1 -1
  110. package/lib/components/screens/training/components/TrainingStatsOverlayHtml.js.map +1 -1
  111. package/lib/components/screens/training/components/VitalPointMarker3D.js.map +1 -1
  112. package/lib/components/screens/training/components/VitalPointTrainingOverlayHtml.js.map +1 -1
  113. package/lib/components/screens/training/components/hud/TrainingBottomHUD.d.ts.map +1 -1
  114. package/lib/components/screens/training/components/hud/TrainingBottomHUD.js +2 -2
  115. package/lib/components/screens/training/components/hud/TrainingBottomHUD.js.map +1 -1
  116. package/lib/components/screens/training/components/hud/TrainingLeftHUD.js.map +1 -1
  117. package/lib/components/screens/training/components/hud/TrainingRightHUD.js.map +1 -1
  118. package/lib/components/screens/training/components/hud/TrainingTopHUD.js.map +1 -1
  119. package/lib/components/screens/training/hooks/useAttackMovement.js.map +1 -1
  120. package/lib/components/screens/training/hooks/useTrainingActions.d.ts +1 -0
  121. package/lib/components/screens/training/hooks/useTrainingActions.d.ts.map +1 -1
  122. package/lib/components/screens/training/hooks/useTrainingActions.js +6 -4
  123. package/lib/components/screens/training/hooks/useTrainingActions.js.map +1 -1
  124. package/lib/components/screens/training/hooks/useTrainingLayout.d.ts.map +1 -1
  125. package/lib/components/screens/training/hooks/useTrainingLayout.js +11 -5
  126. package/lib/components/screens/training/hooks/useTrainingLayout.js.map +1 -1
  127. package/lib/components/screens/training/hooks/useTrainingState.js.map +1 -1
  128. package/lib/components/shared/base/BaseButton.js.map +1 -1
  129. package/lib/components/shared/base/BaseButtonOverlayHtml.js.map +1 -1
  130. package/lib/components/shared/base/BasePanel.js.map +1 -1
  131. package/lib/components/shared/base/BaseText.js.map +1 -1
  132. package/lib/components/shared/base/useKoreanTheme.js.map +1 -1
  133. package/lib/components/shared/debug/PerformanceDebugOverlayHtml.js.map +1 -1
  134. package/lib/components/shared/mobile/ActionButtons.js.map +1 -1
  135. package/lib/components/shared/mobile/GestureRecognizerPure.js.map +1 -1
  136. package/lib/components/shared/mobile/HapticController.js.map +1 -1
  137. package/lib/components/shared/mobile/MobileControlsPure.js.map +1 -1
  138. package/lib/components/shared/mobile/StanceWheelPure.js.map +1 -1
  139. package/lib/components/shared/mobile/TouchOptimizer.js.map +1 -1
  140. package/lib/components/shared/mobile/VirtualDPad.js.map +1 -1
  141. package/lib/components/shared/three/anatomy/BodySurface.js.map +1 -1
  142. package/lib/components/shared/three/anatomy/BoneAttachedMuscles.js.map +1 -1
  143. package/lib/components/shared/three/anatomy/BoneClothing.js.map +1 -1
  144. package/lib/components/shared/three/anatomy/BoneRenderer.js.map +1 -1
  145. package/lib/components/shared/three/anatomy/Face3D.js.map +1 -1
  146. package/lib/components/shared/three/anatomy/Foot3D.js.map +1 -1
  147. package/lib/components/shared/three/anatomy/Hand3D.js.map +1 -1
  148. package/lib/components/shared/three/effects/ActionFeedback.js.map +1 -1
  149. package/lib/components/shared/three/effects/DamageNumbers.js.map +1 -1
  150. package/lib/components/shared/three/effects/HitEffects3D.js.map +1 -1
  151. package/lib/components/shared/three/effects/PlayerStateIndicators.js.map +1 -1
  152. package/lib/components/shared/three/effects/StanceSymbol3D.js.map +1 -1
  153. package/lib/components/shared/three/effects/StanceTransitionEffect.js.map +1 -1
  154. package/lib/components/shared/three/effects/VitalPointMarkers3D.js.map +1 -1
  155. package/lib/components/shared/three/indicators/ElementalColorSystem.js.map +1 -1
  156. package/lib/components/shared/three/indicators/GuardIndicator.js.map +1 -1
  157. package/lib/components/shared/three/indicators/HapticFeedback.js.map +1 -1
  158. package/lib/components/shared/three/indicators/StanceChangeIndicator.js.map +1 -1
  159. package/lib/components/shared/three/models/Player3DWithTransitions.js.map +1 -1
  160. package/lib/components/shared/three/models/SkeletalPlayer3D.d.ts.map +1 -1
  161. package/lib/components/shared/three/models/SkeletalPlayer3D.js +7 -5
  162. package/lib/components/shared/three/models/SkeletalPlayer3D.js.map +1 -1
  163. package/lib/components/shared/three/optimization/AdaptiveQuality.js.map +1 -1
  164. package/lib/components/shared/three/scene/AtmosphericParticles3D.js.map +1 -1
  165. package/lib/components/shared/three/scene/BackgroundScene3D.js.map +1 -1
  166. package/lib/components/shared/three/scene/CombatArena3D.js.map +1 -1
  167. package/lib/components/shared/three/scene/KoreanSignage3D.js.map +1 -1
  168. package/lib/components/shared/three/ui/ArchetypeCard.js.map +1 -1
  169. package/lib/components/shared/three/ui/BodyPartHealthDisplay.js.map +1 -1
  170. package/lib/components/shared/three/ui/BreathingIndicator2.js.map +1 -1
  171. package/lib/components/shared/three/ui/CombatReadinessBar.js.map +1 -1
  172. package/lib/components/shared/three/ui/ComboCounter.js.map +1 -1
  173. package/lib/components/shared/three/ui/HealthBar.js.map +1 -1
  174. package/lib/components/shared/three/ui/KoreanButton.js.map +1 -1
  175. package/lib/components/shared/three/ui/KoreanPanel.js.map +1 -1
  176. package/lib/components/shared/three/ui/KoreanText.js.map +1 -1
  177. package/lib/components/shared/three/ui/MenuList.js.map +1 -1
  178. package/lib/components/shared/three/ui/PlayerHUD.js.map +1 -1
  179. package/lib/components/shared/three/ui/ProgressBar.js.map +1 -1
  180. package/lib/components/shared/three/ui/SpeedIndicatorHUD.js.map +1 -1
  181. package/lib/components/shared/three/ui/StaminaBar.js.map +1 -1
  182. package/lib/components/shared/three/ui/TechniqueBar.js.map +1 -1
  183. package/lib/components/shared/three/ui/TechniqueCard.js.map +1 -1
  184. package/lib/components/shared/three/ui/VitalPointOverlayControlsHtml.js.map +1 -1
  185. package/lib/components/shared/ui/BackButton.js.map +1 -1
  186. package/lib/components/shared/ui/BaseHUDContainer.js.map +1 -1
  187. package/lib/components/shared/ui/CombatTimer.js.map +1 -1
  188. package/lib/components/shared/ui/ErrorModal.js.map +1 -1
  189. package/lib/components/shared/ui/LoadingState.js.map +1 -1
  190. package/lib/components/shared/ui/SplashScreen.js +2 -2
  191. package/lib/components/shared/ui/SplashScreen.js.map +1 -1
  192. package/lib/components/shared/ui/VitalPointOverlayControlsPure.js.map +1 -1
  193. package/lib/components/shared/ui/VolumeControl.js.map +1 -1
  194. package/lib/components/shared/ui/shared/ConfirmDialog.js.map +1 -1
  195. package/lib/components/ui/combat/BalanceIndicatorOverlayHtml.js.map +1 -1
  196. package/lib/constants/bodyDimensions.js.map +1 -1
  197. package/lib/constants/bodyRenderingConstants.js.map +1 -1
  198. package/lib/data/archetypeClothing.js.map +1 -1
  199. package/lib/data/archetypePhysicalAttributes.js.map +1 -1
  200. package/lib/data/techniqueMappings.js.map +1 -1
  201. package/lib/data/techniques.js.map +1 -1
  202. package/lib/hooks/useActionFeedback.js.map +1 -1
  203. package/lib/hooks/useBalanceAnimations.js.map +1 -1
  204. package/lib/hooks/useCombatTimer.js.map +1 -1
  205. package/lib/hooks/useDebounce.js.map +1 -1
  206. package/lib/hooks/useHUDLayout.d.ts.map +1 -1
  207. package/lib/hooks/useHUDLayout.js +3 -2
  208. package/lib/hooks/useHUDLayout.js.map +1 -1
  209. package/lib/hooks/useHandPoseTransitions.js.map +1 -1
  210. package/lib/hooks/useKeyboardControls.js.map +1 -1
  211. package/lib/hooks/useMatchCountdown.js.map +1 -1
  212. package/lib/hooks/useMuscleActivation.js.map +1 -1
  213. package/lib/hooks/usePauseMenu.js.map +1 -1
  214. package/lib/hooks/usePlayerAnimation.js.map +1 -1
  215. package/lib/hooks/useResponsiveLayout.js.map +1 -1
  216. package/lib/hooks/useRoundTransition.js.map +1 -1
  217. package/lib/hooks/useSkeletalAnimation.d.ts.map +1 -1
  218. package/lib/hooks/useSkeletalAnimation.js +1 -1
  219. package/lib/hooks/useSkeletalAnimation.js.map +1 -1
  220. package/lib/hooks/useTechniqueSelection.js.map +1 -1
  221. package/lib/hooks/useThrottle.js.map +1 -1
  222. package/lib/hooks/useTouchControls.js.map +1 -1
  223. package/lib/hooks/useWebGLContextLossHandler.js.map +1 -1
  224. package/lib/hooks/useWindowSize.js.map +1 -1
  225. package/lib/systems/CombatSystem.js.map +1 -1
  226. package/lib/systems/EffectCalculator.js.map +1 -1
  227. package/lib/systems/LayoutSystem.js.map +1 -1
  228. package/lib/systems/PlayerEffectManager.js.map +1 -1
  229. package/lib/systems/ResponsiveScaling.js.map +1 -1
  230. package/lib/systems/TrigramSystem.js.map +1 -1
  231. package/lib/systems/VitalPointSystem.js.map +1 -1
  232. package/lib/systems/ai/AIPersonality.js.map +1 -1
  233. package/lib/systems/ai/AdaptiveDifficulty.js +16 -16
  234. package/lib/systems/ai/AdaptiveDifficulty.js.map +1 -1
  235. package/lib/systems/ai/ArchetypeEnforcer.js.map +1 -1
  236. package/lib/systems/ai/ComboSystem.js.map +1 -1
  237. package/lib/systems/ai/DecisionTree.js.map +1 -1
  238. package/lib/systems/ai/TrainingAI.js.map +1 -1
  239. package/lib/systems/ai/types.js.map +1 -1
  240. package/lib/systems/animation/builders/AnimationBuilder.js.map +1 -1
  241. package/lib/systems/animation/builders/HandPoseApplicator.js.map +1 -1
  242. package/lib/systems/animation/builders/HandPoses.js.map +1 -1
  243. package/lib/systems/animation/builders/KeyframeConfig.js.map +1 -1
  244. package/lib/systems/animation/builders/KeyframeInterpolation.js.map +1 -1
  245. package/lib/systems/animation/builders/KickPhaseApplicator.d.ts +6 -0
  246. package/lib/systems/animation/builders/KickPhaseApplicator.d.ts.map +1 -1
  247. package/lib/systems/animation/builders/KickPhaseApplicator.js +16 -9
  248. package/lib/systems/animation/builders/KickPhaseApplicator.js.map +1 -1
  249. package/lib/systems/animation/builders/KoreanGuardPositions.d.ts +4 -4
  250. package/lib/systems/animation/builders/KoreanGuardPositions.js.map +1 -1
  251. package/lib/systems/animation/builders/MartialArtsAnimationBuilder.d.ts +1 -1
  252. package/lib/systems/animation/builders/MartialArtsAnimationBuilder.d.ts.map +1 -1
  253. package/lib/systems/animation/builders/MartialArtsAnimationBuilder.js +5 -5
  254. package/lib/systems/animation/builders/MartialArtsAnimationBuilder.js.map +1 -1
  255. package/lib/systems/animation/builders/MartialArtsConstants.d.ts +112 -71
  256. package/lib/systems/animation/builders/MartialArtsConstants.d.ts.map +1 -1
  257. package/lib/systems/animation/builders/MartialArtsConstants.js +113 -72
  258. package/lib/systems/animation/builders/MartialArtsConstants.js.map +1 -1
  259. package/lib/systems/animation/builders/MartialPoseApplicator.js.map +1 -1
  260. package/lib/systems/animation/builders/PunchPhaseApplicator.js.map +1 -1
  261. package/lib/systems/animation/builders/SkeletonRig.js.map +1 -1
  262. package/lib/systems/animation/builders/TrigramGuardApplicator.js.map +1 -1
  263. package/lib/systems/animation/catalogs/AttackAnimations.js.map +1 -1
  264. package/lib/systems/animation/catalogs/BasicAnimations.js.map +1 -1
  265. package/lib/systems/animation/catalogs/ComboAnimations.js.map +1 -1
  266. package/lib/systems/animation/catalogs/DarkOpsAnimations.js.map +1 -1
  267. package/lib/systems/animation/catalogs/DefensiveAnimations.js.map +1 -1
  268. package/lib/systems/animation/catalogs/ElbowKneeAnimations.js.map +1 -1
  269. package/lib/systems/animation/catalogs/EnhancedAttackAnimations.js.map +1 -1
  270. package/lib/systems/animation/catalogs/EnhancedElbowKneeAnimations.js.map +1 -1
  271. package/lib/systems/animation/catalogs/FootworkSkeletalAnimations.js.map +1 -1
  272. package/lib/systems/animation/catalogs/GamRedirectionAnimations.js.map +1 -1
  273. package/lib/systems/animation/catalogs/GamStanceAnimations.js +21 -0
  274. package/lib/systems/animation/catalogs/GamStanceAnimations.js.map +1 -0
  275. package/lib/systems/animation/catalogs/GamTechniqueAnimations.js +34 -2
  276. package/lib/systems/animation/catalogs/GamTechniqueAnimations.js.map +1 -1
  277. package/lib/systems/animation/catalogs/GanStanceAnimations.js.map +1 -1
  278. package/lib/systems/animation/catalogs/GanTechniqueAnimations.js.map +1 -1
  279. package/lib/systems/animation/catalogs/GeonStanceAnimations.js.map +1 -1
  280. package/lib/systems/animation/catalogs/GonTechniqueAnimations.d.ts +9 -0
  281. package/lib/systems/animation/catalogs/GonTechniqueAnimations.d.ts.map +1 -1
  282. package/lib/systems/animation/catalogs/GonTechniqueAnimations.js +288 -0
  283. package/lib/systems/animation/catalogs/GonTechniqueAnimations.js.map +1 -0
  284. package/lib/systems/animation/catalogs/GrapplingAnimations.js.map +1 -1
  285. package/lib/systems/animation/catalogs/JinStanceAnimations.js.map +1 -1
  286. package/lib/systems/animation/catalogs/JinTechniqueAnimations.js.map +1 -1
  287. package/lib/systems/animation/catalogs/KickAnimations.d.ts +2 -2
  288. package/lib/systems/animation/catalogs/KickAnimations.js +2 -2
  289. package/lib/systems/animation/catalogs/KickAnimations.js.map +1 -1
  290. package/lib/systems/animation/catalogs/LiStanceAnimations.js +14 -1
  291. package/lib/systems/animation/catalogs/LiStanceAnimations.js.map +1 -1
  292. package/lib/systems/animation/catalogs/LiTechniqueAnimations.js.map +1 -1
  293. package/lib/systems/animation/catalogs/MovementAnimations.js.map +1 -1
  294. package/lib/systems/animation/catalogs/PunchAnimations.d.ts +1 -1
  295. package/lib/systems/animation/catalogs/PunchAnimations.js +1 -1
  296. package/lib/systems/animation/catalogs/PunchAnimations.js.map +1 -1
  297. package/lib/systems/animation/catalogs/RecoveryAnimations.js.map +1 -1
  298. package/lib/systems/animation/catalogs/SonStanceAnimations.js.map +1 -1
  299. package/lib/systems/animation/catalogs/SonTechniqueAnimations.js.map +1 -1
  300. package/lib/systems/animation/catalogs/SpecializedPunchAnimations.js.map +1 -1
  301. package/lib/systems/animation/catalogs/StanceAnimations.js.map +1 -1
  302. package/lib/systems/animation/catalogs/StanceAttackAnimations.js.map +1 -1
  303. package/lib/systems/animation/catalogs/StanceGuardPoses.d.ts +6 -6
  304. package/lib/systems/animation/catalogs/StanceGuardPoses.js +36 -36
  305. package/lib/systems/animation/catalogs/StanceGuardPoses.js.map +1 -1
  306. package/lib/systems/animation/catalogs/StanceIdleAnimations.js.map +1 -1
  307. package/lib/systems/animation/catalogs/StanceLocomotionAnimations.js.map +1 -1
  308. package/lib/systems/animation/catalogs/StepSkeletalAnimations.js.map +1 -1
  309. package/lib/systems/animation/catalogs/TaeJointLockAnimations.js.map +1 -1
  310. package/lib/systems/animation/catalogs/TaeStanceAnimations.js.map +1 -1
  311. package/lib/systems/animation/constants/AnatomicalLimits.js.map +1 -1
  312. package/lib/systems/animation/core/AnimationHitTiming.js.map +1 -1
  313. package/lib/systems/animation/core/AnimationOptimizations.js.map +1 -1
  314. package/lib/systems/animation/core/AnimationPriority.js +15 -15
  315. package/lib/systems/animation/core/AnimationPriority.js.map +1 -1
  316. package/lib/systems/animation/core/AnimationRegistry.d.ts +30 -0
  317. package/lib/systems/animation/core/AnimationRegistry.d.ts.map +1 -1
  318. package/lib/systems/animation/core/AnimationRegistry.js +74 -12
  319. package/lib/systems/animation/core/AnimationRegistry.js.map +1 -1
  320. package/lib/systems/animation/core/AnimationStateMachine.js +16 -16
  321. package/lib/systems/animation/core/AnimationStateMachine.js.map +1 -1
  322. package/lib/systems/animation/core/AnimationTransitions.d.ts.map +1 -1
  323. package/lib/systems/animation/core/AnimationTransitions.js +34 -0
  324. package/lib/systems/animation/core/AnimationTransitions.js.map +1 -1
  325. package/lib/systems/animation/core/LateralityTransform.js.map +1 -1
  326. package/lib/systems/animation/core/RecoveryPhaseEnhancer.js.map +1 -1
  327. package/lib/systems/animation/core/TechniqueAnimationMapper.js.map +1 -1
  328. package/lib/systems/animation/core/TechniqueAnimationMapping.js.map +1 -1
  329. package/lib/systems/animation/core/index.d.ts +1 -1
  330. package/lib/systems/animation/core/index.d.ts.map +1 -1
  331. package/lib/systems/animation/core/types.d.ts +24 -0
  332. package/lib/systems/animation/core/types.d.ts.map +1 -1
  333. package/lib/systems/animation/core/types.js +27 -11
  334. package/lib/systems/animation/core/types.js.map +1 -1
  335. package/lib/systems/animation/systems/AdvancedJointMovements.js.map +1 -1
  336. package/lib/systems/animation/systems/BodyFacingSystem.js.map +1 -1
  337. package/lib/systems/animation/systems/FacialExpressions.js.map +1 -1
  338. package/lib/systems/animation/systems/FallAnimations.js.map +1 -1
  339. package/lib/systems/animation/systems/MuscleActivation.js.map +1 -1
  340. package/lib/systems/bodypart/BodyPartDamageIntegration.js.map +1 -1
  341. package/lib/systems/bodypart/BodyPartHealthSystem.js.map +1 -1
  342. package/lib/systems/bodypart/BodyPartPositionMapping.js.map +1 -1
  343. package/lib/systems/bodypart/CombatInjuryIntegration.js.map +1 -1
  344. package/lib/systems/bodypart/InjuryIntegration.js.map +1 -1
  345. package/lib/systems/bodypart/InjuryTracker.js.map +1 -1
  346. package/lib/systems/bodypart/MovementPenaltySystem.js.map +1 -1
  347. package/lib/systems/bodypart/PlayerInjuryTrackingManager.js.map +1 -1
  348. package/lib/systems/bodypart/types.js.map +1 -1
  349. package/lib/systems/breathing/BreathingDisruptionSystem.js +19 -19
  350. package/lib/systems/breathing/BreathingDisruptionSystem.js.map +1 -1
  351. package/lib/systems/breathing/feedback.js.map +1 -1
  352. package/lib/systems/breathing/integration.js.map +1 -1
  353. package/lib/systems/combat/BalanceSystem.js +19 -19
  354. package/lib/systems/combat/BalanceSystem.js.map +1 -1
  355. package/lib/systems/combat/BreakingStatusEffects.js.map +1 -1
  356. package/lib/systems/combat/CombatStateSystem.js +17 -17
  357. package/lib/systems/combat/CombatStateSystem.js.map +1 -1
  358. package/lib/systems/combat/ConsciousnessSystem.js +24 -24
  359. package/lib/systems/combat/ConsciousnessSystem.js.map +1 -1
  360. package/lib/systems/combat/FallIntegration.js.map +1 -1
  361. package/lib/systems/combat/GrappleSystem.js.map +1 -1
  362. package/lib/systems/combat/LimbExposureSystem.js.map +1 -1
  363. package/lib/systems/combat/PainResponseSystem.js +21 -21
  364. package/lib/systems/combat/PainResponseSystem.js.map +1 -1
  365. package/lib/systems/combat/TrainingCombatSystem.js.map +1 -1
  366. package/lib/systems/combat/painConsciousnessUtils.js.map +1 -1
  367. package/lib/systems/combat/typeGuards.js.map +1 -1
  368. package/lib/systems/effects.js.map +1 -1
  369. package/lib/systems/game.js.map +1 -1
  370. package/lib/systems/movement/InjuryMovementModifier.js.map +1 -1
  371. package/lib/systems/movement/helpers/AccelerationUpdater.js.map +1 -1
  372. package/lib/systems/movement/helpers/accelerationUtils.js.map +1 -1
  373. package/lib/systems/movement/integration.js.map +1 -1
  374. package/lib/systems/physics/AttackMovementPhysics.js.map +1 -1
  375. package/lib/systems/physics/CollisionDetection.js.map +1 -1
  376. package/lib/systems/physics/CoordinateMapper.js.map +1 -1
  377. package/lib/systems/physics/KnockbackPhysics.js.map +1 -1
  378. package/lib/systems/physics/MovementPhysics.js.map +1 -1
  379. package/lib/systems/physics/PhysicalReachCalculator.js.map +1 -1
  380. package/lib/systems/physics/SpeedModifierSystem.js +6 -6
  381. package/lib/systems/physics/SpeedModifierSystem.js.map +1 -1
  382. package/lib/systems/trigram/KoreanCulture.js.map +1 -1
  383. package/lib/systems/trigram/KoreanTechniques.js.map +1 -1
  384. package/lib/systems/trigram/StanceManager.js.map +1 -1
  385. package/lib/systems/trigram/TransitionCalculator.js.map +1 -1
  386. package/lib/systems/trigram/TrigramCalculator.js.map +1 -1
  387. package/lib/systems/trigram/techniques/DarkOpsTechniques.js.map +1 -1
  388. package/lib/systems/trigram/techniques/GamTechniques.js.map +1 -1
  389. package/lib/systems/trigram/techniques/GanTechniques.js.map +1 -1
  390. package/lib/systems/trigram/techniques/GeonTechniques.js.map +1 -1
  391. package/lib/systems/trigram/techniques/GonTechniques.js.map +1 -1
  392. package/lib/systems/trigram/techniques/JinTechniques.js.map +1 -1
  393. package/lib/systems/trigram/techniques/LiTechniques.js.map +1 -1
  394. package/lib/systems/trigram/techniques/SonTechniques.js.map +1 -1
  395. package/lib/systems/trigram/techniques/TaeTechniques.js.map +1 -1
  396. package/lib/systems/trigram/techniques/TechniqueConfig.js.map +1 -1
  397. package/lib/systems/trigram/techniques/index.js.map +1 -1
  398. package/lib/systems/trigram/types/GonTechniqueExtensions.js.map +1 -1
  399. package/lib/systems/trigram/types.js.map +1 -1
  400. package/lib/systems/types.js.map +1 -1
  401. package/lib/systems/vitalpoint/DamageCalculator.js.map +1 -1
  402. package/lib/systems/vitalpoint/HitDetection.js.map +1 -1
  403. package/lib/systems/vitalpoint/KoreanAnatomy.js.map +1 -1
  404. package/lib/systems/vitalpoint/KoreanVitalPoints.js.map +1 -1
  405. package/lib/systems/vitalpoint/MeridianVitalPointMapping.js.map +1 -1
  406. package/lib/systems/vitalpoint/VitalPointsData.js.map +1 -1
  407. package/lib/types/AccessibilityTypes.js.map +1 -1
  408. package/lib/types/LayoutTypes.js.map +1 -1
  409. package/lib/types/PhysicsTypes.js.map +1 -1
  410. package/lib/types/common.js.map +1 -1
  411. package/lib/types/constants/animations.js.map +1 -1
  412. package/lib/types/constants/colors.js.map +1 -1
  413. package/lib/types/constants/designSystem.js.map +1 -1
  414. package/lib/types/constants/index.js.map +1 -1
  415. package/lib/types/constants/layout.d.ts +21 -0
  416. package/lib/types/constants/layout.d.ts.map +1 -1
  417. package/lib/types/constants/layout.js +22 -1
  418. package/lib/types/constants/layout.js.map +1 -1
  419. package/lib/types/constants/performance.js.map +1 -1
  420. package/lib/types/constants/typography.js.map +1 -1
  421. package/lib/types/constants/ui.js.map +1 -1
  422. package/lib/types/facial.js +19 -19
  423. package/lib/types/facial.js.map +1 -1
  424. package/lib/types/hand-animation.js.map +1 -1
  425. package/lib/types/injury.js.map +1 -1
  426. package/lib/types/muscle.js.map +1 -1
  427. package/lib/types/physics.js.map +1 -1
  428. package/lib/types/physicsConstants.js.map +1 -1
  429. package/lib/types/player-visual.d.ts +1 -1
  430. package/lib/types/player-visual.d.ts.map +1 -1
  431. package/lib/types/skeletal.js.map +1 -1
  432. package/lib/types/techniqueId.js.map +1 -1
  433. package/lib/utils/accessibility.js.map +1 -1
  434. package/lib/utils/arenaWorldDimensions.js.map +1 -1
  435. package/lib/utils/assetConfig.js.map +1 -1
  436. package/lib/utils/characterScaling.js.map +1 -1
  437. package/lib/utils/colorHelpers.js.map +1 -1
  438. package/lib/utils/colorUtils.js.map +1 -1
  439. package/lib/utils/combatReadiness.js.map +1 -1
  440. package/lib/utils/controlMapping.js.map +1 -1
  441. package/lib/utils/deviceDetection.js +6 -7
  442. package/lib/utils/deviceDetection.js.map +1 -1
  443. package/lib/utils/effectUtils.js.map +1 -1
  444. package/lib/utils/fabricTextures.js.map +1 -1
  445. package/lib/utils/hapticFeedback.js.map +1 -1
  446. package/lib/utils/haptics.js.map +1 -1
  447. package/lib/utils/htmlOverlayHelpers.js.map +1 -1
  448. package/lib/utils/inputSystem.js.map +1 -1
  449. package/lib/utils/koreanThemeHelpers.js.map +1 -1
  450. package/lib/utils/math.js.map +1 -1
  451. package/lib/utils/mobileLayoutHelpers.js.map +1 -1
  452. package/lib/utils/mobileUIUtils.js.map +1 -1
  453. package/lib/utils/performance/PerformanceMonitor.js.map +1 -1
  454. package/lib/utils/performance/PerformanceOverlay3D.js.map +1 -1
  455. package/lib/utils/performance/usePerformanceMonitor.js.map +1 -1
  456. package/lib/utils/performanceOptimization.js.map +1 -1
  457. package/lib/utils/player3DHelpers.js.map +1 -1
  458. package/lib/utils/playerUtils.js.map +1 -1
  459. package/lib/utils/responsiveLayout.js.map +1 -1
  460. package/lib/utils/responsiveLayoutHelpers.d.ts +7 -0
  461. package/lib/utils/responsiveLayoutHelpers.d.ts.map +1 -1
  462. package/lib/utils/responsiveLayoutHelpers.js +16 -2
  463. package/lib/utils/responsiveLayoutHelpers.js.map +1 -1
  464. package/lib/utils/responsiveOrientationConstants.js.map +1 -1
  465. package/lib/utils/safeAreaUtils.js.map +1 -1
  466. package/lib/utils/sharedPhysicsConfig.js.map +1 -1
  467. package/lib/utils/skeletonScaling.js.map +1 -1
  468. package/lib/utils/stanceHelpers.js.map +1 -1
  469. package/lib/utils/threeObjectPool.js.map +1 -1
  470. package/lib/utils/visualEffects.js.map +1 -1
  471. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../src/systems/animation/core/types.ts"],"sourcesContent":["/**\n * Animation system types for Black Trigram\n *\n * Defines animation states, configurations, and transition rules\n * for frame-accurate combat animations at 60fps.\n *\n * @module systems/animation/types\n * @category Animation\n * @korean 애니메이션시스템타입\n */\n\n/**\n * Animation states for player characters (애니메이션 상태)\n *\n * Enum-based animation state system for type safety and IDE autocomplete.\n * Each state includes Korean terminology and timing specifications.\n *\n * Based on game-design.md specifications:\n * - Attack: 12 frames (200ms at 60fps)\n * - Block: 4 frames (67ms at 60fps)\n * - Walk: 6 frames (100ms at 60fps)\n * - Stance transitions: 36 frames (600ms at 60fps)\n * - Tactical steps: 18 frames (300ms at 60fps, 30cm distance)\n *\n * @korean 애니메이션상태\n */\nexport enum AnimationState {\n // ===== Basic Movement States (기본 이동 상태) =====\n\n /**\n * Idle stance - Default breathing animation\n * Korean: 대기 (daegi) - Standing ready\n * Duration: 4 frames (67ms)\n */\n IDLE = \"idle\",\n\n /**\n * Walk - Normal walking movement\n * Korean: 보행 (bohaeng) - Walking\n * Duration: 6 frames (100ms)\n */\n WALK = \"walk\",\n\n /**\n * Run - Fast movement animation\n * Korean: 달리기 (dalligi) - Running\n * Duration: 8 frames (133ms)\n */\n RUN = \"run\",\n\n // ===== Combat Actions (전투 행동) =====\n\n /**\n * Attack - Generic attack animation\n * Korean: 공격 (gonggyeok) - Attack\n * Duration: 12 frames (200ms)\n */\n ATTACK = \"attack\",\n\n /**\n * Defend - Basic block/defense\n * Korean: 방어 (bangeo) - Defense\n * Duration: 4 frames (67ms)\n */\n DEFEND = \"defend\",\n\n /**\n * Defend Block Success - Successful block, absorb impact\n * Korean: 막기 (makgi) - Block successfully\n * Duration: 8 frames (133ms)\n */\n DEFEND_BLOCK_SUCCESS = \"defend_block_success\",\n\n /**\n * Defend Parry - Parry deflection, redirect attack\n * Korean: 받아넘기기 (badaneumgigi) - Parry deflect\n * Duration: 10 frames (167ms)\n */\n DEFEND_PARRY = \"defend_parry\",\n\n /**\n * Defend Guard Break - Guard break, defensive stance destroyed\n * Korean: 방어붕괴 (bangeo bunggoe) - Guard broken\n * Duration: 15 frames (250ms)\n */\n DEFEND_GUARD_BREAK = \"defend_guard_break\",\n\n /**\n * Defend Recovery - Guard recovery, restore defensive posture\n * Korean: 방어복구 (bangeo bokgu) - Guard recovery\n * Duration: 12 frames (200ms)\n */\n DEFEND_RECOVERY = \"defend_recovery\",\n\n /**\n * Hit - Taking damage animation\n * Korean: 피격 (pigyeok) - Being hit\n * Duration: 4 frames (67ms)\n */\n HIT = \"hit\",\n\n /**\n * KO - Knockout/death animation\n * Korean: 기절 (gijeol) - Knockout\n * Duration: 30 frames (500ms)\n */\n KO = \"ko\",\n\n // ===== Stance Transitions (자세 전환) =====\n\n /**\n * Stance Change - Trigram stance transition\n * Korean: 자세변경 (jaseybyeongyeong) - Stance change\n * Duration: 36 frames (600ms)\n */\n STANCE_CHANGE = \"stance_change\",\n\n /**\n * Stance Side Switch - Left↔right stance mirror\n * Korean: 좌우전환 (jwaujeonhwan) - Left-right switch\n * Duration: 24 frames (400ms)\n */\n STANCE_SIDE_SWITCH = \"stance_side_switch\",\n\n // ===== Stance Guard Animations (팔괘 방어 자세) =====\n\n /**\n * Stance Guard Geon - ☰ Heaven stance guard\n * Korean: 건괘수비 (geon-goe subi) - Heaven guard\n * Duration: 6 frames (breathing loop)\n */\n STANCE_GUARD_GEON = \"stance_guard_geon\",\n\n /**\n * Stance Guard Tae - ☱ Lake stance guard\n * Korean: 태괘수비 (tae-goe subi) - Lake guard\n * Duration: 6 frames (breathing loop)\n */\n STANCE_GUARD_TAE = \"stance_guard_tae\",\n\n /**\n * Stance Guard Li - ☲ Fire stance guard\n * Korean: 리괘수비 (li-goe subi) - Fire guard\n * Duration: 4 frames (breathing loop)\n */\n STANCE_GUARD_LI = \"stance_guard_li\",\n\n /**\n * Stance Guard Jin - ☳ Thunder stance guard\n * Korean: 진괘수비 (jin-goe subi) - Thunder guard\n * Duration: 5 frames (breathing loop)\n */\n STANCE_GUARD_JIN = \"stance_guard_jin\",\n\n /**\n * Stance Guard Son - ☴ Wind stance guard\n * Korean: 손괘수비 (son-goe subi) - Wind guard\n * Duration: 6 frames (breathing loop)\n */\n STANCE_GUARD_SON = \"stance_guard_son\",\n\n /**\n * Stance Guard Gam - ☵ Water stance guard\n * Korean: 감괘수비 (gam-goe subi) - Water guard\n * Duration: 6 frames (breathing loop)\n */\n STANCE_GUARD_GAM = \"stance_guard_gam\",\n\n /**\n * Stance Guard Gan - ☶ Mountain stance guard\n * Korean: 간괘수비 (gan-goe subi) - Mountain guard\n * Duration: 4 frames (breathing loop)\n */\n STANCE_GUARD_GAN = \"stance_guard_gan\",\n\n /**\n * Stance Guard Gon - ☷ Earth stance guard\n * Korean: 곤괘수비 (gon-goe subi) - Earth guard\n * Duration: 5 frames (breathing loop)\n */\n STANCE_GUARD_GON = \"stance_guard_gon\",\n\n // ===== Tactical Step Movements (전술적 발걸음) =====\n\n /**\n * Step Forward - Forward tactical step\n * Korean: 전진보법 (jeonjin bobeop) - Forward step\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_FORWARD = \"step_forward\",\n\n /**\n * Step Back - Retreat tactical step\n * Korean: 후퇴보법 (hutoe bobeop) - Retreat step\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_BACK = \"step_back\",\n\n /**\n * Step Left - Left side tactical step\n * Korean: 좌측면보법 (jwacheuk myeon bobeop) - Left side step\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_LEFT = \"step_left\",\n\n /**\n * Step Right - Right side tactical step\n * Korean: 우측면보법 (ucheuk myeon bobeop) - Right side step\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_RIGHT = \"step_right\",\n\n /**\n * Step Forward Left - Forward-left diagonal step\n * Korean: 전좌측보법 (jeon jwacheuk bobeop) - Forward-left diagonal\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_FORWARD_LEFT = \"step_forward_left\",\n\n /**\n * Step Forward Right - Forward-right diagonal step\n * Korean: 전우측보법 (jeon ucheuk bobeop) - Forward-right diagonal\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_FORWARD_RIGHT = \"step_forward_right\",\n\n /**\n * Step Back Left - Back-left diagonal step\n * Korean: 후좌측보법 (hu jwacheuk bobeop) - Back-left diagonal\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_BACK_LEFT = \"step_back_left\",\n\n /**\n * Step Back Right - Back-right diagonal step\n * Korean: 후우측보법 (hu ucheuk bobeop) - Back-right diagonal\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_BACK_RIGHT = \"step_back_right\",\n\n // ===== Footwork Patterns (보법) =====\n\n /**\n * Footwork Circular Left - Circular step maintaining guard (left)\n * Korean: 원형보 좌 (wonhyeongbo jwa) - Circular step left\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n FOOTWORK_CIRCULAR_LEFT = \"footwork_circular_left\",\n\n /**\n * Footwork Circular Right - Circular step maintaining guard (right)\n * Korean: 원형보 우 (wonhyeongbo u) - Circular step right\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n FOOTWORK_CIRCULAR_RIGHT = \"footwork_circular_right\",\n\n /**\n * Footwork Pivot Left - Pivot rotation on planted foot (left)\n * Korean: 축족회전 좌 (chukjok hoejeon jwa) - Pivot rotation left\n * Duration: 15 frames (250ms), Rotation: 90°\n */\n FOOTWORK_PIVOT_LEFT = \"footwork_pivot_left\",\n\n /**\n * Footwork Pivot Right - Pivot rotation on planted foot (right)\n * Korean: 축족회전 우 (chukjok hoejeon u) - Pivot rotation right\n * Duration: 15 frames (250ms), Rotation: 90°\n */\n FOOTWORK_PIVOT_RIGHT = \"footwork_pivot_right\",\n\n /**\n * Footwork Slide Forward - Both feet slide together (forward)\n * Korean: 미끄럼보 전 (mikkeureombo jeon) - Sliding step forward\n * Duration: 12 frames (200ms), Distance: 30cm\n */\n FOOTWORK_SLIDE_FORWARD = \"footwork_slide_forward\",\n\n /**\n * Footwork Slide Back - Both feet slide together (back)\n * Korean: 미끄럼보 후 (mikkeureombo hu) - Sliding step back\n * Duration: 12 frames (200ms), Distance: 30cm\n */\n FOOTWORK_SLIDE_BACK = \"footwork_slide_back\",\n\n /**\n * Footwork Slide Left - Both feet slide together (left)\n * Korean: 미끄럼보 좌 (mikkeureombo jwa) - Sliding step left\n * Duration: 12 frames (200ms), Distance: 30cm\n */\n FOOTWORK_SLIDE_LEFT = \"footwork_slide_left\",\n\n /**\n * Footwork Slide Right - Both feet slide together (right)\n * Korean: 미끄럼보 우 (mikkeureombo u) - Sliding step right\n * Duration: 12 frames (200ms), Distance: 30cm\n */\n FOOTWORK_SLIDE_RIGHT = \"footwork_slide_right\",\n\n /**\n * Footwork Shuffle - Quick micro-adjustment\n * Korean: 섞음보 (seokkeumbo) - Shuffle step\n * Duration: 6 frames (100ms), Distance: 15cm\n */\n FOOTWORK_SHUFFLE = \"footwork_shuffle\",\n\n // ===== Fall Animations (낙법 애니메이션) =====\n\n /**\n * Fall Forward - Forward fall animation\n * Korean: 전방낙법 (jeonbang nakbeop) - Forward falling technique\n * Duration: 24 frames (400ms)\n */\n FALL_FORWARD = \"fall_forward\",\n\n /**\n * Fall Backward - Backward fall animation\n * Korean: 후방낙법 (hubang nakbeop) - Backward falling technique\n * Duration: 30 frames (500ms)\n */\n FALL_BACKWARD = \"fall_backward\",\n\n /**\n * Fall Side Left - Left side fall animation\n * Korean: 좌측낙법 (jwacheuk nakbeop) - Left side falling technique\n * Duration: 27 frames (450ms)\n */\n FALL_SIDE_LEFT = \"fall_side_left\",\n\n /**\n * Fall Side Right - Right side fall animation\n * Korean: 우측낙법 (ucheuk nakbeop) - Right side falling technique\n * Duration: 27 frames (450ms)\n */\n FALL_SIDE_RIGHT = \"fall_side_right\",\n\n // ===== Ground States (지면 자세) =====\n\n /**\n * Ground Prone - Face-down ground position\n * Korean: 엎드림 (eopdeurim) - Face down position\n * Duration: 4 frames (breathing loop)\n */\n GROUND_PRONE = \"ground_prone\",\n\n /**\n * Ground Supine - Face-up ground position\n * Korean: 누움 (nuum) - Face up position\n * Duration: 4 frames (breathing loop)\n */\n GROUND_SUPINE = \"ground_supine\",\n\n /**\n * Ground Side Left - Left side ground position\n * Korean: 좌측와 (jwacheuk wa) - Left side position\n * Duration: 4 frames (breathing loop)\n */\n GROUND_SIDE_LEFT = \"ground_side_left\",\n\n /**\n * Ground Side Right - Right side ground position\n * Korean: 우측와 (ucheuk wa) - Right side position\n * Duration: 4 frames (breathing loop)\n */\n GROUND_SIDE_RIGHT = \"ground_side_right\",\n\n // ===== Turn Animations (180도 회전) =====\n\n /**\n * Turn Left - 180° turn left animation\n * Korean: 좌회전 (jwahoejeon) - Left turn\n * Duration: 12 frames (200ms), Rotation: 180°\n */\n TURN_LEFT = \"turn_left\",\n\n /**\n * Turn Right - 180° turn right animation\n * Korean: 우회전 (uhoejeon) - Right turn\n * Duration: 12 frames (200ms), Rotation: 180°\n */\n TURN_RIGHT = \"turn_right\",\n\n // ===== Recovery Animations (회복 애니메이션) =====\n\n /**\n * Recovery Prone Standup - Stand up from prone position\n * Korean: 엎드린 기상 (eopdeurin gisang) - Prone stand-up\n * Duration: 30 frames (500ms)\n */\n RECOVERY_PRONE_STANDUP = \"recovery_prone_standup\",\n\n /**\n * Recovery Supine Standup - Stand up from supine position\n * Korean: 누운 기상 (nuun gisang) - Supine stand-up\n * Duration: 36 frames (600ms)\n */\n RECOVERY_SUPINE_STANDUP = \"recovery_supine_standup\",\n\n /**\n * Recovery Roll - Roll recovery to standing\n * Korean: 회전기상 (hoejeon gisang) - Roll recovery\n * Duration: 24 frames (400ms), Stamina cost: 20\n */\n RECOVERY_ROLL = \"recovery_roll\",\n\n /**\n * Recovery Defensive - Defensive getup with guard\n * Korean: 방어기상 (bangeo gisang) - Defensive getup\n * Duration: 42 frames (700ms), Damage reduction: 50%\n */\n RECOVERY_DEFENSIVE = \"recovery_defensive\",\n\n // ===== Grappling Animations (잡기 애니메이션) =====\n\n /**\n * Grapple Entry - Establish grip connection\n * Korean: 잡기 연결 (japgi yeongyeol) - Grab connection\n * Duration: 8 frames (133ms)\n *\n * Initiates the grappling sequence when attacker successfully grabs defender.\n * Transition from IDLE/ATTACK state to establishing physical control.\n */\n GRAPPLE_ENTRY = \"grapple_entry\",\n\n /**\n * Grapple Control - Maintain grip control\n * Korean: 잡기 유지 (japgi yuji) - Maintaining grip\n * Duration: Loop (breathing animation ~4 frames)\n *\n * Active control state where attacker maintains grip on defender.\n * Looping animation with subtle struggle movements.\n * Stamina cost: 5/second (default)\n */\n GRAPPLE_CONTROL = \"grapple_control\",\n\n /**\n * Grapple Struggle - Escape attempt animation\n * Korean: 탈출 시도 (talchul sido) - Escape attempts\n * Duration: 12 frames (200ms)\n *\n * Defender animation when attempting to break free from grapple.\n * Shows strain and resistance movements.\n * Stamina cost: 15 per attempt\n */\n GRAPPLE_STRUGGLE = \"grapple_struggle\",\n\n /**\n * Grapple Escape - Successful escape from grapple\n * Korean: 탈출 성공 (talchul seonggong) - Successful escape\n * Duration: 15 frames (250ms)\n *\n * Defender breaks free and creates distance from attacker.\n * Returns to IDLE state upon completion.\n * Provides invulnerability frames during escape animation.\n */\n GRAPPLE_ESCAPE = \"grapple_escape\",\n}\n\n/**\n * Animation priority levels for interrupt system\n *\n * Higher priority animations can interrupt lower priority ones.\n * Priority order: recovery > fall > ko > hit > attack > defend > step > stance_change > movement > idle\n *\n * Steps are non-interruptible (same priority as attacks) to ensure commitment\n * to tactical repositioning in Korean martial arts.\n * Recovery animations have highest priority to allow getting up from ground.\n *\n * @korean 애니메이션우선순위\n */\nexport enum AnimationPriority {\n IDLE = 0,\n WALK = 1,\n RUN = 2,\n STANCE_CHANGE = 3,\n DEFEND = 4,\n ATTACK = 5, // STEP shares ATTACK priority (both non-interruptible)\n HIT = 6,\n KO = 7,\n FALL = 8,\n RECOVERY = 9,\n}\n\n// Step animations use ATTACK priority (5) - both are non-interruptible\nexport const STEP_PRIORITY = AnimationPriority.ATTACK;\n\n/**\n * Defensive animation types for guard break and defensive stance mechanics.\n *\n * **Korean Terminology**:\n * - block_success: 막기 (makgi) - Successful block, absorb impact\n * - parry_deflect: 받아넘기기 (badaneumgigi) - Parry deflection, redirect attack\n * - guard_break: 방어붕괴 (bangeo bunggoe) - Guard break, defensive stance destroyed\n * - guard_recovery: 방어복구 (bangeo bokgu) - Guard recovery, restore defensive posture\n *\n * @korean 방어애니메이션타입\n */\nexport type DefensiveAnimationType =\n | \"block_success\"\n | \"parry_deflect\"\n | \"guard_break\"\n | \"guard_recovery\";\n\n/**\n * Animation configuration for a single animation state\n *\n * Frame counts based on game-design.md:\n * - Attack: 12 frames (200ms at 60fps)\n * - Block: 4 frames (67ms at 60fps)\n * - Walk: 6 frames\n *\n * Extended with defensive animation support:\n * - Block Success: 8 frames (133ms)\n * - Parry Deflect: 10 frames (167ms)\n * - Guard Break: 15 frames (250ms)\n * - Guard Recovery: 12 frames (200ms)\n *\n * @korean 애니메이션설정\n */\nexport interface AnimationConfig {\n /**\n * Animation state identifier\n * @korean 상태\n */\n readonly state: AnimationState;\n\n /**\n * Total number of frames in animation\n * @korean 프레임수\n */\n readonly frames: number;\n\n /**\n * Target frames per second (typically 60)\n * @korean 초당프레임\n */\n readonly fps: number;\n\n /**\n * Whether animation loops continuously\n * @korean 반복여부\n */\n readonly loop: boolean;\n\n /**\n * Whether animation can be interrupted by higher priority animations\n * @korean 중단가능여부\n */\n readonly interruptible: boolean;\n\n /**\n * Animation priority for interrupt system\n * @korean 우선순위\n */\n readonly priority: AnimationPriority;\n\n /**\n * Duration in seconds (calculated from frames/fps)\n * @korean 지속시간\n */\n readonly duration: number;\n\n /**\n * Counter-attack window in seconds (for parry animations)\n * Creates an opportunity window for immediate counter-attacks after successful parry.\n * @korean 반격시간\n */\n readonly counterWindow?: number;\n\n /**\n * Vulnerability window duration in seconds (for guard break animations)\n * Extended vulnerability period where defender takes increased damage.\n * @korean 취약시간\n */\n readonly vulnerabilityDuration?: number;\n\n /**\n * Easing function for smooth animation transitions\n *\n * **Korean**: 이징 함수\n *\n * Specifies the easing curve for this animation's transitions.\n * Uses cubic bezier presets for natural Korean martial arts movement.\n *\n * @korean 이징함수\n */\n readonly easing?:\n | \"linear\"\n | \"ease-in\"\n | \"ease-out\"\n | \"ease-in-out\"\n | \"natural-motion\"\n | \"smooth-transition\"\n | \"quick-start\"\n | \"explosive-power\"\n | \"controlled-slow\";\n}\n\n/**\n * Mutable version of AnimationConfig for internal state machine use.\n * Allows dynamic frame/duration updates for technique-specific timing.\n *\n * @internal\n * @korean 가변애니메이션설정\n */\nexport type MutableAnimationConfig = {\n -readonly [K in keyof AnimationConfig]: AnimationConfig[K];\n};\n\n/**\n * Animation event callback types\n *\n * @korean 애니메이션이벤트\n */\nexport interface AnimationEvents {\n /**\n * Called when animation starts\n * @korean 시작이벤트\n */\n readonly onAnimationStart?: (state: AnimationState) => void;\n\n /**\n * Called on specific frame numbers\n * @korean 프레임이벤트\n */\n readonly onFrame?: (frame: number, state: AnimationState) => void;\n\n /**\n * Called when animation completes\n * @korean 완료이벤트\n */\n readonly onAnimationComplete?: (state: AnimationState) => void;\n\n /**\n * Called when animation is interrupted\n * @korean 중단이벤트\n */\n readonly onAnimationInterrupted?: (\n fromState: AnimationState,\n toState: AnimationState,\n ) => void;\n}\n\n/**\n * Animation state machine state\n *\n * @korean 애니메이션상태머신상태\n */\nexport interface AnimationMachineState {\n /**\n * Current animation state\n * @korean 현재상태\n */\n readonly currentState: AnimationState;\n\n /**\n * Current frame index (0 to frames-1)\n * @korean 현재프레임\n */\n readonly frameIndex: number;\n\n /**\n * Time accumulator for frame timing\n * @korean 시간누적\n */\n readonly timeAccumulator: number;\n\n /**\n * Whether animation is playing\n * @korean 재생중\n */\n readonly isPlaying: boolean;\n\n /**\n * Previous animation state\n * @korean 이전상태\n */\n readonly previousState: AnimationState | null;\n}\n\n/**\n * Animation transition rule\n *\n * @korean 애니메이션전환규칙\n */\nexport interface TransitionRule {\n /**\n * Source animation state\n * @korean 시작상태\n */\n readonly from: AnimationState;\n\n /**\n * Target animation state\n * @korean 목표상태\n */\n readonly to: AnimationState;\n\n /**\n * Whether transition is allowed\n * @korean 허용여부\n */\n readonly allowed: boolean;\n\n /**\n * Optional condition function\n * @korean 조건함수\n */\n readonly condition?: () => boolean;\n}\n\n/**\n * Result of an animation update\n *\n * @korean 애니메이션업데이트결과\n */\nexport interface AnimationUpdateResult {\n /**\n * Current animation state\n * @korean 현재상태\n */\n readonly state: AnimationState;\n\n /**\n * Current frame index\n * @korean 현재프레임\n */\n readonly frame: number;\n\n /**\n * Animation progress (0-1)\n * @korean 진행률\n */\n readonly progress: number;\n\n /**\n * Whether animation just completed this frame\n * @korean 완료여부\n */\n readonly justCompleted: boolean;\n\n /**\n * Whether animation just started this frame\n * @korean 시작여부\n */\n readonly justStarted: boolean;\n}\n\n/**\n * Step direction for tactical movement\n *\n * Eight directions for tactical stepping (전술적 발놀림):\n * - forward: 전진보법 (Jeonjin Bobeop) - Forward step\n * - back: 후퇴보법 (Hutoe Bobeop) - Retreat step\n * - left: 좌측면보법 (Jwacheuk Myeon Bobeop) - Left side step\n * - right: 우측면보법 (Ucheuk Myeon Bobeop) - Right side step\n * - forward_left: 전좌측보법 (Jeon Jwacheuk Bobeop) - Forward-left diagonal\n * - forward_right: 전우측보법 (Jeon Ucheuk Bobeop) - Forward-right diagonal\n * - back_left: 후좌측보법 (Hu Jwacheuk Bobeop) - Back-left diagonal\n * - back_right: 후우측보법 (Hu Ucheuk Bobeop) - Back-right diagonal\n *\n * Each step moves exactly 30cm (one foot width) for tactical repositioning\n * in Korean martial arts combat.\n *\n * @korean 발걸음방향\n */\nexport type StepDirection =\n | \"forward\"\n | \"back\"\n | \"left\"\n | \"right\"\n | \"forward_left\"\n | \"forward_right\"\n | \"back_left\"\n | \"back_right\";\n\n/**\n * Step animation configuration\n *\n * Defines keyframes for tactical step movements with:\n * - Weight transfer from back foot to front foot\n * - Foot lift and placement\n * - Guard position maintenance\n * - 30cm distance movement\n * - 300ms duration (18 frames at 60fps)\n *\n * @korean 발걸음애니메이션설정\n */\nexport interface StepConfig extends AnimationConfig {\n /**\n * Step direction\n * @korean 방향\n */\n readonly direction: StepDirection;\n\n /**\n * Distance moved in meters (always 0.3m = 30cm)\n * @korean 이동거리\n */\n readonly distance: number;\n\n /**\n * Whether guard position is maintained during step\n * @korean 방어자세유지\n */\n readonly maintainsGuard: boolean;\n\n /**\n * Stamina cost for this step\n * @korean 체력소모\n */\n readonly staminaCost: number;\n}\n\n/**\n * Step keyframe data for animation interpolation\n *\n * Defines weight distribution, foot positions, and body center of gravity\n * at specific frames during the step animation.\n *\n * @korean 발걸음키프레임\n */\nexport interface StepKeyframe {\n /**\n * Frame number (0-17 for 18-frame step)\n * @korean 프레임번호\n */\n readonly frame: number;\n\n /**\n * Weight distribution (0 = fully on back foot, 1 = fully on front foot)\n * @korean 체중분배\n */\n readonly weight: number;\n\n /**\n * Front foot position offset from start (0-1, where 1 = full step distance)\n * @korean 앞발위치\n */\n readonly frontFootOffset: number;\n\n /**\n * Back foot position offset from start (0-1)\n * @korean 뒷발위치\n */\n readonly backFootOffset: number;\n\n /**\n * Vertical lift of front foot in meters\n * @korean 앞발들어올림\n */\n readonly frontFootLift: number;\n\n /**\n * Body center of gravity height offset\n * @korean 무게중심높이\n */\n readonly cogHeight: number;\n}\n\n/**\n * Fall direction types for knockdown animations\n *\n * Determines which fall animation to play based on attack direction,\n * balance loss, or consciousness failure.\n *\n * Korean terminology:\n * - forward: 전방낙법 (Jeonbang Nakbeop) - Forward falling technique\n * - backward: 후방낙법 (Hubang Nakbeop) - Backward falling technique\n * - side_left: 좌측낙법 (Jwacheuk Nakbeop) - Left side falling technique\n * - side_right: 우측낙법 (Ucheuk Nakbeop) - Right side falling technique\n *\n * @korean 낙법유형\n */\nexport type FallType = \"forward\" | \"backward\" | \"side_left\" | \"side_right\";\n\n/**\n * Ground position states after falling\n *\n * Represents the character's position on the ground after a fall.\n * Each state has a looping breathing animation.\n *\n * Korean terminology:\n * - prone: 엎드림 (Eopdeurim) - Face down position\n * - supine: 누움 (Nuum) - Face up position\n * - side_left: 좌측와 (Jwacheuk Wa) - Left side position\n * - side_right: 우측와 (Ucheuk Wa) - Right side position\n *\n * @korean 지면자세\n */\nexport type GroundState = \"prone\" | \"supine\" | \"side_left\" | \"side_right\";\n\n/**\n * Maps fall types to corresponding ground states\n *\n * @korean 낙법지면맵\n */\nexport const FALL_TO_GROUND_MAP: Record<FallType, GroundState> = {\n forward: \"prone\",\n backward: \"supine\",\n side_left: \"side_left\",\n side_right: \"side_right\",\n};\n\n/**\n * Maps fall types to corresponding animation states\n *\n * @korean 낙법애니메이션맵\n */\nexport const FALL_TYPE_TO_ANIMATION: Record<FallType, AnimationState> = {\n forward: AnimationState.FALL_FORWARD,\n backward: AnimationState.FALL_BACKWARD,\n side_left: AnimationState.FALL_SIDE_LEFT,\n side_right: AnimationState.FALL_SIDE_RIGHT,\n};\n\n/**\n * Maps ground states to corresponding animation states\n *\n * @korean 지면애니메이션맵\n */\nexport const GROUND_STATE_TO_ANIMATION: Record<GroundState, AnimationState> = {\n prone: AnimationState.GROUND_PRONE,\n supine: AnimationState.GROUND_SUPINE,\n side_left: AnimationState.GROUND_SIDE_LEFT,\n side_right: AnimationState.GROUND_SIDE_RIGHT,\n};\n\n/**\n * Body facing direction system state\n *\n * Manages automatic character rotation to face opponent with:\n * - Smooth torso rotation (45°/sec, ±90° range)\n * - Independent head tracking (±45° range)\n * - 180° turn animations for repositioning\n * - Facing lock during attack/defend animations\n *\n * Korean terminology:\n * - 정면향하기 (Jeongmyeon Hyanghagi) - Face forward\n * - 몸회전 (Mom Hoejeon) - Body rotation\n * - 머리추적 (Meori Chujok) - Head tracking\n * - 180도회전 (180-do Hoejeon) - 180-degree turn\n *\n * @korean 몸향하기상태\n */\nexport interface BodyFacing {\n /**\n * Current facing direction in degrees (0-360)\n * - 0° = facing right (+X axis)\n * - 90° = facing down (+Z axis)\n * - 180° = facing left (-X axis)\n * - 270° = facing up (-Z axis)\n *\n * @korean 현재각도\n */\n readonly currentAngle: number;\n\n /**\n * Desired facing direction in degrees (0-360)\n * Typically pointing toward opponent position\n *\n * @korean 목표각도\n */\n readonly targetAngle: number;\n\n /**\n * Rotation speed in degrees per second\n * Default: 45°/sec for smooth, realistic rotation\n *\n * @korean 회전속도\n */\n readonly rotationSpeed: number;\n\n /**\n * Head rotation offset relative to torso (-45° to +45°)\n * Head can track independently within limited range\n * - Positive = head turned right\n * - Negative = head turned left\n *\n * @korean 머리회전각도\n */\n readonly headAngleOffset: number;\n\n /**\n * Whether facing direction is locked\n * True during attack/defend animations to lock attack direction\n * False during idle/movement to allow dynamic tracking\n *\n * @korean 회전잠금\n */\n readonly isLocked: boolean;\n\n /**\n * Whether character is currently executing a 180° turn animation\n * Used to prevent movement and other actions during repositioning\n *\n * @korean 180도회전중\n */\n readonly isTurning: boolean;\n\n /**\n * Direction of current 180° turn ('left' or 'right')\n * Determines which turn animation to play\n *\n * @korean 회전방향\n */\n readonly turnDirection?: \"left\" | \"right\";\n\n /**\n * Timestamp when 180° turn animation started\n * Used to track turn animation progress (200ms duration)\n *\n * @korean 회전시작시간\n */\n readonly turnStartTime?: number;\n\n /**\n * Torso rotation relative to hips in radians\n * Range: ±π/2 (±90°) for anatomically correct movement\n * - Positive = torso rotated right relative to hips\n * - Negative = torso rotated left relative to hips\n *\n * @korean 허리회전 (Heorhwoejeon)\n */\n readonly torsoRotation?: number;\n\n /**\n * Hip/pelvis rotation in radians (lower body facing direction)\n * Base rotation for the lower body, torsoRotation is relative to this\n *\n * @korean 골반회전 (Golbanhwoejeon)\n */\n readonly hipRotation?: number;\n}\n\n/**\n * Torso rotation state for independent upper/lower body movement\n *\n * Manages realistic torso rotation allowing upper body to face opponent\n * while lower body moves in different direction (strafing).\n *\n * Korean terminology:\n * - 허리회전 (Heorhwoejeon) - Torso rotation\n * - 상체비틀기 (Sangchebiteulgi) - Upper body twist\n * - 골반고정 (Golbangojeong) - Hip stabilization\n *\n * @korean 허리회전상태\n */\nexport interface TorsoRotationState {\n /**\n * Current torso Y-axis rotation in radians\n * Range: ±π/2 (±90°) relative to hip direction\n *\n * @korean 현재회전\n */\n readonly currentRotation: number;\n\n /**\n * Target rotation towards opponent in radians\n * Smoothly interpolated to currentRotation\n *\n * @korean 목표회전\n */\n readonly targetRotation: number;\n\n /**\n * Lower body (hip/pelvis) rotation in radians\n * Base rotation for movement direction\n *\n * @korean 골반회전\n */\n readonly hipRotation: number;\n\n /**\n * Interpolation speed in seconds\n * Default: 0.2 (200ms for smooth rotation)\n *\n * @korean 보간속도\n */\n readonly interpolationSpeed: number;\n}\n\n/**\n * Footwork pattern types for Korean martial arts (보법)\n *\n * Four specialized footwork patterns based on traditional Korean martial arts:\n * - circular: 원형보 (Wonhyeongbo) - Circular stepping while maintaining guard facing\n * - pivot: 축족회전 (Chukjok Hoejeon) - Pivot rotation on planted foot\n * - slide: 미끄럼보 (Mikkeureombo) - Sliding step with both feet moving together\n * - shuffle: 섞음보 (Seokkeumbo) - Quick shuffling micro-adjustment\n *\n * Each pattern serves distinct tactical purposes in combat:\n * - Circular: Lateral repositioning while keeping opponent in guard\n * - Pivot: Fast direction changes on planted foot\n * - Slide: Maintaining stable base while advancing/retreating\n * - Shuffle: Fine-tuning position without commitment\n *\n * @korean 보법유형\n */\nexport type FootworkPattern = \"circular\" | \"pivot\" | \"slide\" | \"shuffle\";\n\n/**\n * Footwork direction for directional patterns\n *\n * @korean 보법방향\n */\nexport type FootworkDirection = \"left\" | \"right\" | \"forward\" | \"back\";\n\n/**\n * Korean terminology for footwork patterns\n *\n * Maps each footwork pattern to its Korean martial arts terminology\n * with romanization and English translation.\n *\n * @korean 보법한글용어\n */\nexport const FOOTWORK_KOREAN_TERMS: Record<\n FootworkPattern,\n { korean: string; romanized: string; english: string }\n> = {\n circular: {\n korean: \"원형보\",\n romanized: \"Wonhyeongbo\",\n english: \"Circular Step\",\n },\n pivot: {\n korean: \"축족회전\",\n romanized: \"Chukjok Hoejeon\",\n english: \"Pivot Rotation\",\n },\n slide: {\n korean: \"미끄럼보\",\n romanized: \"Mikkeureombo\",\n english: \"Sliding Step\",\n },\n shuffle: {\n korean: \"섞음보\",\n romanized: \"Seokkeumbo\",\n english: \"Shuffle Step\",\n },\n};\n\n/**\n * Recovery animation types for getting up from ground states\n *\n * Korean terminology:\n * - prone_standup: 엎드린 기상 (Eopdeurin Gisang) - Stand up from prone\n * - supine_standup: 누운 기상 (Nuun Gisang) - Stand up from supine\n * - roll: 회전기상 (Hoejeon Gisang) - Roll recovery\n * - defensive: 방어기상 (Bangeo Gisang) - Defensive getup\n *\n * @korean 회복애니메이션유형\n */\nexport type RecoveryAnimationType =\n | \"prone_standup\"\n | \"supine_standup\"\n | \"roll_recovery\"\n | \"defensive_getup\";\n\n/**\n * Korean terminology for recovery animations\n *\n * Maps each recovery type to its Korean martial arts terminology\n * with romanization and English translation.\n *\n * @korean 회복한글용어\n */\nexport const RECOVERY_KOREAN_TERMS: Record<\n RecoveryAnimationType,\n { korean: string; romanized: string; english: string }\n> = {\n prone_standup: {\n korean: \"엎드린 기상\",\n romanized: \"Eopdeurin Gisang\",\n english: \"Prone Stand-Up\",\n },\n supine_standup: {\n korean: \"누운 기상\",\n romanized: \"Nuun Gisang\",\n english: \"Supine Stand-Up\",\n },\n roll_recovery: {\n korean: \"회전기상\",\n romanized: \"Hoejeon Gisang\",\n english: \"Roll Recovery\",\n },\n defensive_getup: {\n korean: \"방어기상\",\n romanized: \"Bangeo Gisang\",\n english: \"Defensive Getup\",\n },\n};\n\n/**\n * Maps ground states to their default recovery animation\n *\n * @korean 지면회복맵\n */\nexport const GROUND_STATE_TO_RECOVERY: Record<\n GroundState,\n RecoveryAnimationType\n> = {\n prone: \"prone_standup\",\n supine: \"supine_standup\",\n side_left: \"roll_recovery\", // Side positions use roll by default\n side_right: \"roll_recovery\",\n};\n\n/**\n * Maps recovery types to their animation states\n *\n * @korean 회복애니메이션맵\n */\nexport const RECOVERY_TYPE_TO_ANIMATION: Record<\n RecoveryAnimationType,\n AnimationState\n> = {\n prone_standup: AnimationState.RECOVERY_PRONE_STANDUP,\n supine_standup: AnimationState.RECOVERY_SUPINE_STANDUP,\n roll_recovery: AnimationState.RECOVERY_ROLL,\n defensive_getup: AnimationState.RECOVERY_DEFENSIVE,\n};\n\n/**\n * Technique intensity levels for animation speed and impact\n *\n * **Korean**: 기술 강도 레벨\n *\n * Determines animation speed modifier and visual impact effects:\n * - light: Fast techniques (1.2x speed), lower damage\n * - medium: Normal techniques (1.0x speed), standard damage\n * - heavy: Powerful techniques (0.8x speed), high damage\n * - critical: Maximum power (0.6x speed), critical damage\n *\n * @category Animation\n * @korean 기술강도\n */\nexport type TechniqueIntensity = \"light\" | \"medium\" | \"heavy\" | \"critical\";\n\n/**\n * Technique type categories for animation selection\n *\n * **Korean**: 기술 유형\n *\n * Core technique categories that determine base animation style:\n * - strike: Direct striking attacks (punches, palm strikes)\n * - joint: Joint manipulation and locks\n * - throw: Throwing and sweeping techniques\n * - pressure_point: Precise vital point strikes\n *\n * @category Combat\n * @korean 기술타입\n */\nexport type TechniqueTypeCategory =\n | \"strike\"\n | \"joint\"\n | \"throw\"\n | \"pressure_point\";\n\n/**\n * Composite key for technique animation lookup\n *\n * **Korean**: 기술 애니메이션 키\n *\n * Combines stance, technique type, target body part, and intensity\n * to uniquely identify the appropriate animation to play.\n *\n * @example\n * ```typescript\n * const key: TechniqueAnimationKey = {\n * stance: TrigramStance.GEON,\n * techniqueType: 'strike',\n * bodyPart: BodyPart.HEAD,\n * intensity: 'heavy',\n * };\n * ```\n *\n * @category Animation\n * @korean 기술애니메이션키\n */\nexport interface TechniqueAnimationKey {\n /** Trigram stance (8 stances) */\n readonly stance: string;\n /** Technique category */\n readonly techniqueType: TechniqueTypeCategory;\n /** Target body part */\n readonly bodyPart: string;\n /** Attack intensity level */\n readonly intensity: TechniqueIntensity;\n}\n\n/**\n * Complete technique animation configuration\n *\n * **Korean**: 기술 애니메이션 설정\n *\n * Defines all properties needed to execute a technique animation,\n * including timing, impact frame, Korean terminology, and priority.\n *\n * @example\n * ```typescript\n * const animation: TechniqueAnimation = {\n * animationState: AnimationState.ATTACK,\n * duration: 0.8,\n * impactFrame: 12,\n * recoveryFrames: 15,\n * priority: 8,\n * koreanName: '건괘 두부 강 타격',\n * englishName: 'Heaven Stance Head Strike',\n * };\n * ```\n *\n * @category Animation\n * @korean 기술애니메이션\n */\nexport interface TechniqueAnimation {\n /** Animation state to play */\n readonly animationState: AnimationState;\n /** Duration in seconds */\n readonly duration: number;\n /** Frame number where hit lands (0-indexed) */\n readonly impactFrame: number;\n /** Number of recovery frames after impact */\n readonly recoveryFrames: number;\n /** Animation priority for interrupt system */\n readonly priority: AnimationPriority;\n /** Korean technique name */\n readonly koreanName: string;\n /** English technique name */\n readonly englishName: string;\n\n // ===== Advanced Joint Movement Properties (고급 관절 동작) =====\n\n /**\n * Torso rotation angle in radians relative to hips\n *\n * **Korean**: 허리회전 (Heorhwoejeon)\n *\n * Range: -π/2 to π/2 (-90° to 90°)\n * Used for independent upper/lower body movement\n *\n * @korean 허리회전각도\n */\n readonly torsoRotation?: number;\n\n /**\n * Hip rotation engagement factor (0-1)\n *\n * **Korean**: 골반회전 참여도 (Golbanhwoejeon Chamyeodo)\n *\n * - 0.0: No hip engagement (isolated technique)\n * - 0.3: Minimal hip involvement\n * - 0.6: Moderate hip rotation\n * - 1.0: Full hip engagement (maximum power)\n *\n * Contributes 10-30% damage bonus based on technique type\n *\n * @korean 골반회전도\n */\n readonly hipEngagement?: number;\n\n /**\n * Power modifier from hip rotation (calculated)\n *\n * **Korean**: 파워배율 (Pawo Baeyul)\n *\n * Multiplier applied to technique damage (1.0-1.3)\n * Calculated from hipEngagement and techniqueType\n *\n * @korean 파워배율\n */\n readonly powerModifier?: number;\n}\n\n/**\n * Validation result for technique animation mapping completeness\n *\n * **Korean**: 기술 애니메이션 매핑 검증 결과\n *\n * Reports coverage percentage and lists any missing mappings\n * that need to be filled in.\n *\n * @category Animation\n * @korean 매핑검증결과\n */\nexport interface MappingValidationResult {\n /** Coverage percentage (0-100) */\n readonly coverage: number;\n /** Total combinations expected */\n readonly total: number;\n /** Number of mapped combinations */\n readonly mapped: number;\n /** List of missing combinations */\n readonly missing: readonly TechniqueAnimationKey[];\n}\n\n// ===== Backward Compatibility Helpers (하위 호환성 도우미) =====\n\n/**\n * Convert string to AnimationState enum (backward compatibility)\n *\n * **Korean**: 문자열을 애니메이션 상태로 변환\n *\n * Provides backward compatibility for code using string-based animation states.\n * Returns null if the string doesn't match any valid animation state.\n *\n * @param state - String representation of animation state\n * @returns AnimationState enum or null if invalid\n *\n * @example\n * ```typescript\n * const state = stringToAnimationState(\"idle\"); // AnimationState.IDLE\n * const invalid = stringToAnimationState(\"invalid\"); // null\n * ```\n *\n * @korean 문자열을애니메이션상태로변환\n */\nexport function stringToAnimationState(state: string): AnimationState | null {\n const normalized = state.toLowerCase();\n\n // Check if the normalized string is a valid AnimationState enum value\n const values = Object.values(AnimationState) as string[];\n if (values.includes(normalized)) {\n return normalized as AnimationState;\n }\n\n return null;\n}\n\n/**\n * Check if a value is a valid AnimationState enum\n *\n * **Korean**: 유효한 애니메이션 상태인지 확인\n *\n * Type guard to validate that a value is a valid AnimationState enum value.\n *\n * @param value - Value to check\n * @returns True if value is a valid AnimationState\n *\n * @example\n * ```typescript\n * if (isValidAnimationState(someValue)) {\n * // TypeScript knows someValue is AnimationState here\n * machine.transitionTo(someValue);\n * }\n * ```\n *\n * @korean 유효한애니메이션상태확인\n */\nexport function isValidAnimationState(value: unknown): value is AnimationState {\n if (typeof value !== \"string\") {\n return false;\n }\n\n const values = Object.values(AnimationState) as string[];\n return values.includes(value);\n}\n\n/**\n * Get all animation state enum values as an array\n *\n * **Korean**: 모든 애니메이션 상태 값 배열\n *\n * Returns an array of all valid AnimationState enum values.\n * Useful for iteration, validation, and testing.\n *\n * @returns Array of all AnimationState values\n *\n * @example\n * ```typescript\n * const allStates = getAllAnimationStates();\n * allStates.forEach(state => {\n * console.log(`State: ${state}`);\n * });\n * ```\n *\n * @korean 모든애니메이션상태가져오기\n */\nexport function getAllAnimationStates(): AnimationState[] {\n return Object.values(AnimationState);\n}\n\n/**\n * Check if an animation state is a stance guard state\n *\n * **Korean**: 자세 방어 상태인지 확인\n *\n * Determines if the given animation state is one of the eight trigram\n * stance guard animations.\n *\n * @param state - Animation state to check\n * @returns True if state is a stance guard animation\n *\n * @example\n * ```typescript\n * if (isStanceGuardState(AnimationState.STANCE_GUARD_GEON)) {\n * // Handle stance guard logic\n * }\n * ```\n *\n * @korean 자세방어상태확인\n */\nexport function isStanceGuardState(state: AnimationState): boolean {\n return state.startsWith(\"stance_guard_\");\n}\n\n/**\n * Check if an animation state is a step movement state\n *\n * **Korean**: 발걸음 이동 상태인지 확인\n *\n * Determines if the given animation state is one of the tactical step\n * movement animations.\n *\n * @param state - Animation state to check\n * @returns True if state is a step movement animation\n *\n * @example\n * ```typescript\n * if (isStepState(AnimationState.STEP_FORWARD)) {\n * // Handle step movement logic\n * }\n * ```\n *\n * @korean 발걸음상태확인\n */\nexport function isStepState(state: AnimationState): boolean {\n return state.startsWith(\"step_\");\n}\n\n/**\n * Check if an animation state is a footwork pattern state\n *\n * **Korean**: 보법 패턴 상태인지 확인\n *\n * Determines if the given animation state is one of the specialized\n * Korean martial arts footwork patterns.\n *\n * @param state - Animation state to check\n * @returns True if state is a footwork pattern animation\n *\n * @example\n * ```typescript\n * if (isFootworkState(AnimationState.FOOTWORK_CIRCULAR_LEFT)) {\n * // Handle footwork pattern logic\n * }\n * ```\n *\n * @korean 보법상태확인\n */\nexport function isFootworkState(state: AnimationState): boolean {\n return state.startsWith(\"footwork_\");\n}\n\n/**\n * Check if an animation state is a fall animation state\n *\n * **Korean**: 낙법 애니메이션 상태인지 확인\n *\n * Determines if the given animation state is one of the fall animations.\n *\n * @param state - Animation state to check\n * @returns True if state is a fall animation\n *\n * @example\n * ```typescript\n * if (isFallState(AnimationState.FALL_FORWARD)) {\n * // Handle fall animation logic\n * }\n * ```\n *\n * @korean 낙법상태확인\n */\nexport function isFallState(state: AnimationState): boolean {\n return state.startsWith(\"fall_\");\n}\n\n/**\n * Check if an animation state is a ground position state\n *\n * **Korean**: 지면 자세 상태인지 확인\n *\n * Determines if the given animation state is one of the ground position\n * breathing loops.\n *\n * @param state - Animation state to check\n * @returns True if state is a ground position animation\n *\n * @example\n * ```typescript\n * if (isGroundState(AnimationState.GROUND_PRONE)) {\n * // Handle ground position logic\n * }\n * ```\n *\n * @korean 지면상태확인\n */\nexport function isGroundState(state: AnimationState): boolean {\n return state.startsWith(\"ground_\");\n}\n\n/**\n * Check if an animation state is a recovery animation state\n *\n * **Korean**: 회복 애니메이션 상태인지 확인\n *\n * Determines if the given animation state is one of the recovery/getup\n * animations.\n *\n * @param state - Animation state to check\n * @returns True if state is a recovery animation\n *\n * @example\n * ```typescript\n * if (isRecoveryState(AnimationState.RECOVERY_ROLL)) {\n * // Handle recovery animation logic\n * }\n * ```\n *\n * @korean 회복상태확인\n */\nexport function isRecoveryState(state: AnimationState): boolean {\n return state.startsWith(\"recovery_\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAY,iBAAL,yBAAA,gBAAA;;;;;;CAQL,eAAA,UAAO;;;;;;CAOP,eAAA,UAAO;;;;;;CAOP,eAAA,SAAM;;;;;;CASN,eAAA,YAAS;;;;;;CAOT,eAAA,YAAS;;;;;;CAOT,eAAA,0BAAuB;;;;;;CAOvB,eAAA,kBAAe;;;;;;CAOf,eAAA,wBAAqB;;;;;;CAOrB,eAAA,qBAAkB;;;;;;CAOlB,eAAA,SAAM;;;;;;CAON,eAAA,QAAK;;;;;;CASL,eAAA,mBAAgB;;;;;;CAOhB,eAAA,wBAAqB;;;;;;CASrB,eAAA,uBAAoB;;;;;;CAOpB,eAAA,sBAAmB;;;;;;CAOnB,eAAA,qBAAkB;;;;;;CAOlB,eAAA,sBAAmB;;;;;;CAOnB,eAAA,sBAAmB;;;;;;CAOnB,eAAA,sBAAmB;;;;;;CAOnB,eAAA,sBAAmB;;;;;;CAOnB,eAAA,sBAAmB;;;;;;CASnB,eAAA,kBAAe;;;;;;CAOf,eAAA,eAAY;;;;;;CAOZ,eAAA,eAAY;;;;;;CAOZ,eAAA,gBAAa;;;;;;CAOb,eAAA,uBAAoB;;;;;;CAOpB,eAAA,wBAAqB;;;;;;CAOrB,eAAA,oBAAiB;;;;;;CAOjB,eAAA,qBAAkB;;;;;;CASlB,eAAA,4BAAyB;;;;;;CAOzB,eAAA,6BAA0B;;;;;;CAO1B,eAAA,yBAAsB;;;;;;CAOtB,eAAA,0BAAuB;;;;;;CAOvB,eAAA,4BAAyB;;;;;;CAOzB,eAAA,yBAAsB;;;;;;CAOtB,eAAA,yBAAsB;;;;;;CAOtB,eAAA,0BAAuB;;;;;;CAOvB,eAAA,sBAAmB;;;;;;CASnB,eAAA,kBAAe;;;;;;CAOf,eAAA,mBAAgB;;;;;;CAOhB,eAAA,oBAAiB;;;;;;CAOjB,eAAA,qBAAkB;;;;;;CASlB,eAAA,kBAAe;;;;;;CAOf,eAAA,mBAAgB;;;;;;CAOhB,eAAA,sBAAmB;;;;;;CAOnB,eAAA,uBAAoB;;;;;;CASpB,eAAA,eAAY;;;;;;CAOZ,eAAA,gBAAa;;;;;;CASb,eAAA,4BAAyB;;;;;;CAOzB,eAAA,6BAA0B;;;;;;CAO1B,eAAA,mBAAgB;;;;;;CAOhB,eAAA,wBAAqB;;;;;;;;;CAYrB,eAAA,mBAAgB;;;;;;;;;;CAWhB,eAAA,qBAAkB;;;;;;;;;;CAWlB,eAAA,sBAAmB;;;;;;;;;;CAWnB,eAAA,oBAAiB;;KAClB;;;;;;;;;;;;;AAcD,IAAY,oBAAL,yBAAA,mBAAA;CACL,kBAAA,kBAAA,UAAO,KAAA;CACP,kBAAA,kBAAA,UAAO,KAAA;CACP,kBAAA,kBAAA,SAAM,KAAA;CACN,kBAAA,kBAAA,mBAAgB,KAAA;CAChB,kBAAA,kBAAA,YAAS,KAAA;CACT,kBAAA,kBAAA,YAAS,KAAA;CACT,kBAAA,kBAAA,SAAM,KAAA;CACN,kBAAA,kBAAA,QAAK,KAAA;CACL,kBAAA,kBAAA,UAAO,KAAA;CACP,kBAAA,kBAAA,cAAW,KAAA;;KACZ;AAGD,IAAa,gBAAgB,kBAAkB;;;;;;AA6Z/C,IAAa,qBAAoD;CAC/D,SAAS;CACT,UAAU;CACV,WAAW;CACX,YAAY;CACb;;;;;;AAOD,IAAa,yBAA2D;CACtE,SAAS,eAAe;CACxB,UAAU,eAAe;CACzB,WAAW,eAAe;CAC1B,YAAY,eAAe;CAC5B;AAQQ,eAAe,cACd,eAAe,eACZ,eAAe,kBACd,eAAe;;;;;;;;;AA+L7B,IAAa,wBAGT;CACF,UAAU;EACR,QAAQ;EACR,WAAW;EACX,SAAS;EACV;CACD,OAAO;EACL,QAAQ;EACR,WAAW;EACX,SAAS;EACV;CACD,OAAO;EACL,QAAQ;EACR,WAAW;EACX,SAAS;EACV;CACD,SAAS;EACP,QAAQ;EACR,WAAW;EACX,SAAS;EACV;CACF;;;;;;AA0DD,IAAa,2BAGT;CACF,OAAO;CACP,QAAQ;CACR,WAAW;CACX,YAAY;CACb;;;;;;AAOD,IAAa,6BAGT;CACF,eAAe,eAAe;CAC9B,gBAAgB,eAAe;CAC/B,eAAe,eAAe;CAC9B,iBAAiB,eAAe;CACjC;;;;;;;;;;;;;;;;;;;;AAgWD,SAAgB,YAAY,OAAgC;CAC1D,OAAO,MAAM,WAAW,QAAQ;;;;;;;;;;;;;;;;;;;;;;AAuBlC,SAAgB,cAAc,OAAgC;CAC5D,OAAO,MAAM,WAAW,UAAU"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../src/systems/animation/core/types.ts"],"sourcesContent":["/**\n * Animation system types for Black Trigram\n *\n * Defines animation states, configurations, and transition rules\n * for frame-accurate combat animations at 60fps.\n *\n * @module systems/animation/types\n * @category Animation\n * @korean 애니메이션시스템타입\n */\n\n/**\n * Maximum frame delta used by visual animation loops.\n *\n * 30fps-equivalent clamping prevents large tab-throttled frames from skipping\n * key transitional poses while still allowing 60fps updates during normal play.\n *\n * @korean 최대프레임델타초\n */\nexport const MAX_VISUAL_FRAME_DELTA_SECONDS = 1 / 30;\n\n/**\n * Target animation sampling rate for frame-index calculations.\n *\n * @korean 목표애니메이션FPS\n */\nexport const TARGET_ANIMATION_FPS = 60;\n\n/**\n * Median short technique duration used when skeletal metadata is unavailable.\n *\n * Keeps combat and training fallback attacks longer than the 200ms generic\n * state-machine attack while avoiding slow-feeling recovery snaps.\n *\n * @korean 기본공격지속시간초\n */\nexport const DEFAULT_TECHNIQUE_DURATION_SECONDS = 0.55;\n\n/**\n * Animation states for player characters (애니메이션 상태)\n *\n * Enum-based animation state system for type safety and IDE autocomplete.\n * Each state includes Korean terminology and timing specifications.\n *\n * Based on game-design.md specifications:\n * - Attack: 12 frames (200ms at 60fps)\n * - Block: 4 frames (67ms at 60fps)\n * - Walk: 6 frames (100ms at 60fps)\n * - Stance transitions: 36 frames (600ms at 60fps)\n * - Tactical steps: 18 frames (300ms at 60fps, 30cm distance)\n *\n * @korean 애니메이션상태\n */\nexport enum AnimationState {\n // ===== Basic Movement States (기본 이동 상태) =====\n\n /**\n * Idle stance - Default breathing animation\n * Korean: 대기 (daegi) - Standing ready\n * Duration: 4 frames (67ms)\n */\n IDLE = \"idle\",\n\n /**\n * Walk - Normal walking movement\n * Korean: 보행 (bohaeng) - Walking\n * Duration: 6 frames (100ms)\n */\n WALK = \"walk\",\n\n /**\n * Run - Fast movement animation\n * Korean: 달리기 (dalligi) - Running\n * Duration: 8 frames (133ms)\n */\n RUN = \"run\",\n\n // ===== Combat Actions (전투 행동) =====\n\n /**\n * Attack - Generic attack animation\n * Korean: 공격 (gonggyeok) - Attack\n * Duration: 12 frames (200ms)\n */\n ATTACK = \"attack\",\n\n /**\n * Defend - Basic block/defense\n * Korean: 방어 (bangeo) - Defense\n * Duration: 4 frames (67ms)\n */\n DEFEND = \"defend\",\n\n /**\n * Defend Block Success - Successful block, absorb impact\n * Korean: 막기 (makgi) - Block successfully\n * Duration: 8 frames (133ms)\n */\n DEFEND_BLOCK_SUCCESS = \"defend_block_success\",\n\n /**\n * Defend Parry - Parry deflection, redirect attack\n * Korean: 받아넘기기 (badaneumgigi) - Parry deflect\n * Duration: 10 frames (167ms)\n */\n DEFEND_PARRY = \"defend_parry\",\n\n /**\n * Defend Guard Break - Guard break, defensive stance destroyed\n * Korean: 방어붕괴 (bangeo bunggoe) - Guard broken\n * Duration: 15 frames (250ms)\n */\n DEFEND_GUARD_BREAK = \"defend_guard_break\",\n\n /**\n * Defend Recovery - Guard recovery, restore defensive posture\n * Korean: 방어복구 (bangeo bokgu) - Guard recovery\n * Duration: 12 frames (200ms)\n */\n DEFEND_RECOVERY = \"defend_recovery\",\n\n /**\n * Hit - Taking damage animation\n * Korean: 피격 (pigyeok) - Being hit\n * Duration: 4 frames (67ms)\n */\n HIT = \"hit\",\n\n /**\n * KO - Knockout/death animation\n * Korean: 기절 (gijeol) - Knockout\n * Duration: 30 frames (500ms)\n */\n KO = \"ko\",\n\n // ===== Stance Transitions (자세 전환) =====\n\n /**\n * Stance Change - Trigram stance transition\n * Korean: 자세변경 (jaseybyeongyeong) - Stance change\n * Duration: 36 frames (600ms)\n */\n STANCE_CHANGE = \"stance_change\",\n\n /**\n * Stance Side Switch - Left↔right stance mirror\n * Korean: 좌우전환 (jwaujeonhwan) - Left-right switch\n * Duration: 24 frames (400ms)\n */\n STANCE_SIDE_SWITCH = \"stance_side_switch\",\n\n // ===== Stance Guard Animations (팔괘 방어 자세) =====\n\n /**\n * Stance Guard Geon - ☰ Heaven stance guard\n * Korean: 건괘수비 (geon-goe subi) - Heaven guard\n * Duration: 6 frames (breathing loop)\n */\n STANCE_GUARD_GEON = \"stance_guard_geon\",\n\n /**\n * Stance Guard Tae - ☱ Lake stance guard\n * Korean: 태괘수비 (tae-goe subi) - Lake guard\n * Duration: 6 frames (breathing loop)\n */\n STANCE_GUARD_TAE = \"stance_guard_tae\",\n\n /**\n * Stance Guard Li - ☲ Fire stance guard\n * Korean: 리괘수비 (li-goe subi) - Fire guard\n * Duration: 4 frames (breathing loop)\n */\n STANCE_GUARD_LI = \"stance_guard_li\",\n\n /**\n * Stance Guard Jin - ☳ Thunder stance guard\n * Korean: 진괘수비 (jin-goe subi) - Thunder guard\n * Duration: 5 frames (breathing loop)\n */\n STANCE_GUARD_JIN = \"stance_guard_jin\",\n\n /**\n * Stance Guard Son - ☴ Wind stance guard\n * Korean: 손괘수비 (son-goe subi) - Wind guard\n * Duration: 6 frames (breathing loop)\n */\n STANCE_GUARD_SON = \"stance_guard_son\",\n\n /**\n * Stance Guard Gam - ☵ Water stance guard\n * Korean: 감괘수비 (gam-goe subi) - Water guard\n * Duration: 6 frames (breathing loop)\n */\n STANCE_GUARD_GAM = \"stance_guard_gam\",\n\n /**\n * Stance Guard Gan - ☶ Mountain stance guard\n * Korean: 간괘수비 (gan-goe subi) - Mountain guard\n * Duration: 4 frames (breathing loop)\n */\n STANCE_GUARD_GAN = \"stance_guard_gan\",\n\n /**\n * Stance Guard Gon - ☷ Earth stance guard\n * Korean: 곤괘수비 (gon-goe subi) - Earth guard\n * Duration: 5 frames (breathing loop)\n */\n STANCE_GUARD_GON = \"stance_guard_gon\",\n\n // ===== Tactical Step Movements (전술적 발걸음) =====\n\n /**\n * Step Forward - Forward tactical step\n * Korean: 전진보법 (jeonjin bobeop) - Forward step\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_FORWARD = \"step_forward\",\n\n /**\n * Step Back - Retreat tactical step\n * Korean: 후퇴보법 (hutoe bobeop) - Retreat step\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_BACK = \"step_back\",\n\n /**\n * Step Left - Left side tactical step\n * Korean: 좌측면보법 (jwacheuk myeon bobeop) - Left side step\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_LEFT = \"step_left\",\n\n /**\n * Step Right - Right side tactical step\n * Korean: 우측면보법 (ucheuk myeon bobeop) - Right side step\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_RIGHT = \"step_right\",\n\n /**\n * Step Forward Left - Forward-left diagonal step\n * Korean: 전좌측보법 (jeon jwacheuk bobeop) - Forward-left diagonal\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_FORWARD_LEFT = \"step_forward_left\",\n\n /**\n * Step Forward Right - Forward-right diagonal step\n * Korean: 전우측보법 (jeon ucheuk bobeop) - Forward-right diagonal\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_FORWARD_RIGHT = \"step_forward_right\",\n\n /**\n * Step Back Left - Back-left diagonal step\n * Korean: 후좌측보법 (hu jwacheuk bobeop) - Back-left diagonal\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_BACK_LEFT = \"step_back_left\",\n\n /**\n * Step Back Right - Back-right diagonal step\n * Korean: 후우측보법 (hu ucheuk bobeop) - Back-right diagonal\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n STEP_BACK_RIGHT = \"step_back_right\",\n\n // ===== Footwork Patterns (보법) =====\n\n /**\n * Footwork Circular Left - Circular step maintaining guard (left)\n * Korean: 원형보 좌 (wonhyeongbo jwa) - Circular step left\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n FOOTWORK_CIRCULAR_LEFT = \"footwork_circular_left\",\n\n /**\n * Footwork Circular Right - Circular step maintaining guard (right)\n * Korean: 원형보 우 (wonhyeongbo u) - Circular step right\n * Duration: 18 frames (300ms), Distance: 30cm\n */\n FOOTWORK_CIRCULAR_RIGHT = \"footwork_circular_right\",\n\n /**\n * Footwork Pivot Left - Pivot rotation on planted foot (left)\n * Korean: 축족회전 좌 (chukjok hoejeon jwa) - Pivot rotation left\n * Duration: 15 frames (250ms), Rotation: 90°\n */\n FOOTWORK_PIVOT_LEFT = \"footwork_pivot_left\",\n\n /**\n * Footwork Pivot Right - Pivot rotation on planted foot (right)\n * Korean: 축족회전 우 (chukjok hoejeon u) - Pivot rotation right\n * Duration: 15 frames (250ms), Rotation: 90°\n */\n FOOTWORK_PIVOT_RIGHT = \"footwork_pivot_right\",\n\n /**\n * Footwork Slide Forward - Both feet slide together (forward)\n * Korean: 미끄럼보 전 (mikkeureombo jeon) - Sliding step forward\n * Duration: 12 frames (200ms), Distance: 30cm\n */\n FOOTWORK_SLIDE_FORWARD = \"footwork_slide_forward\",\n\n /**\n * Footwork Slide Back - Both feet slide together (back)\n * Korean: 미끄럼보 후 (mikkeureombo hu) - Sliding step back\n * Duration: 12 frames (200ms), Distance: 30cm\n */\n FOOTWORK_SLIDE_BACK = \"footwork_slide_back\",\n\n /**\n * Footwork Slide Left - Both feet slide together (left)\n * Korean: 미끄럼보 좌 (mikkeureombo jwa) - Sliding step left\n * Duration: 12 frames (200ms), Distance: 30cm\n */\n FOOTWORK_SLIDE_LEFT = \"footwork_slide_left\",\n\n /**\n * Footwork Slide Right - Both feet slide together (right)\n * Korean: 미끄럼보 우 (mikkeureombo u) - Sliding step right\n * Duration: 12 frames (200ms), Distance: 30cm\n */\n FOOTWORK_SLIDE_RIGHT = \"footwork_slide_right\",\n\n /**\n * Footwork Shuffle - Quick micro-adjustment\n * Korean: 섞음보 (seokkeumbo) - Shuffle step\n * Duration: 6 frames (100ms), Distance: 15cm\n */\n FOOTWORK_SHUFFLE = \"footwork_shuffle\",\n\n // ===== Fall Animations (낙법 애니메이션) =====\n\n /**\n * Fall Forward - Forward fall animation\n * Korean: 전방낙법 (jeonbang nakbeop) - Forward falling technique\n * Duration: 24 frames (400ms)\n */\n FALL_FORWARD = \"fall_forward\",\n\n /**\n * Fall Backward - Backward fall animation\n * Korean: 후방낙법 (hubang nakbeop) - Backward falling technique\n * Duration: 30 frames (500ms)\n */\n FALL_BACKWARD = \"fall_backward\",\n\n /**\n * Fall Side Left - Left side fall animation\n * Korean: 좌측낙법 (jwacheuk nakbeop) - Left side falling technique\n * Duration: 27 frames (450ms)\n */\n FALL_SIDE_LEFT = \"fall_side_left\",\n\n /**\n * Fall Side Right - Right side fall animation\n * Korean: 우측낙법 (ucheuk nakbeop) - Right side falling technique\n * Duration: 27 frames (450ms)\n */\n FALL_SIDE_RIGHT = \"fall_side_right\",\n\n // ===== Ground States (지면 자세) =====\n\n /**\n * Ground Prone - Face-down ground position\n * Korean: 엎드림 (eopdeurim) - Face down position\n * Duration: 4 frames (breathing loop)\n */\n GROUND_PRONE = \"ground_prone\",\n\n /**\n * Ground Supine - Face-up ground position\n * Korean: 누움 (nuum) - Face up position\n * Duration: 4 frames (breathing loop)\n */\n GROUND_SUPINE = \"ground_supine\",\n\n /**\n * Ground Side Left - Left side ground position\n * Korean: 좌측와 (jwacheuk wa) - Left side position\n * Duration: 4 frames (breathing loop)\n */\n GROUND_SIDE_LEFT = \"ground_side_left\",\n\n /**\n * Ground Side Right - Right side ground position\n * Korean: 우측와 (ucheuk wa) - Right side position\n * Duration: 4 frames (breathing loop)\n */\n GROUND_SIDE_RIGHT = \"ground_side_right\",\n\n // ===== Turn Animations (180도 회전) =====\n\n /**\n * Turn Left - 180° turn left animation\n * Korean: 좌회전 (jwahoejeon) - Left turn\n * Duration: 12 frames (200ms), Rotation: 180°\n */\n TURN_LEFT = \"turn_left\",\n\n /**\n * Turn Right - 180° turn right animation\n * Korean: 우회전 (uhoejeon) - Right turn\n * Duration: 12 frames (200ms), Rotation: 180°\n */\n TURN_RIGHT = \"turn_right\",\n\n // ===== Recovery Animations (회복 애니메이션) =====\n\n /**\n * Recovery Prone Standup - Stand up from prone position\n * Korean: 엎드린 기상 (eopdeurin gisang) - Prone stand-up\n * Duration: 30 frames (500ms)\n */\n RECOVERY_PRONE_STANDUP = \"recovery_prone_standup\",\n\n /**\n * Recovery Supine Standup - Stand up from supine position\n * Korean: 누운 기상 (nuun gisang) - Supine stand-up\n * Duration: 36 frames (600ms)\n */\n RECOVERY_SUPINE_STANDUP = \"recovery_supine_standup\",\n\n /**\n * Recovery Roll - Roll recovery to standing\n * Korean: 회전기상 (hoejeon gisang) - Roll recovery\n * Duration: 24 frames (400ms), Stamina cost: 20\n */\n RECOVERY_ROLL = \"recovery_roll\",\n\n /**\n * Recovery Defensive - Defensive getup with guard\n * Korean: 방어기상 (bangeo gisang) - Defensive getup\n * Duration: 42 frames (700ms), Damage reduction: 50%\n */\n RECOVERY_DEFENSIVE = \"recovery_defensive\",\n\n // ===== Grappling Animations (잡기 애니메이션) =====\n\n /**\n * Grapple Entry - Establish grip connection\n * Korean: 잡기 연결 (japgi yeongyeol) - Grab connection\n * Duration: 8 frames (133ms)\n *\n * Initiates the grappling sequence when attacker successfully grabs defender.\n * Transition from IDLE/ATTACK state to establishing physical control.\n */\n GRAPPLE_ENTRY = \"grapple_entry\",\n\n /**\n * Grapple Control - Maintain grip control\n * Korean: 잡기 유지 (japgi yuji) - Maintaining grip\n * Duration: Loop (breathing animation ~4 frames)\n *\n * Active control state where attacker maintains grip on defender.\n * Looping animation with subtle struggle movements.\n * Stamina cost: 5/second (default)\n */\n GRAPPLE_CONTROL = \"grapple_control\",\n\n /**\n * Grapple Struggle - Escape attempt animation\n * Korean: 탈출 시도 (talchul sido) - Escape attempts\n * Duration: 12 frames (200ms)\n *\n * Defender animation when attempting to break free from grapple.\n * Shows strain and resistance movements.\n * Stamina cost: 15 per attempt\n */\n GRAPPLE_STRUGGLE = \"grapple_struggle\",\n\n /**\n * Grapple Escape - Successful escape from grapple\n * Korean: 탈출 성공 (talchul seonggong) - Successful escape\n * Duration: 15 frames (250ms)\n *\n * Defender breaks free and creates distance from attacker.\n * Returns to IDLE state upon completion.\n * Provides invulnerability frames during escape animation.\n */\n GRAPPLE_ESCAPE = \"grapple_escape\",\n}\n\n/**\n * Animation priority levels for interrupt system\n *\n * Higher priority animations can interrupt lower priority ones.\n * Priority order: recovery > fall > ko > hit > attack > defend > step > stance_change > movement > idle\n *\n * Steps are non-interruptible (same priority as attacks) to ensure commitment\n * to tactical repositioning in Korean martial arts.\n * Recovery animations have highest priority to allow getting up from ground.\n *\n * @korean 애니메이션우선순위\n */\nexport enum AnimationPriority {\n IDLE = 0,\n WALK = 1,\n RUN = 2,\n STANCE_CHANGE = 3,\n DEFEND = 4,\n ATTACK = 5, // STEP shares ATTACK priority (both non-interruptible)\n HIT = 6,\n KO = 7,\n FALL = 8,\n RECOVERY = 9,\n}\n\n// Step animations use ATTACK priority (5) - both are non-interruptible\nexport const STEP_PRIORITY = AnimationPriority.ATTACK;\n\n/**\n * Defensive animation types for guard break and defensive stance mechanics.\n *\n * **Korean Terminology**:\n * - block_success: 막기 (makgi) - Successful block, absorb impact\n * - parry_deflect: 받아넘기기 (badaneumgigi) - Parry deflection, redirect attack\n * - guard_break: 방어붕괴 (bangeo bunggoe) - Guard break, defensive stance destroyed\n * - guard_recovery: 방어복구 (bangeo bokgu) - Guard recovery, restore defensive posture\n *\n * @korean 방어애니메이션타입\n */\nexport type DefensiveAnimationType =\n | \"block_success\"\n | \"parry_deflect\"\n | \"guard_break\"\n | \"guard_recovery\";\n\n/**\n * Animation configuration for a single animation state\n *\n * Frame counts based on game-design.md:\n * - Attack: 12 frames (200ms at 60fps)\n * - Block: 4 frames (67ms at 60fps)\n * - Walk: 6 frames\n *\n * Extended with defensive animation support:\n * - Block Success: 8 frames (133ms)\n * - Parry Deflect: 10 frames (167ms)\n * - Guard Break: 15 frames (250ms)\n * - Guard Recovery: 12 frames (200ms)\n *\n * @korean 애니메이션설정\n */\nexport interface AnimationConfig {\n /**\n * Animation state identifier\n * @korean 상태\n */\n readonly state: AnimationState;\n\n /**\n * Total number of frames in animation\n * @korean 프레임수\n */\n readonly frames: number;\n\n /**\n * Target frames per second (typically 60)\n * @korean 초당프레임\n */\n readonly fps: number;\n\n /**\n * Whether animation loops continuously\n * @korean 반복여부\n */\n readonly loop: boolean;\n\n /**\n * Whether animation can be interrupted by higher priority animations\n * @korean 중단가능여부\n */\n readonly interruptible: boolean;\n\n /**\n * Animation priority for interrupt system\n * @korean 우선순위\n */\n readonly priority: AnimationPriority;\n\n /**\n * Duration in seconds (calculated from frames/fps)\n * @korean 지속시간\n */\n readonly duration: number;\n\n /**\n * Counter-attack window in seconds (for parry animations)\n * Creates an opportunity window for immediate counter-attacks after successful parry.\n * @korean 반격시간\n */\n readonly counterWindow?: number;\n\n /**\n * Vulnerability window duration in seconds (for guard break animations)\n * Extended vulnerability period where defender takes increased damage.\n * @korean 취약시간\n */\n readonly vulnerabilityDuration?: number;\n\n /**\n * Easing function for smooth animation transitions\n *\n * **Korean**: 이징 함수\n *\n * Specifies the easing curve for this animation's transitions.\n * Uses cubic bezier presets for natural Korean martial arts movement.\n *\n * @korean 이징함수\n */\n readonly easing?:\n | \"linear\"\n | \"ease-in\"\n | \"ease-out\"\n | \"ease-in-out\"\n | \"natural-motion\"\n | \"smooth-transition\"\n | \"quick-start\"\n | \"explosive-power\"\n | \"controlled-slow\";\n}\n\n/**\n * Mutable version of AnimationConfig for internal state machine use.\n * Allows dynamic frame/duration updates for technique-specific timing.\n *\n * @internal\n * @korean 가변애니메이션설정\n */\nexport type MutableAnimationConfig = {\n -readonly [K in keyof AnimationConfig]: AnimationConfig[K];\n};\n\n/**\n * Animation event callback types\n *\n * @korean 애니메이션이벤트\n */\nexport interface AnimationEvents {\n /**\n * Called when animation starts\n * @korean 시작이벤트\n */\n readonly onAnimationStart?: (state: AnimationState) => void;\n\n /**\n * Called on specific frame numbers\n * @korean 프레임이벤트\n */\n readonly onFrame?: (frame: number, state: AnimationState) => void;\n\n /**\n * Called when animation completes\n * @korean 완료이벤트\n */\n readonly onAnimationComplete?: (state: AnimationState) => void;\n\n /**\n * Called when animation is interrupted\n * @korean 중단이벤트\n */\n readonly onAnimationInterrupted?: (\n fromState: AnimationState,\n toState: AnimationState,\n ) => void;\n}\n\n/**\n * Animation state machine state\n *\n * @korean 애니메이션상태머신상태\n */\nexport interface AnimationMachineState {\n /**\n * Current animation state\n * @korean 현재상태\n */\n readonly currentState: AnimationState;\n\n /**\n * Current frame index (0 to frames-1)\n * @korean 현재프레임\n */\n readonly frameIndex: number;\n\n /**\n * Time accumulator for frame timing\n * @korean 시간누적\n */\n readonly timeAccumulator: number;\n\n /**\n * Whether animation is playing\n * @korean 재생중\n */\n readonly isPlaying: boolean;\n\n /**\n * Previous animation state\n * @korean 이전상태\n */\n readonly previousState: AnimationState | null;\n}\n\n/**\n * Animation transition rule\n *\n * @korean 애니메이션전환규칙\n */\nexport interface TransitionRule {\n /**\n * Source animation state\n * @korean 시작상태\n */\n readonly from: AnimationState;\n\n /**\n * Target animation state\n * @korean 목표상태\n */\n readonly to: AnimationState;\n\n /**\n * Whether transition is allowed\n * @korean 허용여부\n */\n readonly allowed: boolean;\n\n /**\n * Optional condition function\n * @korean 조건함수\n */\n readonly condition?: () => boolean;\n}\n\n/**\n * Result of an animation update\n *\n * @korean 애니메이션업데이트결과\n */\nexport interface AnimationUpdateResult {\n /**\n * Current animation state\n * @korean 현재상태\n */\n readonly state: AnimationState;\n\n /**\n * Current frame index\n * @korean 현재프레임\n */\n readonly frame: number;\n\n /**\n * Animation progress (0-1)\n * @korean 진행률\n */\n readonly progress: number;\n\n /**\n * Whether animation just completed this frame\n * @korean 완료여부\n */\n readonly justCompleted: boolean;\n\n /**\n * Whether animation just started this frame\n * @korean 시작여부\n */\n readonly justStarted: boolean;\n}\n\n/**\n * Step direction for tactical movement\n *\n * Eight directions for tactical stepping (전술적 발놀림):\n * - forward: 전진보법 (Jeonjin Bobeop) - Forward step\n * - back: 후퇴보법 (Hutoe Bobeop) - Retreat step\n * - left: 좌측면보법 (Jwacheuk Myeon Bobeop) - Left side step\n * - right: 우측면보법 (Ucheuk Myeon Bobeop) - Right side step\n * - forward_left: 전좌측보법 (Jeon Jwacheuk Bobeop) - Forward-left diagonal\n * - forward_right: 전우측보법 (Jeon Ucheuk Bobeop) - Forward-right diagonal\n * - back_left: 후좌측보법 (Hu Jwacheuk Bobeop) - Back-left diagonal\n * - back_right: 후우측보법 (Hu Ucheuk Bobeop) - Back-right diagonal\n *\n * Each step moves exactly 30cm (one foot width) for tactical repositioning\n * in Korean martial arts combat.\n *\n * @korean 발걸음방향\n */\nexport type StepDirection =\n | \"forward\"\n | \"back\"\n | \"left\"\n | \"right\"\n | \"forward_left\"\n | \"forward_right\"\n | \"back_left\"\n | \"back_right\";\n\n/**\n * Step animation configuration\n *\n * Defines keyframes for tactical step movements with:\n * - Weight transfer from back foot to front foot\n * - Foot lift and placement\n * - Guard position maintenance\n * - 30cm distance movement\n * - 300ms duration (18 frames at 60fps)\n *\n * @korean 발걸음애니메이션설정\n */\nexport interface StepConfig extends AnimationConfig {\n /**\n * Step direction\n * @korean 방향\n */\n readonly direction: StepDirection;\n\n /**\n * Distance moved in meters (always 0.3m = 30cm)\n * @korean 이동거리\n */\n readonly distance: number;\n\n /**\n * Whether guard position is maintained during step\n * @korean 방어자세유지\n */\n readonly maintainsGuard: boolean;\n\n /**\n * Stamina cost for this step\n * @korean 체력소모\n */\n readonly staminaCost: number;\n}\n\n/**\n * Step keyframe data for animation interpolation\n *\n * Defines weight distribution, foot positions, and body center of gravity\n * at specific frames during the step animation.\n *\n * @korean 발걸음키프레임\n */\nexport interface StepKeyframe {\n /**\n * Frame number (0-17 for 18-frame step)\n * @korean 프레임번호\n */\n readonly frame: number;\n\n /**\n * Weight distribution (0 = fully on back foot, 1 = fully on front foot)\n * @korean 체중분배\n */\n readonly weight: number;\n\n /**\n * Front foot position offset from start (0-1, where 1 = full step distance)\n * @korean 앞발위치\n */\n readonly frontFootOffset: number;\n\n /**\n * Back foot position offset from start (0-1)\n * @korean 뒷발위치\n */\n readonly backFootOffset: number;\n\n /**\n * Vertical lift of front foot in meters\n * @korean 앞발들어올림\n */\n readonly frontFootLift: number;\n\n /**\n * Body center of gravity height offset\n * @korean 무게중심높이\n */\n readonly cogHeight: number;\n}\n\n/**\n * Fall direction types for knockdown animations\n *\n * Determines which fall animation to play based on attack direction,\n * balance loss, or consciousness failure.\n *\n * Korean terminology:\n * - forward: 전방낙법 (Jeonbang Nakbeop) - Forward falling technique\n * - backward: 후방낙법 (Hubang Nakbeop) - Backward falling technique\n * - side_left: 좌측낙법 (Jwacheuk Nakbeop) - Left side falling technique\n * - side_right: 우측낙법 (Ucheuk Nakbeop) - Right side falling technique\n *\n * @korean 낙법유형\n */\nexport type FallType = \"forward\" | \"backward\" | \"side_left\" | \"side_right\";\n\n/**\n * Ground position states after falling\n *\n * Represents the character's position on the ground after a fall.\n * Each state has a looping breathing animation.\n *\n * Korean terminology:\n * - prone: 엎드림 (Eopdeurim) - Face down position\n * - supine: 누움 (Nuum) - Face up position\n * - side_left: 좌측와 (Jwacheuk Wa) - Left side position\n * - side_right: 우측와 (Ucheuk Wa) - Right side position\n *\n * @korean 지면자세\n */\nexport type GroundState = \"prone\" | \"supine\" | \"side_left\" | \"side_right\";\n\n/**\n * Maps fall types to corresponding ground states\n *\n * @korean 낙법지면맵\n */\nexport const FALL_TO_GROUND_MAP: Record<FallType, GroundState> = {\n forward: \"prone\",\n backward: \"supine\",\n side_left: \"side_left\",\n side_right: \"side_right\",\n};\n\n/**\n * Maps fall types to corresponding animation states\n *\n * @korean 낙법애니메이션맵\n */\nexport const FALL_TYPE_TO_ANIMATION: Record<FallType, AnimationState> = {\n forward: AnimationState.FALL_FORWARD,\n backward: AnimationState.FALL_BACKWARD,\n side_left: AnimationState.FALL_SIDE_LEFT,\n side_right: AnimationState.FALL_SIDE_RIGHT,\n};\n\n/**\n * Maps ground states to corresponding animation states\n *\n * @korean 지면애니메이션맵\n */\nexport const GROUND_STATE_TO_ANIMATION: Record<GroundState, AnimationState> = {\n prone: AnimationState.GROUND_PRONE,\n supine: AnimationState.GROUND_SUPINE,\n side_left: AnimationState.GROUND_SIDE_LEFT,\n side_right: AnimationState.GROUND_SIDE_RIGHT,\n};\n\n/**\n * Body facing direction system state\n *\n * Manages automatic character rotation to face opponent with:\n * - Smooth torso rotation (45°/sec, ±90° range)\n * - Independent head tracking (±45° range)\n * - 180° turn animations for repositioning\n * - Facing lock during attack/defend animations\n *\n * Korean terminology:\n * - 정면향하기 (Jeongmyeon Hyanghagi) - Face forward\n * - 몸회전 (Mom Hoejeon) - Body rotation\n * - 머리추적 (Meori Chujok) - Head tracking\n * - 180도회전 (180-do Hoejeon) - 180-degree turn\n *\n * @korean 몸향하기상태\n */\nexport interface BodyFacing {\n /**\n * Current facing direction in degrees (0-360)\n * - 0° = facing right (+X axis)\n * - 90° = facing down (+Z axis)\n * - 180° = facing left (-X axis)\n * - 270° = facing up (-Z axis)\n *\n * @korean 현재각도\n */\n readonly currentAngle: number;\n\n /**\n * Desired facing direction in degrees (0-360)\n * Typically pointing toward opponent position\n *\n * @korean 목표각도\n */\n readonly targetAngle: number;\n\n /**\n * Rotation speed in degrees per second\n * Default: 45°/sec for smooth, realistic rotation\n *\n * @korean 회전속도\n */\n readonly rotationSpeed: number;\n\n /**\n * Head rotation offset relative to torso (-45° to +45°)\n * Head can track independently within limited range\n * - Positive = head turned right\n * - Negative = head turned left\n *\n * @korean 머리회전각도\n */\n readonly headAngleOffset: number;\n\n /**\n * Whether facing direction is locked\n * True during attack/defend animations to lock attack direction\n * False during idle/movement to allow dynamic tracking\n *\n * @korean 회전잠금\n */\n readonly isLocked: boolean;\n\n /**\n * Whether character is currently executing a 180° turn animation\n * Used to prevent movement and other actions during repositioning\n *\n * @korean 180도회전중\n */\n readonly isTurning: boolean;\n\n /**\n * Direction of current 180° turn ('left' or 'right')\n * Determines which turn animation to play\n *\n * @korean 회전방향\n */\n readonly turnDirection?: \"left\" | \"right\";\n\n /**\n * Timestamp when 180° turn animation started\n * Used to track turn animation progress (200ms duration)\n *\n * @korean 회전시작시간\n */\n readonly turnStartTime?: number;\n\n /**\n * Torso rotation relative to hips in radians\n * Range: ±π/2 (±90°) for anatomically correct movement\n * - Positive = torso rotated right relative to hips\n * - Negative = torso rotated left relative to hips\n *\n * @korean 허리회전 (Heorhwoejeon)\n */\n readonly torsoRotation?: number;\n\n /**\n * Hip/pelvis rotation in radians (lower body facing direction)\n * Base rotation for the lower body, torsoRotation is relative to this\n *\n * @korean 골반회전 (Golbanhwoejeon)\n */\n readonly hipRotation?: number;\n}\n\n/**\n * Torso rotation state for independent upper/lower body movement\n *\n * Manages realistic torso rotation allowing upper body to face opponent\n * while lower body moves in different direction (strafing).\n *\n * Korean terminology:\n * - 허리회전 (Heorhwoejeon) - Torso rotation\n * - 상체비틀기 (Sangchebiteulgi) - Upper body twist\n * - 골반고정 (Golbangojeong) - Hip stabilization\n *\n * @korean 허리회전상태\n */\nexport interface TorsoRotationState {\n /**\n * Current torso Y-axis rotation in radians\n * Range: ±π/2 (±90°) relative to hip direction\n *\n * @korean 현재회전\n */\n readonly currentRotation: number;\n\n /**\n * Target rotation towards opponent in radians\n * Smoothly interpolated to currentRotation\n *\n * @korean 목표회전\n */\n readonly targetRotation: number;\n\n /**\n * Lower body (hip/pelvis) rotation in radians\n * Base rotation for movement direction\n *\n * @korean 골반회전\n */\n readonly hipRotation: number;\n\n /**\n * Interpolation speed in seconds\n * Default: 0.2 (200ms for smooth rotation)\n *\n * @korean 보간속도\n */\n readonly interpolationSpeed: number;\n}\n\n/**\n * Footwork pattern types for Korean martial arts (보법)\n *\n * Four specialized footwork patterns based on traditional Korean martial arts:\n * - circular: 원형보 (Wonhyeongbo) - Circular stepping while maintaining guard facing\n * - pivot: 축족회전 (Chukjok Hoejeon) - Pivot rotation on planted foot\n * - slide: 미끄럼보 (Mikkeureombo) - Sliding step with both feet moving together\n * - shuffle: 섞음보 (Seokkeumbo) - Quick shuffling micro-adjustment\n *\n * Each pattern serves distinct tactical purposes in combat:\n * - Circular: Lateral repositioning while keeping opponent in guard\n * - Pivot: Fast direction changes on planted foot\n * - Slide: Maintaining stable base while advancing/retreating\n * - Shuffle: Fine-tuning position without commitment\n *\n * @korean 보법유형\n */\nexport type FootworkPattern = \"circular\" | \"pivot\" | \"slide\" | \"shuffle\";\n\n/**\n * Footwork direction for directional patterns\n *\n * @korean 보법방향\n */\nexport type FootworkDirection = \"left\" | \"right\" | \"forward\" | \"back\";\n\n/**\n * Korean terminology for footwork patterns\n *\n * Maps each footwork pattern to its Korean martial arts terminology\n * with romanization and English translation.\n *\n * @korean 보법한글용어\n */\nexport const FOOTWORK_KOREAN_TERMS: Record<\n FootworkPattern,\n { korean: string; romanized: string; english: string }\n> = {\n circular: {\n korean: \"원형보\",\n romanized: \"Wonhyeongbo\",\n english: \"Circular Step\",\n },\n pivot: {\n korean: \"축족회전\",\n romanized: \"Chukjok Hoejeon\",\n english: \"Pivot Rotation\",\n },\n slide: {\n korean: \"미끄럼보\",\n romanized: \"Mikkeureombo\",\n english: \"Sliding Step\",\n },\n shuffle: {\n korean: \"섞음보\",\n romanized: \"Seokkeumbo\",\n english: \"Shuffle Step\",\n },\n};\n\n/**\n * Recovery animation types for getting up from ground states\n *\n * Korean terminology:\n * - prone_standup: 엎드린 기상 (Eopdeurin Gisang) - Stand up from prone\n * - supine_standup: 누운 기상 (Nuun Gisang) - Stand up from supine\n * - roll: 회전기상 (Hoejeon Gisang) - Roll recovery\n * - defensive: 방어기상 (Bangeo Gisang) - Defensive getup\n *\n * @korean 회복애니메이션유형\n */\nexport type RecoveryAnimationType =\n | \"prone_standup\"\n | \"supine_standup\"\n | \"roll_recovery\"\n | \"defensive_getup\";\n\n/**\n * Korean terminology for recovery animations\n *\n * Maps each recovery type to its Korean martial arts terminology\n * with romanization and English translation.\n *\n * @korean 회복한글용어\n */\nexport const RECOVERY_KOREAN_TERMS: Record<\n RecoveryAnimationType,\n { korean: string; romanized: string; english: string }\n> = {\n prone_standup: {\n korean: \"엎드린 기상\",\n romanized: \"Eopdeurin Gisang\",\n english: \"Prone Stand-Up\",\n },\n supine_standup: {\n korean: \"누운 기상\",\n romanized: \"Nuun Gisang\",\n english: \"Supine Stand-Up\",\n },\n roll_recovery: {\n korean: \"회전기상\",\n romanized: \"Hoejeon Gisang\",\n english: \"Roll Recovery\",\n },\n defensive_getup: {\n korean: \"방어기상\",\n romanized: \"Bangeo Gisang\",\n english: \"Defensive Getup\",\n },\n};\n\n/**\n * Maps ground states to their default recovery animation\n *\n * @korean 지면회복맵\n */\nexport const GROUND_STATE_TO_RECOVERY: Record<\n GroundState,\n RecoveryAnimationType\n> = {\n prone: \"prone_standup\",\n supine: \"supine_standup\",\n side_left: \"roll_recovery\", // Side positions use roll by default\n side_right: \"roll_recovery\",\n};\n\n/**\n * Maps recovery types to their animation states\n *\n * @korean 회복애니메이션맵\n */\nexport const RECOVERY_TYPE_TO_ANIMATION: Record<\n RecoveryAnimationType,\n AnimationState\n> = {\n prone_standup: AnimationState.RECOVERY_PRONE_STANDUP,\n supine_standup: AnimationState.RECOVERY_SUPINE_STANDUP,\n roll_recovery: AnimationState.RECOVERY_ROLL,\n defensive_getup: AnimationState.RECOVERY_DEFENSIVE,\n};\n\n/**\n * Technique intensity levels for animation speed and impact\n *\n * **Korean**: 기술 강도 레벨\n *\n * Determines animation speed modifier and visual impact effects:\n * - light: Fast techniques (1.2x speed), lower damage\n * - medium: Normal techniques (1.0x speed), standard damage\n * - heavy: Powerful techniques (0.8x speed), high damage\n * - critical: Maximum power (0.6x speed), critical damage\n *\n * @category Animation\n * @korean 기술강도\n */\nexport type TechniqueIntensity = \"light\" | \"medium\" | \"heavy\" | \"critical\";\n\n/**\n * Technique type categories for animation selection\n *\n * **Korean**: 기술 유형\n *\n * Core technique categories that determine base animation style:\n * - strike: Direct striking attacks (punches, palm strikes)\n * - joint: Joint manipulation and locks\n * - throw: Throwing and sweeping techniques\n * - pressure_point: Precise vital point strikes\n *\n * @category Combat\n * @korean 기술타입\n */\nexport type TechniqueTypeCategory =\n | \"strike\"\n | \"joint\"\n | \"throw\"\n | \"pressure_point\";\n\n/**\n * Composite key for technique animation lookup\n *\n * **Korean**: 기술 애니메이션 키\n *\n * Combines stance, technique type, target body part, and intensity\n * to uniquely identify the appropriate animation to play.\n *\n * @example\n * ```typescript\n * const key: TechniqueAnimationKey = {\n * stance: TrigramStance.GEON,\n * techniqueType: 'strike',\n * bodyPart: BodyPart.HEAD,\n * intensity: 'heavy',\n * };\n * ```\n *\n * @category Animation\n * @korean 기술애니메이션키\n */\nexport interface TechniqueAnimationKey {\n /** Trigram stance (8 stances) */\n readonly stance: string;\n /** Technique category */\n readonly techniqueType: TechniqueTypeCategory;\n /** Target body part */\n readonly bodyPart: string;\n /** Attack intensity level */\n readonly intensity: TechniqueIntensity;\n}\n\n/**\n * Complete technique animation configuration\n *\n * **Korean**: 기술 애니메이션 설정\n *\n * Defines all properties needed to execute a technique animation,\n * including timing, impact frame, Korean terminology, and priority.\n *\n * @example\n * ```typescript\n * const animation: TechniqueAnimation = {\n * animationState: AnimationState.ATTACK,\n * duration: 0.8,\n * impactFrame: 12,\n * recoveryFrames: 15,\n * priority: 8,\n * koreanName: '건괘 두부 강 타격',\n * englishName: 'Heaven Stance Head Strike',\n * };\n * ```\n *\n * @category Animation\n * @korean 기술애니메이션\n */\nexport interface TechniqueAnimation {\n /** Animation state to play */\n readonly animationState: AnimationState;\n /** Duration in seconds */\n readonly duration: number;\n /** Frame number where hit lands (0-indexed) */\n readonly impactFrame: number;\n /** Number of recovery frames after impact */\n readonly recoveryFrames: number;\n /** Animation priority for interrupt system */\n readonly priority: AnimationPriority;\n /** Korean technique name */\n readonly koreanName: string;\n /** English technique name */\n readonly englishName: string;\n\n // ===== Advanced Joint Movement Properties (고급 관절 동작) =====\n\n /**\n * Torso rotation angle in radians relative to hips\n *\n * **Korean**: 허리회전 (Heorhwoejeon)\n *\n * Range: -π/2 to π/2 (-90° to 90°)\n * Used for independent upper/lower body movement\n *\n * @korean 허리회전각도\n */\n readonly torsoRotation?: number;\n\n /**\n * Hip rotation engagement factor (0-1)\n *\n * **Korean**: 골반회전 참여도 (Golbanhwoejeon Chamyeodo)\n *\n * - 0.0: No hip engagement (isolated technique)\n * - 0.3: Minimal hip involvement\n * - 0.6: Moderate hip rotation\n * - 1.0: Full hip engagement (maximum power)\n *\n * Contributes 10-30% damage bonus based on technique type\n *\n * @korean 골반회전도\n */\n readonly hipEngagement?: number;\n\n /**\n * Power modifier from hip rotation (calculated)\n *\n * **Korean**: 파워배율 (Pawo Baeyul)\n *\n * Multiplier applied to technique damage (1.0-1.3)\n * Calculated from hipEngagement and techniqueType\n *\n * @korean 파워배율\n */\n readonly powerModifier?: number;\n}\n\n/**\n * Validation result for technique animation mapping completeness\n *\n * **Korean**: 기술 애니메이션 매핑 검증 결과\n *\n * Reports coverage percentage and lists any missing mappings\n * that need to be filled in.\n *\n * @category Animation\n * @korean 매핑검증결과\n */\nexport interface MappingValidationResult {\n /** Coverage percentage (0-100) */\n readonly coverage: number;\n /** Total combinations expected */\n readonly total: number;\n /** Number of mapped combinations */\n readonly mapped: number;\n /** List of missing combinations */\n readonly missing: readonly TechniqueAnimationKey[];\n}\n\n// ===== Backward Compatibility Helpers (하위 호환성 도우미) =====\n\n/**\n * Convert string to AnimationState enum (backward compatibility)\n *\n * **Korean**: 문자열을 애니메이션 상태로 변환\n *\n * Provides backward compatibility for code using string-based animation states.\n * Returns null if the string doesn't match any valid animation state.\n *\n * @param state - String representation of animation state\n * @returns AnimationState enum or null if invalid\n *\n * @example\n * ```typescript\n * const state = stringToAnimationState(\"idle\"); // AnimationState.IDLE\n * const invalid = stringToAnimationState(\"invalid\"); // null\n * ```\n *\n * @korean 문자열을애니메이션상태로변환\n */\nexport function stringToAnimationState(state: string): AnimationState | null {\n const normalized = state.toLowerCase();\n\n // Check if the normalized string is a valid AnimationState enum value\n const values = Object.values(AnimationState) as string[];\n if (values.includes(normalized)) {\n return normalized as AnimationState;\n }\n\n return null;\n}\n\n/**\n * Check if a value is a valid AnimationState enum\n *\n * **Korean**: 유효한 애니메이션 상태인지 확인\n *\n * Type guard to validate that a value is a valid AnimationState enum value.\n *\n * @param value - Value to check\n * @returns True if value is a valid AnimationState\n *\n * @example\n * ```typescript\n * if (isValidAnimationState(someValue)) {\n * // TypeScript knows someValue is AnimationState here\n * machine.transitionTo(someValue);\n * }\n * ```\n *\n * @korean 유효한애니메이션상태확인\n */\nexport function isValidAnimationState(value: unknown): value is AnimationState {\n if (typeof value !== \"string\") {\n return false;\n }\n\n const values = Object.values(AnimationState) as string[];\n return values.includes(value);\n}\n\n/**\n * Get all animation state enum values as an array\n *\n * **Korean**: 모든 애니메이션 상태 값 배열\n *\n * Returns an array of all valid AnimationState enum values.\n * Useful for iteration, validation, and testing.\n *\n * @returns Array of all AnimationState values\n *\n * @example\n * ```typescript\n * const allStates = getAllAnimationStates();\n * allStates.forEach(state => {\n * console.log(`State: ${state}`);\n * });\n * ```\n *\n * @korean 모든애니메이션상태가져오기\n */\nexport function getAllAnimationStates(): AnimationState[] {\n return Object.values(AnimationState);\n}\n\n/**\n * Check if an animation state is a stance guard state\n *\n * **Korean**: 자세 방어 상태인지 확인\n *\n * Determines if the given animation state is one of the eight trigram\n * stance guard animations.\n *\n * @param state - Animation state to check\n * @returns True if state is a stance guard animation\n *\n * @example\n * ```typescript\n * if (isStanceGuardState(AnimationState.STANCE_GUARD_GEON)) {\n * // Handle stance guard logic\n * }\n * ```\n *\n * @korean 자세방어상태확인\n */\nexport function isStanceGuardState(state: AnimationState): boolean {\n return state.startsWith(\"stance_guard_\");\n}\n\n/**\n * Check if an animation state is a step movement state\n *\n * **Korean**: 발걸음 이동 상태인지 확인\n *\n * Determines if the given animation state is one of the tactical step\n * movement animations.\n *\n * @param state - Animation state to check\n * @returns True if state is a step movement animation\n *\n * @example\n * ```typescript\n * if (isStepState(AnimationState.STEP_FORWARD)) {\n * // Handle step movement logic\n * }\n * ```\n *\n * @korean 발걸음상태확인\n */\nexport function isStepState(state: AnimationState): boolean {\n return state.startsWith(\"step_\");\n}\n\n/**\n * Check if an animation state is a footwork pattern state\n *\n * **Korean**: 보법 패턴 상태인지 확인\n *\n * Determines if the given animation state is one of the specialized\n * Korean martial arts footwork patterns.\n *\n * @param state - Animation state to check\n * @returns True if state is a footwork pattern animation\n *\n * @example\n * ```typescript\n * if (isFootworkState(AnimationState.FOOTWORK_CIRCULAR_LEFT)) {\n * // Handle footwork pattern logic\n * }\n * ```\n *\n * @korean 보법상태확인\n */\nexport function isFootworkState(state: AnimationState): boolean {\n return state.startsWith(\"footwork_\");\n}\n\n/**\n * Check if an animation state is a fall animation state\n *\n * **Korean**: 낙법 애니메이션 상태인지 확인\n *\n * Determines if the given animation state is one of the fall animations.\n *\n * @param state - Animation state to check\n * @returns True if state is a fall animation\n *\n * @example\n * ```typescript\n * if (isFallState(AnimationState.FALL_FORWARD)) {\n * // Handle fall animation logic\n * }\n * ```\n *\n * @korean 낙법상태확인\n */\nexport function isFallState(state: AnimationState): boolean {\n return state.startsWith(\"fall_\");\n}\n\n/**\n * Check if an animation state is a ground position state\n *\n * **Korean**: 지면 자세 상태인지 확인\n *\n * Determines if the given animation state is one of the ground position\n * breathing loops.\n *\n * @param state - Animation state to check\n * @returns True if state is a ground position animation\n *\n * @example\n * ```typescript\n * if (isGroundState(AnimationState.GROUND_PRONE)) {\n * // Handle ground position logic\n * }\n * ```\n *\n * @korean 지면상태확인\n */\nexport function isGroundState(state: AnimationState): boolean {\n return state.startsWith(\"ground_\");\n}\n\n/**\n * Check if an animation state is a recovery animation state\n *\n * **Korean**: 회복 애니메이션 상태인지 확인\n *\n * Determines if the given animation state is one of the recovery/getup\n * animations.\n *\n * @param state - Animation state to check\n * @returns True if state is a recovery animation\n *\n * @example\n * ```typescript\n * if (isRecoveryState(AnimationState.RECOVERY_ROLL)) {\n * // Handle recovery animation logic\n * }\n * ```\n *\n * @korean 회복상태확인\n */\nexport function isRecoveryState(state: AnimationState): boolean {\n return state.startsWith(\"recovery_\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,IAAa,iCAAiC,IAAI;;;;;;;;;AAiBlD,IAAa,qCAAqC;;;;;;;;;;;;;;;;AAiBlD,IAAY,iBAAL,yBAAA,gBAAA;;;;;;CAQL,eAAA,UAAA;;;;;;CAOA,eAAA,UAAA;;;;;;CAOA,eAAA,SAAA;;;;;;CASA,eAAA,YAAA;;;;;;CAOA,eAAA,YAAA;;;;;;CAOA,eAAA,0BAAA;;;;;;CAOA,eAAA,kBAAA;;;;;;CAOA,eAAA,wBAAA;;;;;;CAOA,eAAA,qBAAA;;;;;;CAOA,eAAA,SAAA;;;;;;CAOA,eAAA,QAAA;;;;;;CASA,eAAA,mBAAA;;;;;;CAOA,eAAA,wBAAA;;;;;;CASA,eAAA,uBAAA;;;;;;CAOA,eAAA,sBAAA;;;;;;CAOA,eAAA,qBAAA;;;;;;CAOA,eAAA,sBAAA;;;;;;CAOA,eAAA,sBAAA;;;;;;CAOA,eAAA,sBAAA;;;;;;CAOA,eAAA,sBAAA;;;;;;CAOA,eAAA,sBAAA;;;;;;CASA,eAAA,kBAAA;;;;;;CAOA,eAAA,eAAA;;;;;;CAOA,eAAA,eAAA;;;;;;CAOA,eAAA,gBAAA;;;;;;CAOA,eAAA,uBAAA;;;;;;CAOA,eAAA,wBAAA;;;;;;CAOA,eAAA,oBAAA;;;;;;CAOA,eAAA,qBAAA;;;;;;CASA,eAAA,4BAAA;;;;;;CAOA,eAAA,6BAAA;;;;;;CAOA,eAAA,yBAAA;;;;;;CAOA,eAAA,0BAAA;;;;;;CAOA,eAAA,4BAAA;;;;;;CAOA,eAAA,yBAAA;;;;;;CAOA,eAAA,yBAAA;;;;;;CAOA,eAAA,0BAAA;;;;;;CAOA,eAAA,sBAAA;;;;;;CASA,eAAA,kBAAA;;;;;;CAOA,eAAA,mBAAA;;;;;;CAOA,eAAA,oBAAA;;;;;;CAOA,eAAA,qBAAA;;;;;;CASA,eAAA,kBAAA;;;;;;CAOA,eAAA,mBAAA;;;;;;CAOA,eAAA,sBAAA;;;;;;CAOA,eAAA,uBAAA;;;;;;CASA,eAAA,eAAA;;;;;;CAOA,eAAA,gBAAA;;;;;;CASA,eAAA,4BAAA;;;;;;CAOA,eAAA,6BAAA;;;;;;CAOA,eAAA,mBAAA;;;;;;CAOA,eAAA,wBAAA;;;;;;;;;CAYA,eAAA,mBAAA;;;;;;;;;;CAWA,eAAA,qBAAA;;;;;;;;;;CAWA,eAAA,sBAAA;;;;;;;;;;CAWA,eAAA,oBAAA;;AACF,EAAA,CAAA,CAAA;;;;;;;;;;;;;AAcA,IAAY,oBAAL,yBAAA,mBAAA;CACL,kBAAA,kBAAA,UAAA,KAAA;CACA,kBAAA,kBAAA,UAAA,KAAA;CACA,kBAAA,kBAAA,SAAA,KAAA;CACA,kBAAA,kBAAA,mBAAA,KAAA;CACA,kBAAA,kBAAA,YAAA,KAAA;CACA,kBAAA,kBAAA,YAAA,KAAA;CACA,kBAAA,kBAAA,SAAA,KAAA;CACA,kBAAA,kBAAA,QAAA,KAAA;CACA,kBAAA,kBAAA,UAAA,KAAA;CACA,kBAAA,kBAAA,cAAA,KAAA;;AACF,EAAA,CAAA,CAAA;;;;;;AAgaA,IAAa,qBAAoD;CAC/D,SAAS;CACT,UAAU;CACV,WAAW;CACX,YAAY;AACd;;;;;;AAOA,IAAa,yBAA2D;CACtE,SAAA;CACA,UAAA;CACA,WAAA;CACA,YAAA;AACF;;;;;;;;;AA0MA,IAAa,wBAGT;CACF,UAAU;EACR,QAAQ;EACR,WAAW;EACX,SAAS;CACX;CACA,OAAO;EACL,QAAQ;EACR,WAAW;EACX,SAAS;CACX;CACA,OAAO;EACL,QAAQ;EACR,WAAW;EACX,SAAS;CACX;CACA,SAAS;EACP,QAAQ;EACR,WAAW;EACX,SAAS;CACX;AACF;;;;;;AA0DA,IAAa,2BAGT;CACF,OAAO;CACP,QAAQ;CACR,WAAW;CACX,YAAY;AACd;;;;;;AAOA,IAAa,6BAGT;CACF,eAAA;CACA,gBAAA;CACA,eAAA;CACA,iBAAA;AACF;;;;;;;;;;;;;;;;;;;;AAgWA,SAAgB,YAAY,OAAgC;CAC1D,OAAO,MAAM,WAAW,OAAO;AACjC;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAgB,cAAc,OAAgC;CAC5D,OAAO,MAAM,WAAW,SAAS;AACnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AdvancedJointMovements.js","names":[],"sources":["../../../../src/systems/animation/systems/AdvancedJointMovements.ts"],"sourcesContent":["/**\n * Advanced Joint Movement System for Korean Martial Arts\n * \n * Extends the base skeletal animation system with specialized joint movements\n * for authentic martial arts technique execution:\n * - Hip rotation for kicks (고관절 회전)\n * - Shoulder elevation/depression (어깨 들어올림)\n * - Ankle articulation (발목 관절)\n * - Wrist snap mechanics (손목 스냅)\n * - Knee drive positioning (무릎 밀어올림)\n * - Spinal flexion/extension (척추 굽힘)\n * \n * @module systems/animation/AdvancedJointMovements\n * @category Animation System\n * @korean 고급관절동작시스템\n */\n\nimport * as THREE from \"three\";\n\n/**\n * Body side for limb-specific movements\n * \n * @korean 신체측면\n */\nexport type BodySide = 'left' | 'right';\n\n/**\n * Kick technique types for hip rotation calculation\n * \n * Korean terminology:\n * - front: 앞차기 (Apchagi)\n * - roundhouse: 돌려차기 (Dollyeochagi)\n * - side: 옆차기 (Yeopchagi)\n * - hook: 후려차기 (Huryeochagi)\n * - axe: 내려차기 (Naeryeochagi)\n * \n * @korean 차기기술유형\n */\nexport type KickType = 'front' | 'roundhouse' | 'side' | 'hook' | 'axe';\n\n/**\n * Hand strike technique types for wrist snap calculation\n * \n * Korean terminology:\n * - backfist: 등주먹 (Deungjumeok)\n * - knife-hand: 수도 (Sudo)\n * - palm-heel: 장저 (Jangjeo)\n * - ridge-hand: 손날등 (Sonnaldeung)\n * - hammer-fist: 망치주먹 (Mangchijumeok)\n * \n * @korean 수격기술유형\n */\nexport type HandStrikeType = 'backfist' | 'knife-hand' | 'palm-heel' | 'ridge-hand' | 'hammer-fist';\n\n/**\n * Kick height levels for hip rotation scaling\n * \n * Korean terminology:\n * - 0: 하단 (Hadan) - Low section\n * - 1: 중단 (Jungdan) - Middle section\n * - 2: 상단 (Sangdan) - High section\n * \n * @korean 차기높이\n */\nexport type KickHeight = 0 | 1 | 2;\n\n/**\n * Technique execution phases\n * \n * Korean terminology:\n * - chamber: 준비 (Junbi) - Preparation/chamber\n * - extension: 확장 (Hwakjang) - Extension\n * - retraction: 회수 (Hoesu) - Retraction\n * \n * @korean 기술단계\n */\nexport type TechniquePhase = 'chamber' | 'extension' | 'retraction';\n\n/**\n * Strike execution phases\n * \n * Korean terminology:\n * - wind-up: 예비동작 (Yebi Dongjak) - Wind-up\n * - impact: 타격 (Tagyeok) - Impact\n * - follow-through: 후속동작 (Husok Dongjak) - Follow-through\n * \n * @korean 타격단계\n */\nexport type StrikePhase = 'wind-up' | 'impact' | 'follow-through';\n\n/**\n * Block and overhead technique types for shoulder elevation\n * \n * Korean terminology:\n * - high-block: 상단막기 (Sangdan Makgi)\n * - overhead-strike: 상단공격 (Sangdan Gonggyeok)\n * - rising-block: 올려막기 (Ollyeo Makgi)\n * - shrug: 어깨올리기 (Eokkae Olligi)\n * - neutral: 중립 (Jungnip)\n * \n * @korean 어깨기술유형\n */\nexport type ShoulderTechniqueType = 'high-block' | 'overhead-strike' | 'rising-block' | 'shrug' | 'neutral';\n\n/**\n * Shoulder and block technique execution phases\n * \n * Korean terminology:\n * - preparation: 준비 (Junbi)\n * - execution: 실행 (Silhaeng)\n * - recovery: 복귀 (Bokgwi)\n * \n * @korean 어깨단계\n */\nexport type ShoulderPhase = 'preparation' | 'execution' | 'recovery';\n\n/**\n * Spinal movement types for dodging and positioning\n * \n * Korean terminology:\n * - duck: 숙이기 (Sugigi) - Duck down\n * - lean-back: 뒤로기울기 (Dwiro Giulgi) - Lean back\n * - lean-left: 왼쪽기울기 (Oenjjok Giulgi) - Lean left\n * - lean-right: 오른쪽기울기 (Oreunjjok Giulgi) - Lean right\n * - low-attack: 낮은공격 (Najeun Gonggyeok) - Low attack\n * - neutral: 중립 (Jungnip) - Neutral\n * \n * @korean 척추동작유형\n */\nexport type SpinalMovementType = 'duck' | 'lean-back' | 'lean-left' | 'lean-right' | 'low-attack' | 'neutral';\n\n/**\n * Knee drive technique types for close-range combat\n * \n * Korean terminology:\n * - knee-strike: 무릎차기 (Mureup Chagi)\n * - clinch-control: 붙잡기제어 (Butjapgi Jeeo)\n * - push-kick: 밀어차기 (Mireo Chagi)\n * - neutral: 중립 (Jungnip)\n * \n * @korean 무릎기술유형\n */\nexport type KneeTechniqueType = 'knee-strike' | 'clinch-control' | 'push-kick' | 'neutral';\n\n/**\n * Knee technique execution phases\n * \n * Korean terminology:\n * - wind-up: 예비동작 (Yebi Dongjak)\n * - execution: 실행 (Silhaeng)\n * - recovery: 복귀 (Bokgwi)\n * \n * @korean 무릎단계\n */\nexport type KneePhase = 'wind-up' | 'execution' | 'recovery';\n\n/**\n * Hip rotation state for dynamic kick mechanics\n * \n * Tracks independent hip rotation in multiple planes for realistic\n * high kicks, roundhouse kicks, and hook kicks. Separates hip rotation\n * from pelvis rotation for authentic martial arts biomechanics.\n * \n * Korean: 고관절 회전 상태\n * \n */\nexport interface HipRotationState {\n /**\n * Frontal plane rotation (abduction/adduction) in radians\n * - Positive: Leg moves away from body centerline (abduction)\n * - Negative: Leg moves toward centerline (adduction)\n * Range: ±1.8 rad (±103°) for high kicks\n * \n * @korean 외전각도\n */\n readonly frontalRotation: number;\n\n /**\n * Sagittal plane rotation (flexion/extension) in radians\n * - Positive: Leg moves forward (flexion)\n * - Negative: Leg moves backward (extension)\n * Range: -1.8 to 1.8 rad for kicks\n * \n * @korean 굴곡각도\n */\n readonly sagittalRotation: number;\n\n /**\n * Transverse plane rotation (internal/external rotation) in radians\n * - Positive: Thigh rotates inward\n * - Negative: Thigh rotates outward\n * Range: ±0.8 rad (±46°)\n * \n * @korean 회전각도\n */\n readonly transverseRotation: number;\n\n /**\n * Which hip (left or right)\n * @korean 측면\n */\n readonly side: BodySide;\n}\n\n/**\n * Shoulder elevation/depression state for blocks and overhead strikes\n * \n * Tracks vertical shoulder movement independent of arm rotation.\n * Essential for authentic blocking mechanics and overhead techniques.\n * \n * Korean: 어깨 들어올림 상태\n * \n */\nexport interface ShoulderElevationState {\n /**\n * Vertical displacement in meters\n * - Positive: Shoulder elevated (shrug)\n * - Negative: Shoulder depressed (drop)\n * Range: ±0.05 m (±5cm)\n * \n * @korean 수직변위\n */\n readonly elevation: number;\n\n /**\n * Which shoulder (left or right)\n * @korean 측면\n */\n readonly side: BodySide;\n}\n\n/**\n * Ankle articulation state for kick chambers and pivots\n * \n * Tracks ankle joint positioning crucial for proper kick mechanics\n * and pivoting in Korean martial arts.\n * \n * Korean: 발목 관절 상태\n * \n */\nexport interface AnkleArticulationState {\n /**\n * Dorsiflexion/plantarflexion angle in radians\n * - Positive: Toes point up (dorsiflexion)\n * - Negative: Toes point down (plantarflexion)\n * Range: -0.8 to 0.5 rad\n * \n * @korean 발등굽힘각도\n */\n readonly flexion: number;\n\n /**\n * Inversion/eversion angle in radians\n * Range: ±0.4 rad (±23°)\n * \n * @korean 안쪽굽힘각도\n */\n readonly inversion: number;\n\n /**\n * Which ankle (left or right)\n * @korean 측면\n */\n readonly side: BodySide;\n}\n\n/**\n * Wrist snap state for rapid hand strikes\n * \n * Tracks rapid wrist rotation mechanics essential for backfist,\n * knife-hand, and other Korean martial arts hand techniques.\n * \n * Korean: 손목 스냅 상태\n * \n */\nexport interface WristSnapState {\n /**\n * Rotation angle in radians\n * Range: ±1.5 rad (±86°)\n * \n * @korean 회전각도\n */\n readonly rotation: number;\n\n /**\n * Snap velocity in rad/s (for power calculation)\n * @korean 회전속도\n */\n readonly velocity: number;\n\n /**\n * Which wrist (left or right)\n * @korean 측면\n */\n readonly side: BodySide;\n}\n\n/**\n * Knee drive state for clinch work and knee strikes\n * \n * Tracks independent knee positioning crucial for close-range\n * combat and knee strike techniques.\n * \n * Korean: 무릎 밀어올림 상태\n * \n */\nexport interface KneeDriveState {\n /**\n * Drive height in meters (vertical displacement)\n * Range: 0 to 0.8 m (80cm max lift)\n * \n * @korean 들어올림높이\n */\n readonly height: number;\n\n /**\n * Forward drive distance in meters\n * Range: 0 to 0.3 m (30cm)\n * \n * @korean 전방거리\n */\n readonly forward: number;\n\n /**\n * Which knee (left or right)\n * @korean 측면\n */\n readonly side: BodySide;\n}\n\n/**\n * Spinal flexion/extension state for dodges and low attacks\n * \n * Tracks forward/backward bending of spine for defensive\n * movements and low attack positioning.\n * \n * Korean: 척추 굽힘 상태\n * \n */\nexport interface SpinalFlexionState {\n /**\n * Flexion angle in radians (forward/backward bend)\n * - Positive: Forward bend\n * - Negative: Backward bend\n * Range: -0.5 to 0.8 rad\n * \n * @korean 굽힘각도\n */\n readonly flexion: number;\n\n /**\n * Lateral bend in radians (side to side)\n * Range: ±0.3 rad (±17°)\n * \n * @korean 측면굽힘각도\n */\n readonly lateralBend: number;\n}\n\n/**\n * Advanced joint movement constraints\n * \n * Defines anatomically correct limits for all advanced joint movements\n * based on human biomechanics and Korean martial arts techniques.\n * \n * @korean 고급관절제약조건\n */\nexport const ADVANCED_JOINT_CONSTRAINTS = {\n /**\n * Hip rotation constraints for kicks\n * @korean 고관절제약조건\n */\n HIP_ROTATION: {\n FRONTAL_MIN: -1.8, // -103° adduction\n FRONTAL_MAX: 1.8, // 103° abduction\n SAGITTAL_MIN: -1.8, // -103° extension\n SAGITTAL_MAX: 1.8, // 103° flexion\n TRANSVERSE_MIN: -0.8, // -46° external rotation\n TRANSVERSE_MAX: 0.8, // 46° internal rotation\n },\n\n /**\n * Shoulder elevation constraints\n * @korean 어깨들어올림제약조건\n */\n SHOULDER_ELEVATION: {\n MIN: -0.05, // -5cm depression\n MAX: 0.05, // 5cm elevation\n },\n\n /**\n * Ankle articulation constraints\n * @korean 발목관절제약조건\n */\n ANKLE_ARTICULATION: {\n FLEXION_MIN: -0.8, // -46° plantarflexion\n FLEXION_MAX: 0.5, // 29° dorsiflexion\n INVERSION_MIN: -0.4, // -23° eversion\n INVERSION_MAX: 0.4, // 23° inversion\n },\n\n /**\n * Wrist snap constraints\n * @korean 손목스냅제약조건\n */\n WRIST_SNAP: {\n ROTATION_MIN: -1.5, // -86°\n ROTATION_MAX: 1.5, // 86°\n MAX_VELOCITY: 30.0, // 30 rad/s for power strikes\n },\n\n /**\n * Knee drive constraints\n * @korean 무릎밀어올림제약조건\n */\n KNEE_DRIVE: {\n HEIGHT_MIN: 0, // Ground level\n HEIGHT_MAX: 0.8, // 80cm max lift\n FORWARD_MIN: 0,\n FORWARD_MAX: 0.3, // 30cm forward\n },\n\n /**\n * Spinal flexion constraints\n * @korean 척추굽힘제약조건\n */\n SPINAL_FLEXION: {\n FLEXION_MIN: -0.5, // -29° extension (backward)\n FLEXION_MAX: 0.8, // 46° flexion (forward)\n LATERAL_MIN: -0.3, // -17° left bend\n LATERAL_MAX: 0.3, // 17° right bend\n },\n} as const;\n\n/**\n * Calculate hip rotation for kick mechanics\n * \n * Determines optimal hip rotation angles for various kick types,\n * ensuring anatomically correct positioning and maximum power generation.\n * \n * @param kickType - Type of kick being performed\n * @param targetHeight - Target height for kick (0=low, 1=medium, 2=high)\n * @param side - Which leg is kicking\n * @returns Hip rotation state with all three plane rotations\n * \n * @example\n * ```typescript\n * const hipState = calculateHipRotationForKick('roundhouse', 2, 'right');\n * // Returns frontal: 1.5, sagittal: 1.3, transverse: 0.6 for high roundhouse\n * ```\n * \n * @korean 차기용고관절회전계산\n */\nexport function calculateHipRotationForKick(\n kickType: KickType,\n targetHeight: KickHeight,\n side: BodySide\n): HipRotationState {\n let frontalRotation = 0;\n let sagittalRotation = 0;\n let transverseRotation = 0;\n\n // Height multiplier (more rotation needed for higher kicks)\n const heightMultiplier = targetHeight === 0 ? 0.5 : targetHeight === 1 ? 0.75 : 1.0;\n\n switch (kickType) {\n case 'front':\n // Front kick: primarily sagittal plane (forward)\n sagittalRotation = 1.5 * heightMultiplier;\n frontalRotation = 0.2; // Slight abduction for balance\n transverseRotation = 0;\n break;\n\n case 'roundhouse':\n // Roundhouse: combination of frontal abduction and transverse rotation\n frontalRotation = 1.5 * heightMultiplier;\n sagittalRotation = 0.8 * heightMultiplier;\n transverseRotation = 0.6 * heightMultiplier; // Internal rotation for power\n break;\n\n case 'side':\n // Side kick: primarily frontal plane (abduction)\n frontalRotation = 1.6 * heightMultiplier;\n sagittalRotation = 0.3;\n transverseRotation = -0.4; // External rotation for proper foot alignment\n break;\n\n case 'hook':\n // Hook kick: high abduction with forward component\n frontalRotation = 1.7 * heightMultiplier;\n sagittalRotation = 1.2 * heightMultiplier;\n transverseRotation = 0.5;\n break;\n\n case 'axe':\n // Axe kick: maximum sagittal flexion, some abduction\n frontalRotation = 0.8 * heightMultiplier;\n sagittalRotation = 1.8 * heightMultiplier; // Maximum forward flexion\n transverseRotation = 0.2;\n break;\n }\n\n // Apply constraints\n frontalRotation = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.HIP_ROTATION.FRONTAL_MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.HIP_ROTATION.FRONTAL_MAX, frontalRotation)\n );\n sagittalRotation = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.HIP_ROTATION.SAGITTAL_MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.HIP_ROTATION.SAGITTAL_MAX, sagittalRotation)\n );\n transverseRotation = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.HIP_ROTATION.TRANSVERSE_MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.HIP_ROTATION.TRANSVERSE_MAX, transverseRotation)\n );\n\n return {\n frontalRotation,\n sagittalRotation,\n transverseRotation,\n side,\n };\n}\n\n/**\n * Calculate kick power modifier from hip rotation\n * \n * Determines power bonus based on proper hip rotation technique.\n * Greater rotation in the correct planes generates more power.\n * \n * @param hipState - Current hip rotation state\n * @param kickType - Type of kick\n * @returns Power multiplier (1.0-1.40x, with kicks getting up to 40% bonus)\n * \n * @example\n * ```typescript\n * const hipState = calculateHipRotationForKick('roundhouse', 2, 'right');\n * const power = calculateKickPowerFromHipRotation(hipState, 'roundhouse');\n * // Returns ~1.35 for properly executed high roundhouse\n * ```\n * \n * @korean 고관절회전에서차기파워계산\n */\nexport function calculateKickPowerFromHipRotation(\n hipState: HipRotationState,\n kickType: KickType\n): number {\n // Normalize rotations to 0-1 range based on constraints\n const normalizedFrontal = Math.abs(hipState.frontalRotation) / \n ADVANCED_JOINT_CONSTRAINTS.HIP_ROTATION.FRONTAL_MAX;\n const normalizedSagittal = Math.abs(hipState.sagittalRotation) / \n ADVANCED_JOINT_CONSTRAINTS.HIP_ROTATION.SAGITTAL_MAX;\n const normalizedTransverse = Math.abs(hipState.transverseRotation) / \n ADVANCED_JOINT_CONSTRAINTS.HIP_ROTATION.TRANSVERSE_MAX;\n\n // Different kicks benefit from different rotation planes\n let powerFactor = 0;\n switch (kickType) {\n case 'front':\n powerFactor = normalizedSagittal * 0.8 + normalizedFrontal * 0.2;\n break;\n case 'roundhouse':\n powerFactor = normalizedFrontal * 0.5 + normalizedTransverse * 0.3 + normalizedSagittal * 0.2;\n break;\n case 'side':\n powerFactor = normalizedFrontal * 0.7 + normalizedTransverse * 0.3;\n break;\n case 'hook':\n powerFactor = normalizedFrontal * 0.4 + normalizedSagittal * 0.4 + normalizedTransverse * 0.2;\n break;\n case 'axe':\n powerFactor = normalizedSagittal * 0.8 + normalizedFrontal * 0.2;\n break;\n }\n\n // Kicks can get up to 40% power bonus from proper hip rotation\n return 1.0 + (powerFactor * 0.40);\n}\n\n/**\n * Apply hip rotation to Three.js Euler angles\n * \n * Converts hip rotation state into Three.js Euler angles for rendering.\n * \n * @param hipState - Hip rotation state\n * @returns Three.js Euler angles (X=sagittal, Y=transverse, Z=frontal)\n * \n * @korean 고관절회전을오일러각으로적용\n */\nexport function applyHipRotationToEuler(hipState: HipRotationState): THREE.Euler {\n return new THREE.Euler(\n hipState.sagittalRotation, // X-axis: forward/backward\n hipState.transverseRotation, // Y-axis: twist\n hipState.frontalRotation, // Z-axis: side to side\n 'XYZ'\n );\n}\n\n/**\n * Calculate ankle articulation for kick chamber\n * \n * Determines proper ankle positioning for kick chambering and extension,\n * crucial for proper foot alignment and power transfer in Korean martial arts.\n * \n * @param kickType - Type of kick being chambered\n * @param phase - Kick phase: 'chamber', 'extension', 'retraction'\n * @param side - Which ankle\n * @returns Ankle articulation state with flexion and inversion angles\n * \n * @example\n * ```typescript\n * const ankleState = calculateAnkleArticulation('front', 'extension', 'right');\n * // Returns: { flexion: 0.5, inversion: 0, side: 'right' }\n * ```\n * \n * @korean 차기챔버용발목관절계산\n */\nexport function calculateAnkleArticulation(\n kickType: KickType,\n phase: TechniquePhase,\n side: BodySide\n): AnkleArticulationState {\n let flexion = 0;\n let inversion = 0;\n\n switch (kickType) {\n case 'front':\n if (phase === 'chamber') {\n flexion = 0.2; // Slight dorsiflexion in chamber\n } else if (phase === 'extension') {\n flexion = 0.5; // Strong dorsiflexion for striking with ball of foot\n } else {\n flexion = 0.1; // Slight flexion during retraction\n }\n inversion = 0; // Neutral for front kicks\n break;\n\n case 'roundhouse':\n if (phase === 'chamber') {\n flexion = -0.3; // Plantarflexion in chamber\n } else if (phase === 'extension') {\n flexion = -0.5; // Strong plantarflexion for instep strike\n inversion = -0.2; // Slight eversion to align instep\n } else {\n flexion = -0.2;\n inversion = 0;\n }\n break;\n\n case 'side':\n if (phase === 'chamber') {\n flexion = 0.3; // Dorsiflexion in chamber\n } else if (phase === 'extension') {\n flexion = 0.4; // Dorsiflexion for heel/blade strike\n inversion = 0.3; // Inversion to present blade edge\n } else {\n flexion = 0.2;\n inversion = 0.1;\n }\n break;\n\n case 'hook':\n if (phase === 'chamber') {\n flexion = -0.2;\n } else if (phase === 'extension') {\n flexion = -0.4; // Plantarflexion for heel strike\n inversion = -0.15; // Slight eversion\n } else {\n flexion = -0.1;\n inversion = 0;\n }\n break;\n\n case 'axe':\n if (phase === 'chamber') {\n flexion = 0.1; // Minimal flexion in high chamber\n } else if (phase === 'extension') {\n flexion = 0.5; // Strong dorsiflexion for downward strike\n } else {\n flexion = 0.2;\n }\n inversion = 0; // Neutral for axe kicks\n break;\n }\n\n // Apply constraints\n flexion = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.ANKLE_ARTICULATION.FLEXION_MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.ANKLE_ARTICULATION.FLEXION_MAX, flexion)\n );\n inversion = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.ANKLE_ARTICULATION.INVERSION_MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.ANKLE_ARTICULATION.INVERSION_MAX, inversion)\n );\n\n return { flexion, inversion, side };\n}\n\n/**\n * Calculate wrist snap for hand strikes\n * \n * Determines wrist rotation and velocity for power generation in\n * backfist, knife-hand, and other Korean martial arts hand techniques.\n * \n * @param strikeType - Type of hand strike\n * @param phase - Strike phase: 'wind-up', 'impact', 'follow-through'\n * @param side - Which wrist\n * @returns Wrist snap state with rotation angle and velocity\n * \n * @example\n * ```typescript\n * const wristState = calculateWristSnap('backfist', 'impact', 'right');\n * // Returns: { rotation: 1.2, velocity: 25.0, side: 'right' }\n * ```\n * \n * @korean 수격용손목스냅계산\n */\nexport function calculateWristSnap(\n strikeType: HandStrikeType,\n phase: StrikePhase,\n side: BodySide\n): WristSnapState {\n let rotation = 0;\n let velocity = 0;\n\n switch (strikeType) {\n case 'backfist':\n if (phase === 'wind-up') {\n rotation = -0.8; // Cocked back\n velocity = 0;\n } else if (phase === 'impact') {\n rotation = 1.2; // Snapped forward\n velocity = 25.0; // High velocity snap\n } else {\n rotation = 0.5;\n velocity = 5.0;\n }\n break;\n\n case 'knife-hand':\n if (phase === 'wind-up') {\n rotation = -0.5;\n velocity = 0;\n } else if (phase === 'impact') {\n rotation = 0.8; // Moderate snap for precision\n velocity = 20.0;\n } else {\n rotation = 0.3;\n velocity = 3.0;\n }\n break;\n\n case 'palm-heel':\n if (phase === 'wind-up') {\n rotation = -0.3; // Minimal wind-up\n velocity = 0;\n } else if (phase === 'impact') {\n rotation = 0.5; // Push through\n velocity = 15.0; // Lower velocity, more push\n } else {\n rotation = 0.2;\n velocity = 2.0;\n }\n break;\n\n case 'ridge-hand':\n if (phase === 'wind-up') {\n rotation = 0.8; // Opposite direction\n velocity = 0;\n } else if (phase === 'impact') {\n rotation = -1.0; // Reverse snap\n velocity = 22.0;\n } else {\n rotation = -0.4;\n velocity = 4.0;\n }\n break;\n\n case 'hammer-fist':\n if (phase === 'wind-up') {\n rotation = 0.2; // Minimal rotation\n velocity = 0;\n } else if (phase === 'impact') {\n rotation = 0.3; // Downward strike, less rotation\n velocity = 18.0;\n } else {\n rotation = 0.1;\n velocity = 2.0;\n }\n break;\n }\n\n // Apply constraints\n rotation = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.WRIST_SNAP.ROTATION_MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.WRIST_SNAP.ROTATION_MAX, rotation)\n );\n velocity = Math.min(ADVANCED_JOINT_CONSTRAINTS.WRIST_SNAP.MAX_VELOCITY, Math.abs(velocity));\n\n return { rotation, velocity, side };\n}\n\n/**\n * Calculate wrist snap power modifier\n * \n * Determines power bonus based on wrist snap velocity and rotation.\n * Higher velocity generates more power for whipping strikes.\n * \n * @param wristState - Current wrist snap state\n * @returns Power multiplier (1.0-1.25x, with hand strikes getting up to 25% bonus)\n * \n * @example\n * ```typescript\n * const wristState = calculateWristSnap('backfist', 'impact', 'right');\n * const power = calculateWristSnapPowerModifier(wristState);\n * // Returns ~1.20 for proper backfist snap\n * ```\n * \n * @korean 손목스냅파워배율계산\n */\nexport function calculateWristSnapPowerModifier(wristState: WristSnapState): number {\n // Normalize velocity to 0-1 range\n const normalizedVelocity = wristState.velocity / ADVANCED_JOINT_CONSTRAINTS.WRIST_SNAP.MAX_VELOCITY;\n \n // Normalize rotation magnitude to 0-1 range\n const normalizedRotation = Math.abs(wristState.rotation) / ADVANCED_JOINT_CONSTRAINTS.WRIST_SNAP.ROTATION_MAX;\n \n // Velocity contributes 70%, rotation contributes 30%\n const powerFactor = (normalizedVelocity * 0.7) + (normalizedRotation * 0.3);\n \n // Hand strikes get up to 25% power bonus from wrist snap\n return 1.0 + (powerFactor * 0.25);\n}\n\n/**\n * Calculate shoulder elevation for blocks and overhead strikes\n * \n * Determines vertical shoulder movement for defensive blocks and\n * overhead striking techniques in Korean martial arts.\n * \n * @param techniqueType - Type of technique requiring shoulder movement\n * @param phase - Technique phase\n * @param side - Which shoulder\n * @returns Shoulder elevation state with vertical displacement\n * \n * @example\n * ```typescript\n * const shoulderState = calculateShoulderElevation('high-block', 'execution', 'left');\n * // Returns: { elevation: 0.04, side: 'left' }\n * ```\n * \n * @korean 블록및상단공격용어깨들어올림계산\n */\nexport function calculateShoulderElevation(\n techniqueType: ShoulderTechniqueType,\n phase: ShoulderPhase,\n side: BodySide\n): ShoulderElevationState {\n let elevation = 0;\n\n switch (techniqueType) {\n case 'high-block':\n if (phase === 'preparation') {\n elevation = -0.02; // Slight drop before elevation\n } else if (phase === 'execution') {\n elevation = 0.04; // Elevate for high block\n } else {\n elevation = 0.01; // Slight elevation maintained\n }\n break;\n\n case 'overhead-strike':\n if (phase === 'preparation') {\n elevation = 0.03; // Pre-elevation for wind-up\n } else if (phase === 'execution') {\n elevation = 0.05; // Maximum elevation for overhead power\n } else {\n elevation = 0.01;\n }\n break;\n\n case 'rising-block':\n if (phase === 'preparation') {\n elevation = -0.03; // Lower for rising motion\n } else if (phase === 'execution') {\n elevation = 0.04; // Elevate as block rises\n } else {\n elevation = 0.02;\n }\n break;\n\n case 'shrug':\n if (phase === 'execution') {\n elevation = 0.05; // Maximum elevation for defensive shrug\n } else {\n elevation = 0;\n }\n break;\n\n case 'neutral':\n elevation = 0;\n break;\n }\n\n // Apply constraints\n elevation = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.SHOULDER_ELEVATION.MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.SHOULDER_ELEVATION.MAX, elevation)\n );\n\n return { elevation, side };\n}\n\n/**\n * Calculate spinal flexion for dodges and low attacks\n * \n * Determines forward/backward and lateral bending of spine for\n * defensive movements and low attack positioning.\n * \n * @param movementType - Type of movement requiring spinal flexion\n * @param intensity - Movement intensity (0=minimal, 1=full)\n * @returns Spinal flexion state with flexion and lateral bend angles\n * \n * @example\n * ```typescript\n * const spineState = calculateSpinalFlexion('duck', 0.8);\n * // Returns: { flexion: 0.6, lateralBend: 0 }\n * ```\n * \n * @korean 회피및하단공격용척추굽힘계산\n */\nexport function calculateSpinalFlexion(\n movementType: SpinalMovementType,\n intensity: number = 1.0\n): SpinalFlexionState {\n let flexion = 0;\n let lateralBend = 0;\n\n // Clamp intensity to 0-1 range\n intensity = Math.max(0, Math.min(1, intensity));\n\n switch (movementType) {\n case 'duck':\n flexion = 0.7 * intensity; // Forward bend for ducking\n lateralBend = 0;\n break;\n\n case 'lean-back':\n flexion = -0.4 * intensity; // Backward bend for evasion\n lateralBend = 0;\n break;\n\n case 'lean-left':\n flexion = 0.1 * intensity; // Slight forward component\n lateralBend = -0.25 * intensity; // Left lateral bend\n break;\n\n case 'lean-right':\n flexion = 0.1 * intensity;\n lateralBend = 0.25 * intensity; // Right lateral bend\n break;\n\n case 'low-attack':\n flexion = 0.5 * intensity; // Forward bend for low strikes\n lateralBend = 0;\n break;\n\n case 'neutral':\n flexion = 0;\n lateralBend = 0;\n break;\n }\n\n // Apply constraints\n flexion = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.SPINAL_FLEXION.FLEXION_MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.SPINAL_FLEXION.FLEXION_MAX, flexion)\n );\n lateralBend = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.SPINAL_FLEXION.LATERAL_MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.SPINAL_FLEXION.LATERAL_MAX, lateralBend)\n );\n\n return { flexion, lateralBend };\n}\n\n/**\n * Calculate knee drive for knee strikes and clinch\n * \n * Determines independent knee positioning for close-range combat,\n * crucial for knee strike power and clinch work positioning.\n * \n * @param technique - Technique requiring knee drive\n * @param phase - Technique phase\n * @param side - Which knee\n * @returns Knee drive state with height and forward distance\n * \n * @example\n * ```typescript\n * const kneeState = calculateKneeDrive('knee-strike', 'execution', 'right');\n * // Returns: { height: 0.7, forward: 0.25, side: 'right' }\n * ```\n * \n * @korean 무릎차기및클린치용무릎밀어올림계산\n */\nexport function calculateKneeDrive(\n technique: KneeTechniqueType,\n phase: KneePhase,\n side: BodySide\n): KneeDriveState {\n let height = 0;\n let forward = 0;\n\n switch (technique) {\n case 'knee-strike':\n if (phase === 'wind-up') {\n height = 0.3; // Partial chamber\n forward = 0.1;\n } else if (phase === 'execution') {\n height = 0.7; // Drive upward\n forward = 0.25; // Drive forward for power\n } else {\n height = 0.2;\n forward = 0.05;\n }\n break;\n\n case 'clinch-control':\n if (phase === 'execution') {\n height = 0.4; // Moderate elevation for control\n forward = 0.15; // Forward pressure\n } else {\n height = 0.2;\n forward = 0.08;\n }\n break;\n\n case 'push-kick':\n if (phase === 'wind-up') {\n height = 0.5; // High chamber\n forward = 0.05;\n } else if (phase === 'execution') {\n height = 0.6; // Maintain height\n forward = 0.3; // Strong forward drive\n } else {\n height = 0.3;\n forward = 0.1;\n }\n break;\n\n case 'neutral':\n height = 0;\n forward = 0;\n break;\n }\n\n // Apply constraints\n height = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.KNEE_DRIVE.HEIGHT_MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.KNEE_DRIVE.HEIGHT_MAX, height)\n );\n forward = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.KNEE_DRIVE.FORWARD_MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.KNEE_DRIVE.FORWARD_MAX, forward)\n );\n\n return { height, forward, side };\n}\n\n/**\n * Calculate knee strike power modifier\n * \n * Determines power bonus based on knee drive height and forward momentum.\n * Greater drive generates more power through proper mechanics.\n * \n * @param kneeState - Current knee drive state\n * @returns Power multiplier (1.0-1.35x, with knee strikes getting up to 35% bonus)\n * \n * @example\n * ```typescript\n * const kneeState = calculateKneeDrive('knee-strike', 'execution', 'right');\n * const power = calculateKneeStrikePowerModifier(kneeState);\n * // Returns ~1.30 for properly executed knee strike\n * ```\n * \n * @korean 무릎차기파워배율계산\n */\nexport function calculateKneeStrikePowerModifier(kneeState: KneeDriveState): number {\n // Normalize height to 0-1 range\n const normalizedHeight = kneeState.height / ADVANCED_JOINT_CONSTRAINTS.KNEE_DRIVE.HEIGHT_MAX;\n \n // Normalize forward drive to 0-1 range\n const normalizedForward = kneeState.forward / ADVANCED_JOINT_CONSTRAINTS.KNEE_DRIVE.FORWARD_MAX;\n \n // Height contributes 60%, forward drive contributes 40%\n const powerFactor = (normalizedHeight * 0.6) + (normalizedForward * 0.4);\n \n // Knee strikes get up to 35% power bonus from proper drive\n return 1.0 + (powerFactor * 0.35);\n}\n\n"],"mappings":";;;;;;;;;;AA+WA,IAAa,6BAA6B;;;;;CAKxC,cAAc;EACZ,aAAa;EACb,aAAa;EACb,cAAc;EACd,cAAc;EACd,gBAAgB;EAChB,gBAAgB;EACjB;;;;;CAMD,oBAAoB;EAClB,KAAK;EACL,KAAK;EACN;;;;;CAMD,oBAAoB;EAClB,aAAa;EACb,aAAa;EACb,eAAe;EACf,eAAe;EAChB;;;;;CAMD,YAAY;EACV,cAAc;EACd,cAAc;EACd,cAAc;EACf;;;;;CAMD,YAAY;EACV,YAAY;EACZ,YAAY;EACZ,aAAa;EACb,aAAa;EACd;;;;;CAMD,gBAAgB;EACd,aAAa;EACb,aAAa;EACb,aAAa;EACb,aAAa;EACd;CACF;;;;;;;;;;;;;;;;;;;;AA+GD,SAAgB,kCACd,UACA,UACQ;CAER,MAAM,oBAAoB,KAAK,IAAI,SAAS,gBAAgB,GAC1D,2BAA2B,aAAa;CAC1C,MAAM,qBAAqB,KAAK,IAAI,SAAS,iBAAiB,GAC5D,2BAA2B,aAAa;CAC1C,MAAM,uBAAuB,KAAK,IAAI,SAAS,mBAAmB,GAChE,2BAA2B,aAAa;CAG1C,IAAI,cAAc;CAClB,QAAQ,UAAR;EACE,KAAK;GACH,cAAc,qBAAqB,KAAM,oBAAoB;GAC7D;EACF,KAAK;GACH,cAAc,oBAAoB,KAAM,uBAAuB,KAAM,qBAAqB;GAC1F;EACF,KAAK;GACH,cAAc,oBAAoB,KAAM,uBAAuB;GAC/D;EACF,KAAK;GACH,cAAc,oBAAoB,KAAM,qBAAqB,KAAM,uBAAuB;GAC1F;EACF,KAAK;GACH,cAAc,qBAAqB,KAAM,oBAAoB;GAC7D;;CAIJ,OAAO,IAAO,cAAc"}
1
+ {"version":3,"file":"AdvancedJointMovements.js","names":[],"sources":["../../../../src/systems/animation/systems/AdvancedJointMovements.ts"],"sourcesContent":["/**\n * Advanced Joint Movement System for Korean Martial Arts\n * \n * Extends the base skeletal animation system with specialized joint movements\n * for authentic martial arts technique execution:\n * - Hip rotation for kicks (고관절 회전)\n * - Shoulder elevation/depression (어깨 들어올림)\n * - Ankle articulation (발목 관절)\n * - Wrist snap mechanics (손목 스냅)\n * - Knee drive positioning (무릎 밀어올림)\n * - Spinal flexion/extension (척추 굽힘)\n * \n * @module systems/animation/AdvancedJointMovements\n * @category Animation System\n * @korean 고급관절동작시스템\n */\n\nimport * as THREE from \"three\";\n\n/**\n * Body side for limb-specific movements\n * \n * @korean 신체측면\n */\nexport type BodySide = 'left' | 'right';\n\n/**\n * Kick technique types for hip rotation calculation\n * \n * Korean terminology:\n * - front: 앞차기 (Apchagi)\n * - roundhouse: 돌려차기 (Dollyeochagi)\n * - side: 옆차기 (Yeopchagi)\n * - hook: 후려차기 (Huryeochagi)\n * - axe: 내려차기 (Naeryeochagi)\n * \n * @korean 차기기술유형\n */\nexport type KickType = 'front' | 'roundhouse' | 'side' | 'hook' | 'axe';\n\n/**\n * Hand strike technique types for wrist snap calculation\n * \n * Korean terminology:\n * - backfist: 등주먹 (Deungjumeok)\n * - knife-hand: 수도 (Sudo)\n * - palm-heel: 장저 (Jangjeo)\n * - ridge-hand: 손날등 (Sonnaldeung)\n * - hammer-fist: 망치주먹 (Mangchijumeok)\n * \n * @korean 수격기술유형\n */\nexport type HandStrikeType = 'backfist' | 'knife-hand' | 'palm-heel' | 'ridge-hand' | 'hammer-fist';\n\n/**\n * Kick height levels for hip rotation scaling\n * \n * Korean terminology:\n * - 0: 하단 (Hadan) - Low section\n * - 1: 중단 (Jungdan) - Middle section\n * - 2: 상단 (Sangdan) - High section\n * \n * @korean 차기높이\n */\nexport type KickHeight = 0 | 1 | 2;\n\n/**\n * Technique execution phases\n * \n * Korean terminology:\n * - chamber: 준비 (Junbi) - Preparation/chamber\n * - extension: 확장 (Hwakjang) - Extension\n * - retraction: 회수 (Hoesu) - Retraction\n * \n * @korean 기술단계\n */\nexport type TechniquePhase = 'chamber' | 'extension' | 'retraction';\n\n/**\n * Strike execution phases\n * \n * Korean terminology:\n * - wind-up: 예비동작 (Yebi Dongjak) - Wind-up\n * - impact: 타격 (Tagyeok) - Impact\n * - follow-through: 후속동작 (Husok Dongjak) - Follow-through\n * \n * @korean 타격단계\n */\nexport type StrikePhase = 'wind-up' | 'impact' | 'follow-through';\n\n/**\n * Block and overhead technique types for shoulder elevation\n * \n * Korean terminology:\n * - high-block: 상단막기 (Sangdan Makgi)\n * - overhead-strike: 상단공격 (Sangdan Gonggyeok)\n * - rising-block: 올려막기 (Ollyeo Makgi)\n * - shrug: 어깨올리기 (Eokkae Olligi)\n * - neutral: 중립 (Jungnip)\n * \n * @korean 어깨기술유형\n */\nexport type ShoulderTechniqueType = 'high-block' | 'overhead-strike' | 'rising-block' | 'shrug' | 'neutral';\n\n/**\n * Shoulder and block technique execution phases\n * \n * Korean terminology:\n * - preparation: 준비 (Junbi)\n * - execution: 실행 (Silhaeng)\n * - recovery: 복귀 (Bokgwi)\n * \n * @korean 어깨단계\n */\nexport type ShoulderPhase = 'preparation' | 'execution' | 'recovery';\n\n/**\n * Spinal movement types for dodging and positioning\n * \n * Korean terminology:\n * - duck: 숙이기 (Sugigi) - Duck down\n * - lean-back: 뒤로기울기 (Dwiro Giulgi) - Lean back\n * - lean-left: 왼쪽기울기 (Oenjjok Giulgi) - Lean left\n * - lean-right: 오른쪽기울기 (Oreunjjok Giulgi) - Lean right\n * - low-attack: 낮은공격 (Najeun Gonggyeok) - Low attack\n * - neutral: 중립 (Jungnip) - Neutral\n * \n * @korean 척추동작유형\n */\nexport type SpinalMovementType = 'duck' | 'lean-back' | 'lean-left' | 'lean-right' | 'low-attack' | 'neutral';\n\n/**\n * Knee drive technique types for close-range combat\n * \n * Korean terminology:\n * - knee-strike: 무릎차기 (Mureup Chagi)\n * - clinch-control: 붙잡기제어 (Butjapgi Jeeo)\n * - push-kick: 밀어차기 (Mireo Chagi)\n * - neutral: 중립 (Jungnip)\n * \n * @korean 무릎기술유형\n */\nexport type KneeTechniqueType = 'knee-strike' | 'clinch-control' | 'push-kick' | 'neutral';\n\n/**\n * Knee technique execution phases\n * \n * Korean terminology:\n * - wind-up: 예비동작 (Yebi Dongjak)\n * - execution: 실행 (Silhaeng)\n * - recovery: 복귀 (Bokgwi)\n * \n * @korean 무릎단계\n */\nexport type KneePhase = 'wind-up' | 'execution' | 'recovery';\n\n/**\n * Hip rotation state for dynamic kick mechanics\n * \n * Tracks independent hip rotation in multiple planes for realistic\n * high kicks, roundhouse kicks, and hook kicks. Separates hip rotation\n * from pelvis rotation for authentic martial arts biomechanics.\n * \n * Korean: 고관절 회전 상태\n * \n */\nexport interface HipRotationState {\n /**\n * Frontal plane rotation (abduction/adduction) in radians\n * - Positive: Leg moves away from body centerline (abduction)\n * - Negative: Leg moves toward centerline (adduction)\n * Range: ±1.8 rad (±103°) for high kicks\n * \n * @korean 외전각도\n */\n readonly frontalRotation: number;\n\n /**\n * Sagittal plane rotation (flexion/extension) in radians\n * - Positive: Leg moves forward (flexion)\n * - Negative: Leg moves backward (extension)\n * Range: -1.8 to 1.8 rad for kicks\n * \n * @korean 굴곡각도\n */\n readonly sagittalRotation: number;\n\n /**\n * Transverse plane rotation (internal/external rotation) in radians\n * - Positive: Thigh rotates inward\n * - Negative: Thigh rotates outward\n * Range: ±0.8 rad (±46°)\n * \n * @korean 회전각도\n */\n readonly transverseRotation: number;\n\n /**\n * Which hip (left or right)\n * @korean 측면\n */\n readonly side: BodySide;\n}\n\n/**\n * Shoulder elevation/depression state for blocks and overhead strikes\n * \n * Tracks vertical shoulder movement independent of arm rotation.\n * Essential for authentic blocking mechanics and overhead techniques.\n * \n * Korean: 어깨 들어올림 상태\n * \n */\nexport interface ShoulderElevationState {\n /**\n * Vertical displacement in meters\n * - Positive: Shoulder elevated (shrug)\n * - Negative: Shoulder depressed (drop)\n * Range: ±0.05 m (±5cm)\n * \n * @korean 수직변위\n */\n readonly elevation: number;\n\n /**\n * Which shoulder (left or right)\n * @korean 측면\n */\n readonly side: BodySide;\n}\n\n/**\n * Ankle articulation state for kick chambers and pivots\n * \n * Tracks ankle joint positioning crucial for proper kick mechanics\n * and pivoting in Korean martial arts.\n * \n * Korean: 발목 관절 상태\n * \n */\nexport interface AnkleArticulationState {\n /**\n * Dorsiflexion/plantarflexion angle in radians\n * - Positive: Toes point up (dorsiflexion)\n * - Negative: Toes point down (plantarflexion)\n * Range: -0.8 to 0.5 rad\n * \n * @korean 발등굽힘각도\n */\n readonly flexion: number;\n\n /**\n * Inversion/eversion angle in radians\n * Range: ±0.4 rad (±23°)\n * \n * @korean 안쪽굽힘각도\n */\n readonly inversion: number;\n\n /**\n * Which ankle (left or right)\n * @korean 측면\n */\n readonly side: BodySide;\n}\n\n/**\n * Wrist snap state for rapid hand strikes\n * \n * Tracks rapid wrist rotation mechanics essential for backfist,\n * knife-hand, and other Korean martial arts hand techniques.\n * \n * Korean: 손목 스냅 상태\n * \n */\nexport interface WristSnapState {\n /**\n * Rotation angle in radians\n * Range: ±1.5 rad (±86°)\n * \n * @korean 회전각도\n */\n readonly rotation: number;\n\n /**\n * Snap velocity in rad/s (for power calculation)\n * @korean 회전속도\n */\n readonly velocity: number;\n\n /**\n * Which wrist (left or right)\n * @korean 측면\n */\n readonly side: BodySide;\n}\n\n/**\n * Knee drive state for clinch work and knee strikes\n * \n * Tracks independent knee positioning crucial for close-range\n * combat and knee strike techniques.\n * \n * Korean: 무릎 밀어올림 상태\n * \n */\nexport interface KneeDriveState {\n /**\n * Drive height in meters (vertical displacement)\n * Range: 0 to 0.8 m (80cm max lift)\n * \n * @korean 들어올림높이\n */\n readonly height: number;\n\n /**\n * Forward drive distance in meters\n * Range: 0 to 0.3 m (30cm)\n * \n * @korean 전방거리\n */\n readonly forward: number;\n\n /**\n * Which knee (left or right)\n * @korean 측면\n */\n readonly side: BodySide;\n}\n\n/**\n * Spinal flexion/extension state for dodges and low attacks\n * \n * Tracks forward/backward bending of spine for defensive\n * movements and low attack positioning.\n * \n * Korean: 척추 굽힘 상태\n * \n */\nexport interface SpinalFlexionState {\n /**\n * Flexion angle in radians (forward/backward bend)\n * - Positive: Forward bend\n * - Negative: Backward bend\n * Range: -0.5 to 0.8 rad\n * \n * @korean 굽힘각도\n */\n readonly flexion: number;\n\n /**\n * Lateral bend in radians (side to side)\n * Range: ±0.3 rad (±17°)\n * \n * @korean 측면굽힘각도\n */\n readonly lateralBend: number;\n}\n\n/**\n * Advanced joint movement constraints\n * \n * Defines anatomically correct limits for all advanced joint movements\n * based on human biomechanics and Korean martial arts techniques.\n * \n * @korean 고급관절제약조건\n */\nexport const ADVANCED_JOINT_CONSTRAINTS = {\n /**\n * Hip rotation constraints for kicks\n * @korean 고관절제약조건\n */\n HIP_ROTATION: {\n FRONTAL_MIN: -1.8, // -103° adduction\n FRONTAL_MAX: 1.8, // 103° abduction\n SAGITTAL_MIN: -1.8, // -103° extension\n SAGITTAL_MAX: 1.8, // 103° flexion\n TRANSVERSE_MIN: -0.8, // -46° external rotation\n TRANSVERSE_MAX: 0.8, // 46° internal rotation\n },\n\n /**\n * Shoulder elevation constraints\n * @korean 어깨들어올림제약조건\n */\n SHOULDER_ELEVATION: {\n MIN: -0.05, // -5cm depression\n MAX: 0.05, // 5cm elevation\n },\n\n /**\n * Ankle articulation constraints\n * @korean 발목관절제약조건\n */\n ANKLE_ARTICULATION: {\n FLEXION_MIN: -0.8, // -46° plantarflexion\n FLEXION_MAX: 0.5, // 29° dorsiflexion\n INVERSION_MIN: -0.4, // -23° eversion\n INVERSION_MAX: 0.4, // 23° inversion\n },\n\n /**\n * Wrist snap constraints\n * @korean 손목스냅제약조건\n */\n WRIST_SNAP: {\n ROTATION_MIN: -1.5, // -86°\n ROTATION_MAX: 1.5, // 86°\n MAX_VELOCITY: 30.0, // 30 rad/s for power strikes\n },\n\n /**\n * Knee drive constraints\n * @korean 무릎밀어올림제약조건\n */\n KNEE_DRIVE: {\n HEIGHT_MIN: 0, // Ground level\n HEIGHT_MAX: 0.8, // 80cm max lift\n FORWARD_MIN: 0,\n FORWARD_MAX: 0.3, // 30cm forward\n },\n\n /**\n * Spinal flexion constraints\n * @korean 척추굽힘제약조건\n */\n SPINAL_FLEXION: {\n FLEXION_MIN: -0.5, // -29° extension (backward)\n FLEXION_MAX: 0.8, // 46° flexion (forward)\n LATERAL_MIN: -0.3, // -17° left bend\n LATERAL_MAX: 0.3, // 17° right bend\n },\n} as const;\n\n/**\n * Calculate hip rotation for kick mechanics\n * \n * Determines optimal hip rotation angles for various kick types,\n * ensuring anatomically correct positioning and maximum power generation.\n * \n * @param kickType - Type of kick being performed\n * @param targetHeight - Target height for kick (0=low, 1=medium, 2=high)\n * @param side - Which leg is kicking\n * @returns Hip rotation state with all three plane rotations\n * \n * @example\n * ```typescript\n * const hipState = calculateHipRotationForKick('roundhouse', 2, 'right');\n * // Returns frontal: 1.5, sagittal: 1.3, transverse: 0.6 for high roundhouse\n * ```\n * \n * @korean 차기용고관절회전계산\n */\nexport function calculateHipRotationForKick(\n kickType: KickType,\n targetHeight: KickHeight,\n side: BodySide\n): HipRotationState {\n let frontalRotation = 0;\n let sagittalRotation = 0;\n let transverseRotation = 0;\n\n // Height multiplier (more rotation needed for higher kicks)\n const heightMultiplier = targetHeight === 0 ? 0.5 : targetHeight === 1 ? 0.75 : 1.0;\n\n switch (kickType) {\n case 'front':\n // Front kick: primarily sagittal plane (forward)\n sagittalRotation = 1.5 * heightMultiplier;\n frontalRotation = 0.2; // Slight abduction for balance\n transverseRotation = 0;\n break;\n\n case 'roundhouse':\n // Roundhouse: combination of frontal abduction and transverse rotation\n frontalRotation = 1.5 * heightMultiplier;\n sagittalRotation = 0.8 * heightMultiplier;\n transverseRotation = 0.6 * heightMultiplier; // Internal rotation for power\n break;\n\n case 'side':\n // Side kick: primarily frontal plane (abduction)\n frontalRotation = 1.6 * heightMultiplier;\n sagittalRotation = 0.3;\n transverseRotation = -0.4; // External rotation for proper foot alignment\n break;\n\n case 'hook':\n // Hook kick: high abduction with forward component\n frontalRotation = 1.7 * heightMultiplier;\n sagittalRotation = 1.2 * heightMultiplier;\n transverseRotation = 0.5;\n break;\n\n case 'axe':\n // Axe kick: maximum sagittal flexion, some abduction\n frontalRotation = 0.8 * heightMultiplier;\n sagittalRotation = 1.8 * heightMultiplier; // Maximum forward flexion\n transverseRotation = 0.2;\n break;\n }\n\n // Apply constraints\n frontalRotation = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.HIP_ROTATION.FRONTAL_MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.HIP_ROTATION.FRONTAL_MAX, frontalRotation)\n );\n sagittalRotation = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.HIP_ROTATION.SAGITTAL_MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.HIP_ROTATION.SAGITTAL_MAX, sagittalRotation)\n );\n transverseRotation = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.HIP_ROTATION.TRANSVERSE_MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.HIP_ROTATION.TRANSVERSE_MAX, transverseRotation)\n );\n\n return {\n frontalRotation,\n sagittalRotation,\n transverseRotation,\n side,\n };\n}\n\n/**\n * Calculate kick power modifier from hip rotation\n * \n * Determines power bonus based on proper hip rotation technique.\n * Greater rotation in the correct planes generates more power.\n * \n * @param hipState - Current hip rotation state\n * @param kickType - Type of kick\n * @returns Power multiplier (1.0-1.40x, with kicks getting up to 40% bonus)\n * \n * @example\n * ```typescript\n * const hipState = calculateHipRotationForKick('roundhouse', 2, 'right');\n * const power = calculateKickPowerFromHipRotation(hipState, 'roundhouse');\n * // Returns ~1.35 for properly executed high roundhouse\n * ```\n * \n * @korean 고관절회전에서차기파워계산\n */\nexport function calculateKickPowerFromHipRotation(\n hipState: HipRotationState,\n kickType: KickType\n): number {\n // Normalize rotations to 0-1 range based on constraints\n const normalizedFrontal = Math.abs(hipState.frontalRotation) / \n ADVANCED_JOINT_CONSTRAINTS.HIP_ROTATION.FRONTAL_MAX;\n const normalizedSagittal = Math.abs(hipState.sagittalRotation) / \n ADVANCED_JOINT_CONSTRAINTS.HIP_ROTATION.SAGITTAL_MAX;\n const normalizedTransverse = Math.abs(hipState.transverseRotation) / \n ADVANCED_JOINT_CONSTRAINTS.HIP_ROTATION.TRANSVERSE_MAX;\n\n // Different kicks benefit from different rotation planes\n let powerFactor = 0;\n switch (kickType) {\n case 'front':\n powerFactor = normalizedSagittal * 0.8 + normalizedFrontal * 0.2;\n break;\n case 'roundhouse':\n powerFactor = normalizedFrontal * 0.5 + normalizedTransverse * 0.3 + normalizedSagittal * 0.2;\n break;\n case 'side':\n powerFactor = normalizedFrontal * 0.7 + normalizedTransverse * 0.3;\n break;\n case 'hook':\n powerFactor = normalizedFrontal * 0.4 + normalizedSagittal * 0.4 + normalizedTransverse * 0.2;\n break;\n case 'axe':\n powerFactor = normalizedSagittal * 0.8 + normalizedFrontal * 0.2;\n break;\n }\n\n // Kicks can get up to 40% power bonus from proper hip rotation\n return 1.0 + (powerFactor * 0.40);\n}\n\n/**\n * Apply hip rotation to Three.js Euler angles\n * \n * Converts hip rotation state into Three.js Euler angles for rendering.\n * \n * @param hipState - Hip rotation state\n * @returns Three.js Euler angles (X=sagittal, Y=transverse, Z=frontal)\n * \n * @korean 고관절회전을오일러각으로적용\n */\nexport function applyHipRotationToEuler(hipState: HipRotationState): THREE.Euler {\n return new THREE.Euler(\n hipState.sagittalRotation, // X-axis: forward/backward\n hipState.transverseRotation, // Y-axis: twist\n hipState.frontalRotation, // Z-axis: side to side\n 'XYZ'\n );\n}\n\n/**\n * Calculate ankle articulation for kick chamber\n * \n * Determines proper ankle positioning for kick chambering and extension,\n * crucial for proper foot alignment and power transfer in Korean martial arts.\n * \n * @param kickType - Type of kick being chambered\n * @param phase - Kick phase: 'chamber', 'extension', 'retraction'\n * @param side - Which ankle\n * @returns Ankle articulation state with flexion and inversion angles\n * \n * @example\n * ```typescript\n * const ankleState = calculateAnkleArticulation('front', 'extension', 'right');\n * // Returns: { flexion: 0.5, inversion: 0, side: 'right' }\n * ```\n * \n * @korean 차기챔버용발목관절계산\n */\nexport function calculateAnkleArticulation(\n kickType: KickType,\n phase: TechniquePhase,\n side: BodySide\n): AnkleArticulationState {\n let flexion = 0;\n let inversion = 0;\n\n switch (kickType) {\n case 'front':\n if (phase === 'chamber') {\n flexion = 0.2; // Slight dorsiflexion in chamber\n } else if (phase === 'extension') {\n flexion = 0.5; // Strong dorsiflexion for striking with ball of foot\n } else {\n flexion = 0.1; // Slight flexion during retraction\n }\n inversion = 0; // Neutral for front kicks\n break;\n\n case 'roundhouse':\n if (phase === 'chamber') {\n flexion = -0.3; // Plantarflexion in chamber\n } else if (phase === 'extension') {\n flexion = -0.5; // Strong plantarflexion for instep strike\n inversion = -0.2; // Slight eversion to align instep\n } else {\n flexion = -0.2;\n inversion = 0;\n }\n break;\n\n case 'side':\n if (phase === 'chamber') {\n flexion = 0.3; // Dorsiflexion in chamber\n } else if (phase === 'extension') {\n flexion = 0.4; // Dorsiflexion for heel/blade strike\n inversion = 0.3; // Inversion to present blade edge\n } else {\n flexion = 0.2;\n inversion = 0.1;\n }\n break;\n\n case 'hook':\n if (phase === 'chamber') {\n flexion = -0.2;\n } else if (phase === 'extension') {\n flexion = -0.4; // Plantarflexion for heel strike\n inversion = -0.15; // Slight eversion\n } else {\n flexion = -0.1;\n inversion = 0;\n }\n break;\n\n case 'axe':\n if (phase === 'chamber') {\n flexion = 0.1; // Minimal flexion in high chamber\n } else if (phase === 'extension') {\n flexion = 0.5; // Strong dorsiflexion for downward strike\n } else {\n flexion = 0.2;\n }\n inversion = 0; // Neutral for axe kicks\n break;\n }\n\n // Apply constraints\n flexion = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.ANKLE_ARTICULATION.FLEXION_MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.ANKLE_ARTICULATION.FLEXION_MAX, flexion)\n );\n inversion = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.ANKLE_ARTICULATION.INVERSION_MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.ANKLE_ARTICULATION.INVERSION_MAX, inversion)\n );\n\n return { flexion, inversion, side };\n}\n\n/**\n * Calculate wrist snap for hand strikes\n * \n * Determines wrist rotation and velocity for power generation in\n * backfist, knife-hand, and other Korean martial arts hand techniques.\n * \n * @param strikeType - Type of hand strike\n * @param phase - Strike phase: 'wind-up', 'impact', 'follow-through'\n * @param side - Which wrist\n * @returns Wrist snap state with rotation angle and velocity\n * \n * @example\n * ```typescript\n * const wristState = calculateWristSnap('backfist', 'impact', 'right');\n * // Returns: { rotation: 1.2, velocity: 25.0, side: 'right' }\n * ```\n * \n * @korean 수격용손목스냅계산\n */\nexport function calculateWristSnap(\n strikeType: HandStrikeType,\n phase: StrikePhase,\n side: BodySide\n): WristSnapState {\n let rotation = 0;\n let velocity = 0;\n\n switch (strikeType) {\n case 'backfist':\n if (phase === 'wind-up') {\n rotation = -0.8; // Cocked back\n velocity = 0;\n } else if (phase === 'impact') {\n rotation = 1.2; // Snapped forward\n velocity = 25.0; // High velocity snap\n } else {\n rotation = 0.5;\n velocity = 5.0;\n }\n break;\n\n case 'knife-hand':\n if (phase === 'wind-up') {\n rotation = -0.5;\n velocity = 0;\n } else if (phase === 'impact') {\n rotation = 0.8; // Moderate snap for precision\n velocity = 20.0;\n } else {\n rotation = 0.3;\n velocity = 3.0;\n }\n break;\n\n case 'palm-heel':\n if (phase === 'wind-up') {\n rotation = -0.3; // Minimal wind-up\n velocity = 0;\n } else if (phase === 'impact') {\n rotation = 0.5; // Push through\n velocity = 15.0; // Lower velocity, more push\n } else {\n rotation = 0.2;\n velocity = 2.0;\n }\n break;\n\n case 'ridge-hand':\n if (phase === 'wind-up') {\n rotation = 0.8; // Opposite direction\n velocity = 0;\n } else if (phase === 'impact') {\n rotation = -1.0; // Reverse snap\n velocity = 22.0;\n } else {\n rotation = -0.4;\n velocity = 4.0;\n }\n break;\n\n case 'hammer-fist':\n if (phase === 'wind-up') {\n rotation = 0.2; // Minimal rotation\n velocity = 0;\n } else if (phase === 'impact') {\n rotation = 0.3; // Downward strike, less rotation\n velocity = 18.0;\n } else {\n rotation = 0.1;\n velocity = 2.0;\n }\n break;\n }\n\n // Apply constraints\n rotation = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.WRIST_SNAP.ROTATION_MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.WRIST_SNAP.ROTATION_MAX, rotation)\n );\n velocity = Math.min(ADVANCED_JOINT_CONSTRAINTS.WRIST_SNAP.MAX_VELOCITY, Math.abs(velocity));\n\n return { rotation, velocity, side };\n}\n\n/**\n * Calculate wrist snap power modifier\n * \n * Determines power bonus based on wrist snap velocity and rotation.\n * Higher velocity generates more power for whipping strikes.\n * \n * @param wristState - Current wrist snap state\n * @returns Power multiplier (1.0-1.25x, with hand strikes getting up to 25% bonus)\n * \n * @example\n * ```typescript\n * const wristState = calculateWristSnap('backfist', 'impact', 'right');\n * const power = calculateWristSnapPowerModifier(wristState);\n * // Returns ~1.20 for proper backfist snap\n * ```\n * \n * @korean 손목스냅파워배율계산\n */\nexport function calculateWristSnapPowerModifier(wristState: WristSnapState): number {\n // Normalize velocity to 0-1 range\n const normalizedVelocity = wristState.velocity / ADVANCED_JOINT_CONSTRAINTS.WRIST_SNAP.MAX_VELOCITY;\n \n // Normalize rotation magnitude to 0-1 range\n const normalizedRotation = Math.abs(wristState.rotation) / ADVANCED_JOINT_CONSTRAINTS.WRIST_SNAP.ROTATION_MAX;\n \n // Velocity contributes 70%, rotation contributes 30%\n const powerFactor = (normalizedVelocity * 0.7) + (normalizedRotation * 0.3);\n \n // Hand strikes get up to 25% power bonus from wrist snap\n return 1.0 + (powerFactor * 0.25);\n}\n\n/**\n * Calculate shoulder elevation for blocks and overhead strikes\n * \n * Determines vertical shoulder movement for defensive blocks and\n * overhead striking techniques in Korean martial arts.\n * \n * @param techniqueType - Type of technique requiring shoulder movement\n * @param phase - Technique phase\n * @param side - Which shoulder\n * @returns Shoulder elevation state with vertical displacement\n * \n * @example\n * ```typescript\n * const shoulderState = calculateShoulderElevation('high-block', 'execution', 'left');\n * // Returns: { elevation: 0.04, side: 'left' }\n * ```\n * \n * @korean 블록및상단공격용어깨들어올림계산\n */\nexport function calculateShoulderElevation(\n techniqueType: ShoulderTechniqueType,\n phase: ShoulderPhase,\n side: BodySide\n): ShoulderElevationState {\n let elevation = 0;\n\n switch (techniqueType) {\n case 'high-block':\n if (phase === 'preparation') {\n elevation = -0.02; // Slight drop before elevation\n } else if (phase === 'execution') {\n elevation = 0.04; // Elevate for high block\n } else {\n elevation = 0.01; // Slight elevation maintained\n }\n break;\n\n case 'overhead-strike':\n if (phase === 'preparation') {\n elevation = 0.03; // Pre-elevation for wind-up\n } else if (phase === 'execution') {\n elevation = 0.05; // Maximum elevation for overhead power\n } else {\n elevation = 0.01;\n }\n break;\n\n case 'rising-block':\n if (phase === 'preparation') {\n elevation = -0.03; // Lower for rising motion\n } else if (phase === 'execution') {\n elevation = 0.04; // Elevate as block rises\n } else {\n elevation = 0.02;\n }\n break;\n\n case 'shrug':\n if (phase === 'execution') {\n elevation = 0.05; // Maximum elevation for defensive shrug\n } else {\n elevation = 0;\n }\n break;\n\n case 'neutral':\n elevation = 0;\n break;\n }\n\n // Apply constraints\n elevation = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.SHOULDER_ELEVATION.MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.SHOULDER_ELEVATION.MAX, elevation)\n );\n\n return { elevation, side };\n}\n\n/**\n * Calculate spinal flexion for dodges and low attacks\n * \n * Determines forward/backward and lateral bending of spine for\n * defensive movements and low attack positioning.\n * \n * @param movementType - Type of movement requiring spinal flexion\n * @param intensity - Movement intensity (0=minimal, 1=full)\n * @returns Spinal flexion state with flexion and lateral bend angles\n * \n * @example\n * ```typescript\n * const spineState = calculateSpinalFlexion('duck', 0.8);\n * // Returns: { flexion: 0.6, lateralBend: 0 }\n * ```\n * \n * @korean 회피및하단공격용척추굽힘계산\n */\nexport function calculateSpinalFlexion(\n movementType: SpinalMovementType,\n intensity: number = 1.0\n): SpinalFlexionState {\n let flexion = 0;\n let lateralBend = 0;\n\n // Clamp intensity to 0-1 range\n intensity = Math.max(0, Math.min(1, intensity));\n\n switch (movementType) {\n case 'duck':\n flexion = 0.7 * intensity; // Forward bend for ducking\n lateralBend = 0;\n break;\n\n case 'lean-back':\n flexion = -0.4 * intensity; // Backward bend for evasion\n lateralBend = 0;\n break;\n\n case 'lean-left':\n flexion = 0.1 * intensity; // Slight forward component\n lateralBend = -0.25 * intensity; // Left lateral bend\n break;\n\n case 'lean-right':\n flexion = 0.1 * intensity;\n lateralBend = 0.25 * intensity; // Right lateral bend\n break;\n\n case 'low-attack':\n flexion = 0.5 * intensity; // Forward bend for low strikes\n lateralBend = 0;\n break;\n\n case 'neutral':\n flexion = 0;\n lateralBend = 0;\n break;\n }\n\n // Apply constraints\n flexion = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.SPINAL_FLEXION.FLEXION_MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.SPINAL_FLEXION.FLEXION_MAX, flexion)\n );\n lateralBend = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.SPINAL_FLEXION.LATERAL_MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.SPINAL_FLEXION.LATERAL_MAX, lateralBend)\n );\n\n return { flexion, lateralBend };\n}\n\n/**\n * Calculate knee drive for knee strikes and clinch\n * \n * Determines independent knee positioning for close-range combat,\n * crucial for knee strike power and clinch work positioning.\n * \n * @param technique - Technique requiring knee drive\n * @param phase - Technique phase\n * @param side - Which knee\n * @returns Knee drive state with height and forward distance\n * \n * @example\n * ```typescript\n * const kneeState = calculateKneeDrive('knee-strike', 'execution', 'right');\n * // Returns: { height: 0.7, forward: 0.25, side: 'right' }\n * ```\n * \n * @korean 무릎차기및클린치용무릎밀어올림계산\n */\nexport function calculateKneeDrive(\n technique: KneeTechniqueType,\n phase: KneePhase,\n side: BodySide\n): KneeDriveState {\n let height = 0;\n let forward = 0;\n\n switch (technique) {\n case 'knee-strike':\n if (phase === 'wind-up') {\n height = 0.3; // Partial chamber\n forward = 0.1;\n } else if (phase === 'execution') {\n height = 0.7; // Drive upward\n forward = 0.25; // Drive forward for power\n } else {\n height = 0.2;\n forward = 0.05;\n }\n break;\n\n case 'clinch-control':\n if (phase === 'execution') {\n height = 0.4; // Moderate elevation for control\n forward = 0.15; // Forward pressure\n } else {\n height = 0.2;\n forward = 0.08;\n }\n break;\n\n case 'push-kick':\n if (phase === 'wind-up') {\n height = 0.5; // High chamber\n forward = 0.05;\n } else if (phase === 'execution') {\n height = 0.6; // Maintain height\n forward = 0.3; // Strong forward drive\n } else {\n height = 0.3;\n forward = 0.1;\n }\n break;\n\n case 'neutral':\n height = 0;\n forward = 0;\n break;\n }\n\n // Apply constraints\n height = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.KNEE_DRIVE.HEIGHT_MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.KNEE_DRIVE.HEIGHT_MAX, height)\n );\n forward = Math.max(\n ADVANCED_JOINT_CONSTRAINTS.KNEE_DRIVE.FORWARD_MIN,\n Math.min(ADVANCED_JOINT_CONSTRAINTS.KNEE_DRIVE.FORWARD_MAX, forward)\n );\n\n return { height, forward, side };\n}\n\n/**\n * Calculate knee strike power modifier\n * \n * Determines power bonus based on knee drive height and forward momentum.\n * Greater drive generates more power through proper mechanics.\n * \n * @param kneeState - Current knee drive state\n * @returns Power multiplier (1.0-1.35x, with knee strikes getting up to 35% bonus)\n * \n * @example\n * ```typescript\n * const kneeState = calculateKneeDrive('knee-strike', 'execution', 'right');\n * const power = calculateKneeStrikePowerModifier(kneeState);\n * // Returns ~1.30 for properly executed knee strike\n * ```\n * \n * @korean 무릎차기파워배율계산\n */\nexport function calculateKneeStrikePowerModifier(kneeState: KneeDriveState): number {\n // Normalize height to 0-1 range\n const normalizedHeight = kneeState.height / ADVANCED_JOINT_CONSTRAINTS.KNEE_DRIVE.HEIGHT_MAX;\n \n // Normalize forward drive to 0-1 range\n const normalizedForward = kneeState.forward / ADVANCED_JOINT_CONSTRAINTS.KNEE_DRIVE.FORWARD_MAX;\n \n // Height contributes 60%, forward drive contributes 40%\n const powerFactor = (normalizedHeight * 0.6) + (normalizedForward * 0.4);\n \n // Knee strikes get up to 35% power bonus from proper drive\n return 1.0 + (powerFactor * 0.35);\n}\n\n"],"mappings":";;;;;;;;;;AA+WA,IAAa,6BAA6B;;;;;CAKxC,cAAc;EACZ,aAAa;EACb,aAAa;EACb,cAAc;EACd,cAAc;EACd,gBAAgB;EAChB,gBAAgB;CAClB;;;;;CAMA,oBAAoB;EAClB,KAAK;EACL,KAAK;CACP;;;;;CAMA,oBAAoB;EAClB,aAAa;EACb,aAAa;EACb,eAAe;EACf,eAAe;CACjB;;;;;CAMA,YAAY;EACV,cAAc;EACd,cAAc;EACd,cAAc;CAChB;;;;;CAMA,YAAY;EACV,YAAY;EACZ,YAAY;EACZ,aAAa;EACb,aAAa;CACf;;;;;CAMA,gBAAgB;EACd,aAAa;EACb,aAAa;EACb,aAAa;EACb,aAAa;CACf;AACF;;;;;;;;;;;;;;;;;;;;AA+GA,SAAgB,kCACd,UACA,UACQ;CAER,MAAM,oBAAoB,KAAK,IAAI,SAAS,eAAe,IACzD,2BAA2B,aAAa;CAC1C,MAAM,qBAAqB,KAAK,IAAI,SAAS,gBAAgB,IAC3D,2BAA2B,aAAa;CAC1C,MAAM,uBAAuB,KAAK,IAAI,SAAS,kBAAkB,IAC/D,2BAA2B,aAAa;CAG1C,IAAI,cAAc;CAClB,QAAQ,UAAR;EACE,KAAK;GACH,cAAc,qBAAqB,KAAM,oBAAoB;GAC7D;EACF,KAAK;GACH,cAAc,oBAAoB,KAAM,uBAAuB,KAAM,qBAAqB;GAC1F;EACF,KAAK;GACH,cAAc,oBAAoB,KAAM,uBAAuB;GAC/D;EACF,KAAK;GACH,cAAc,oBAAoB,KAAM,qBAAqB,KAAM,uBAAuB;GAC1F;EACF,KAAK;GACH,cAAc,qBAAqB,KAAM,oBAAoB;GAC7D;CACJ;CAGA,OAAO,IAAO,cAAc;AAC9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"BodyFacingSystem.js","names":[],"sources":["../../../../src/systems/animation/systems/BodyFacingSystem.ts"],"sourcesContent":["/**\n * Body Facing Direction System for Black Trigram\n *\n * Manages automatic character rotation to face opponent with:\n * - Smooth torso rotation at 45°/sec (±90° range)\n * - Independent head tracking (±45° range)\n * - 180° turn animations for repositioning\n * - Facing lock during attack/defend animations\n *\n * Korean terminology:\n * - 정면향하기 (Jeongmyeon Hyanghagi) - Face forward\n * - 몸회전 (Mom Hoejeon) - Body rotation\n * - 머리추적 (Meori Chujok) - Head tracking\n * - 180도회전 (180-do Hoejeon) - 180-degree turn\n *\n * @module systems/animation/BodyFacingSystem\n * @category Animation System\n * @korean 몸향하기시스템\n */\n\nimport { Position } from \"@/types\";\nimport type { BodyFacing } from \"../core/types\";\n\n/**\n * Default rotation speed in degrees per second\n * 45°/sec provides smooth, realistic rotation\n *\n * @korean 기본회전속도\n */\nexport const DEFAULT_ROTATION_SPEED = 45;\n\n/**\n * Maximum torso rotation range in degrees\n * Torso can rotate ±90° from facing direction\n *\n * @korean 최대몸통회전\n */\nexport const MAX_TORSO_ROTATION = 90;\n\n/**\n * Maximum head rotation offset in degrees\n * Head can track independently ±45° from torso\n *\n * @korean 최대머리회전\n */\nexport const MAX_HEAD_ROTATION = 45;\n\n/**\n * Threshold angle for triggering 180° turn animation\n * If angle difference exceeds this, play full turn animation\n *\n * @korean 180도회전기준각도\n */\nexport const TURN_THRESHOLD_ANGLE = 90;\n\n/**\n * Duration of 180° turn animation in milliseconds\n * 12 frames at 60fps = 200ms\n *\n * @korean 회전애니메이션시간\n */\nexport const TURN_ANIMATION_DURATION = 200;\n\n/**\n * Head tracking smoothing factor (0-1)\n * Lower values = smoother but slower head tracking\n * 0.1 = smooth, natural head movement\n *\n * @korean 머리추적부드러움\n */\nexport const HEAD_TRACKING_SMOOTHING = 0.1;\n\n/**\n * Normalizes an angle to 0-360 degree range\n *\n * @param angle - Angle in degrees\n * @returns Normalized angle in 0-360 range\n *\n * @example\n * ```typescript\n * normalizeAngle(370); // Returns 10\n * normalizeAngle(-30); // Returns 330\n * ```\n *\n * @korean 각도정규화\n */\nexport function normalizeAngle(angle: number): number {\n let normalized = angle % 360;\n if (normalized < 0) {\n normalized += 360;\n }\n // Handle -0 edge case (JavaScript quirk)\n return normalized === 0 ? 0 : normalized;\n}\n\n/**\n * Calculates the shortest angular difference between two angles\n * Returns value in range [-180, 180]\n * - Positive = clockwise rotation\n * - Negative = counter-clockwise rotation\n *\n * @param from - Starting angle in degrees\n * @param to - Target angle in degrees\n * @returns Shortest angular difference in degrees\n *\n * @example\n * ```typescript\n * calculateAngleDifference(10, 350); // Returns -20 (turn left)\n * calculateAngleDifference(350, 10); // Returns 20 (turn right)\n * calculateAngleDifference(0, 180); // Returns 180\n * ```\n *\n * @korean 각도차이계산\n */\nexport function calculateAngleDifference(from: number, to: number): number {\n const fromNorm = normalizeAngle(from);\n const toNorm = normalizeAngle(to);\n\n let diff = toNorm - fromNorm;\n\n // Find shortest path\n if (diff > 180) {\n diff -= 360;\n } else if (diff < -180) {\n diff += 360;\n }\n\n return diff;\n}\n\n/**\n * Calculates angle from one position to another\n * Returns angle in degrees (0-360)\n * - 0° = pointing right (+X)\n * - 90° = pointing down (+Z)\n * - 180° = pointing left (-X)\n * - 270° = pointing up (-Z)\n *\n * @param from - Starting position\n * @param to - Target position\n * @returns Angle in degrees\n *\n * @example\n * ```typescript\n * calculateAngleToTarget({ x: 0, y: 0 }, { x: 1, y: 0 }); // Returns 0° (right)\n * calculateAngleToTarget({ x: 0, y: 0 }, { x: 0, y: 1 }); // Returns 90° (down)\n * ```\n *\n * @korean 목표각도계산\n */\nexport function calculateAngleToTarget(from: Position, to: Position): number {\n const dx = to.x - from.x;\n const dz = to.y - from.y; // Position.y is Z coordinate in 2D top-down\n\n // atan2 returns angle in radians, convert to degrees\n // atan2(y, x) where y is forward/back (Z), x is left/right (X)\n const angle = Math.atan2(dz, dx) * (180 / Math.PI);\n\n return normalizeAngle(angle);\n}\n\n/**\n * Linear interpolation between two values\n *\n * @param start - Start value\n * @param end - End value\n * @param t - Interpolation factor (0-1)\n * @returns Interpolated value\n *\n * @private\n * @korean 선형보간\n */\nfunction lerp(start: number, end: number, t: number): number {\n return start + (end - start) * t;\n}\n\n/**\n * Creates default body facing state\n *\n * @param initialAngle - Initial facing angle in degrees (default: 0)\n * @returns Default BodyFacing state\n *\n * @korean 기본몸향하기생성\n */\nexport function createDefaultBodyFacing(initialAngle = 0): BodyFacing {\n const initialRadians = (initialAngle * Math.PI) / 180;\n return {\n currentAngle: normalizeAngle(initialAngle),\n targetAngle: normalizeAngle(initialAngle),\n rotationSpeed: DEFAULT_ROTATION_SPEED,\n headAngleOffset: 0,\n isLocked: false,\n isTurning: false,\n torsoRotation: 0, // No initial torso twist\n hipRotation: initialRadians, // Hips aligned with current angle\n };\n}\n\n/**\n * Updates body facing direction with smooth rotation\n *\n * Performs smooth rotation toward target angle at specified speed.\n * Handles:\n * - Rotation locking during attacks\n * - 180° turn animation triggering\n * - Head tracking with independent offset\n * - Smooth interpolation at 45°/sec\n *\n * @param facing - Current body facing state\n * @param targetAngle - Desired facing angle in degrees\n * @param deltaTime - Time elapsed since last update in seconds\n * @param currentTime - Current timestamp in milliseconds\n * @returns Updated body facing state\n *\n * @example\n * ```typescript\n * const facing = createDefaultBodyFacing(0);\n * const updated = updateBodyFacing(facing, 90, 0.016, Date.now());\n * // Rotates ~0.72° toward 90° (45°/sec * 0.016s)\n * ```\n *\n * @korean 몸향하기업데이트\n */\nexport function updateBodyFacing(\n facing: BodyFacing,\n targetAngle: number,\n deltaTime: number,\n currentTime: number\n): BodyFacing {\n // If locked, no rotation allowed\n if (facing.isLocked) {\n return facing;\n }\n\n // Check if 180° turn animation is in progress\n if (facing.isTurning && facing.turnStartTime) {\n const elapsed = currentTime - facing.turnStartTime;\n\n if (elapsed >= TURN_ANIMATION_DURATION) {\n // Turn animation complete - snap to target angle\n return {\n ...facing,\n currentAngle: normalizeAngle(targetAngle),\n targetAngle: normalizeAngle(targetAngle),\n headAngleOffset: 0,\n isTurning: false,\n turnDirection: undefined,\n turnStartTime: undefined,\n };\n }\n\n // Still turning - don't update angle yet\n return {\n ...facing,\n targetAngle: normalizeAngle(targetAngle),\n };\n }\n\n // Calculate angle difference\n const angleDiff = calculateAngleDifference(facing.currentAngle, targetAngle);\n\n // Check if 180° turn is needed\n if (Math.abs(angleDiff) > TURN_THRESHOLD_ANGLE && !facing.isTurning) {\n // Trigger 180° turn animation\n return {\n ...facing,\n targetAngle: normalizeAngle(targetAngle),\n isTurning: true,\n turnDirection: angleDiff > 0 ? \"right\" : \"left\",\n turnStartTime: currentTime,\n };\n }\n\n // Calculate maximum rotation for this frame\n const maxRotation = facing.rotationSpeed * deltaTime;\n\n // Calculate actual rotation (limited by max rotation)\n const rotation =\n Math.sign(angleDiff) * Math.min(Math.abs(angleDiff), maxRotation);\n\n // Update current angle\n const newCurrentAngle = normalizeAngle(facing.currentAngle + rotation);\n\n // Update head tracking (±45° range independent of torso)\n // Head smoothly tracks toward target within allowed range\n const remainingDiff = calculateAngleDifference(newCurrentAngle, targetAngle);\n const targetHeadOffset = Math.max(\n -MAX_HEAD_ROTATION,\n Math.min(MAX_HEAD_ROTATION, remainingDiff)\n );\n\n const newHeadOffset = lerp(\n facing.headAngleOffset,\n targetHeadOffset,\n HEAD_TRACKING_SMOOTHING\n );\n\n return {\n ...facing,\n currentAngle: newCurrentAngle,\n targetAngle: normalizeAngle(targetAngle),\n headAngleOffset: newHeadOffset,\n };\n}\n\n/**\n * Updates facing direction to point toward opponent\n *\n * Calculates target angle based on opponent position and updates\n * body facing state with smooth rotation.\n *\n * @param facing - Current body facing state\n * @param playerPosition - Player's current position\n * @param opponentPosition - Opponent's current position\n * @param deltaTime - Time elapsed since last update in seconds\n * @param currentTime - Current timestamp in milliseconds\n * @returns Updated body facing state\n *\n * @example\n * ```typescript\n * const updated = updateFacingTowardOpponent(\n * facing,\n * { x: 100, y: 200 },\n * { x: 300, y: 200 },\n * 0.016,\n * Date.now()\n * );\n * // Faces toward opponent (pointing right in this case)\n * ```\n *\n * @korean 상대방향하기업데이트\n */\nexport function updateFacingTowardOpponent(\n facing: BodyFacing,\n playerPosition: Position,\n opponentPosition: Position,\n deltaTime: number,\n currentTime: number\n): BodyFacing {\n const targetAngle = calculateAngleToTarget(playerPosition, opponentPosition);\n return updateBodyFacing(facing, targetAngle, deltaTime, currentTime);\n}\n\n/**\n * Locks facing direction (during attacks/defends)\n *\n * Prevents rotation while attack or defend animation is playing.\n * Maintains current facing angle.\n *\n * @param facing - Current body facing state\n * @returns Updated body facing state with lock enabled\n *\n * @korean 회전잠금\n */\nexport function lockFacing(facing: BodyFacing): BodyFacing {\n return {\n ...facing,\n isLocked: true,\n };\n}\n\n/**\n * Unlocks facing direction (after attacks/defends complete)\n *\n * Allows rotation to resume after attack or defend animation completes.\n *\n * @param facing - Current body facing state\n * @returns Updated body facing state with lock disabled\n *\n * @korean 회전잠금해제\n */\nexport function unlockFacing(facing: BodyFacing): BodyFacing {\n return {\n ...facing,\n isLocked: false,\n };\n}\n\n/**\n * Checks if character is currently turning (180° animation)\n *\n * @param facing - Current body facing state\n * @returns True if 180° turn animation is in progress\n *\n * @korean 회전중확인\n */\nexport function isTurning(facing: BodyFacing): boolean {\n return facing.isTurning;\n}\n\n/**\n * Gets current facing angle in radians\n * Useful for Three.js rotation (expects radians)\n *\n * @param facing - Current body facing state\n * @returns Current facing angle in radians\n *\n * @korean 라디안각도\n */\nexport function getFacingAngleRadians(facing: BodyFacing): number {\n return (facing.currentAngle * Math.PI) / 180;\n}\n\n/**\n * Gets head angle in radians including offset\n * Combines torso rotation with head tracking offset\n *\n * @param facing - Current body facing state\n * @returns Head rotation angle in radians\n *\n * @korean 머리각도라디안\n */\nexport function getHeadAngleRadians(facing: BodyFacing): number {\n const totalAngle = facing.currentAngle + facing.headAngleOffset;\n return (totalAngle * Math.PI) / 180;\n}\n\n/**\n * Gets torso rotation in radians\n * Returns the torso rotation relative to hips\n *\n * @param facing - Current body facing state\n * @returns Torso rotation in radians (defaults to 0 if not set)\n *\n * @korean 허리회전라디안\n */\nexport function getTorsoRotationRadians(facing: BodyFacing): number {\n return facing.torsoRotation ?? 0;\n}\n\n/**\n * Gets hip rotation in radians\n * Returns the hip/pelvis base rotation\n *\n * @param facing - Current body facing state\n * @returns Hip rotation in radians\n *\n * @korean 골반회전라디안\n */\nexport function getHipRotationRadians(facing: BodyFacing): number {\n return facing.hipRotation ?? getFacingAngleRadians(facing);\n}\n\n/**\n * Body Facing System singleton for managing character rotation\n *\n * Provides centralized system for body facing calculations and updates.\n *\n * @korean 몸향하기시스템\n */\nexport class BodyFacingSystem {\n /**\n * Creates default body facing state for a new player\n *\n * @param initialAngle - Initial facing angle in degrees\n * @returns Default body facing state\n *\n * @korean 기본상태생성\n */\n createDefaultState(initialAngle = 0): BodyFacing {\n return createDefaultBodyFacing(initialAngle);\n }\n\n /**\n * Updates body facing with opponent tracking\n *\n * @param facing - Current body facing state\n * @param playerPosition - Player position\n * @param opponentPosition - Opponent position\n * @param deltaTime - Delta time in seconds\n * @param currentTime - Current timestamp\n * @returns Updated body facing state\n *\n * @korean 업데이트\n */\n update(\n facing: BodyFacing,\n playerPosition: Position,\n opponentPosition: Position,\n deltaTime: number,\n currentTime: number\n ): BodyFacing {\n return updateFacingTowardOpponent(\n facing,\n playerPosition,\n opponentPosition,\n deltaTime,\n currentTime\n );\n }\n\n /**\n * Locks facing during attacks\n *\n * @param facing - Current body facing state\n * @returns Updated state with lock\n *\n * @korean 잠금\n */\n lock(facing: BodyFacing): BodyFacing {\n return lockFacing(facing);\n }\n\n /**\n * Unlocks facing after attacks\n *\n * @param facing - Current body facing state\n * @returns Updated state without lock\n *\n * @korean 잠금해제\n */\n unlock(facing: BodyFacing): BodyFacing {\n return unlockFacing(facing);\n }\n}\n\n/**\n * Default body facing system instance\n *\n * @korean 기본몸향하기시스템\n */\nexport const bodyFacingSystem = new BodyFacingSystem();\n\nexport default bodyFacingSystem;\n"],"mappings":";;;;;;;AAsEA,IAAa,0BAA0B;;;;;;;;;;;;;;;AAgBvC,SAAgB,eAAe,OAAuB;CACpD,IAAI,aAAa,QAAQ;CACzB,IAAI,aAAa,GACf,cAAc;CAGhB,OAAO,eAAe,IAAI,IAAI;;;;;;;;;;;;;;;;;;;;;AAsBhC,SAAgB,yBAAyB,MAAc,IAAoB;CACzE,MAAM,WAAW,eAAe,KAAK;CAGrC,IAAI,OAFW,eAAe,GAEnB,GAAS;CAGpB,IAAI,OAAO,KACT,QAAQ;MACH,IAAI,OAAO,MAChB,QAAQ;CAGV,OAAO;;;;;;;;;;;;;;;;;;;;;;AAuBT,SAAgB,uBAAuB,MAAgB,IAAsB;CAC3E,MAAM,KAAK,GAAG,IAAI,KAAK;CACvB,MAAM,KAAK,GAAG,IAAI,KAAK;CAMvB,OAAO,eAFO,KAAK,MAAM,IAAI,GAAG,IAAI,MAAM,KAAK,IAEnB;;;;;;;;;;;;;AAc9B,SAAS,KAAK,OAAe,KAAa,GAAmB;CAC3D,OAAO,SAAS,MAAM,SAAS;;;;;;;;;;AAWjC,SAAgB,wBAAwB,eAAe,GAAe;CACpE,MAAM,iBAAkB,eAAe,KAAK,KAAM;CAClD,OAAO;EACL,cAAc,eAAe,aAAa;EAC1C,aAAa,eAAe,aAAa;EACzC,eAAA;EACA,iBAAiB;EACjB,UAAU;EACV,WAAW;EACX,eAAe;EACf,aAAa;EACd;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BH,SAAgB,iBACd,QACA,aACA,WACA,aACY;CAEZ,IAAI,OAAO,UACT,OAAO;CAIT,IAAI,OAAO,aAAa,OAAO,eAAe;EAG5C,IAFgB,cAAc,OAAO,iBAAA,KAInC,OAAO;GACL,GAAG;GACH,cAAc,eAAe,YAAY;GACzC,aAAa,eAAe,YAAY;GACxC,iBAAiB;GACjB,WAAW;GACX,eAAe,KAAA;GACf,eAAe,KAAA;GAChB;EAIH,OAAO;GACL,GAAG;GACH,aAAa,eAAe,YAAY;GACzC;;CAIH,MAAM,YAAY,yBAAyB,OAAO,cAAc,YAAY;CAG5E,IAAI,KAAK,IAAI,UAAU,GAAA,MAA2B,CAAC,OAAO,WAExD,OAAO;EACL,GAAG;EACH,aAAa,eAAe,YAAY;EACxC,WAAW;EACX,eAAe,YAAY,IAAI,UAAU;EACzC,eAAe;EAChB;CAIH,MAAM,cAAc,OAAO,gBAAgB;CAG3C,MAAM,WACJ,KAAK,KAAK,UAAU,GAAG,KAAK,IAAI,KAAK,IAAI,UAAU,EAAE,YAAY;CAGnE,MAAM,kBAAkB,eAAe,OAAO,eAAe,SAAS;CAItE,MAAM,gBAAgB,yBAAyB,iBAAiB,YAAY;CAC5E,MAAM,mBAAmB,KAAK,IAC5B,KACA,KAAK,IAAA,IAAuB,cAAc,CAC3C;CAED,MAAM,gBAAgB,KACpB,OAAO,iBACP,kBACA,wBACD;CAED,OAAO;EACL,GAAG;EACH,cAAc;EACd,aAAa,eAAe,YAAY;EACxC,iBAAiB;EAClB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BH,SAAgB,2BACd,QACA,gBACA,kBACA,WACA,aACY;CAEZ,OAAO,iBAAiB,QADJ,uBAAuB,gBAAgB,iBAC3B,EAAa,WAAW,YAAY;;;;;;;;;;;;;AActE,SAAgB,WAAW,QAAgC;CACzD,OAAO;EACL,GAAG;EACH,UAAU;EACX;;;;;;;;;;;;AAaH,SAAgB,aAAa,QAAgC;CAC3D,OAAO;EACL,GAAG;EACH,UAAU;EACX;;;;;;;;;;;AAqCH,SAAgB,oBAAoB,QAA4B;CAE9D,QADmB,OAAO,eAAe,OAAO,mBAC3B,KAAK,KAAM;;;;;;;;;AAoClC,IAAa,mBAAb,MAA8B;;;;;;;;;CAS5B,mBAAmB,eAAe,GAAe;EAC/C,OAAO,wBAAwB,aAAa;;;;;;;;;;;;;;CAe9C,OACE,QACA,gBACA,kBACA,WACA,aACY;EACZ,OAAO,2BACL,QACA,gBACA,kBACA,WACA,YACD;;;;;;;;;;CAWH,KAAK,QAAgC;EACnC,OAAO,WAAW,OAAO;;;;;;;;;;CAW3B,OAAO,QAAgC;EACrC,OAAO,aAAa,OAAO;;;AASC,IAAI,kBAAkB"}
1
+ {"version":3,"file":"BodyFacingSystem.js","names":[],"sources":["../../../../src/systems/animation/systems/BodyFacingSystem.ts"],"sourcesContent":["/**\n * Body Facing Direction System for Black Trigram\n *\n * Manages automatic character rotation to face opponent with:\n * - Smooth torso rotation at 45°/sec (±90° range)\n * - Independent head tracking (±45° range)\n * - 180° turn animations for repositioning\n * - Facing lock during attack/defend animations\n *\n * Korean terminology:\n * - 정면향하기 (Jeongmyeon Hyanghagi) - Face forward\n * - 몸회전 (Mom Hoejeon) - Body rotation\n * - 머리추적 (Meori Chujok) - Head tracking\n * - 180도회전 (180-do Hoejeon) - 180-degree turn\n *\n * @module systems/animation/BodyFacingSystem\n * @category Animation System\n * @korean 몸향하기시스템\n */\n\nimport { Position } from \"@/types\";\nimport type { BodyFacing } from \"../core/types\";\n\n/**\n * Default rotation speed in degrees per second\n * 45°/sec provides smooth, realistic rotation\n *\n * @korean 기본회전속도\n */\nexport const DEFAULT_ROTATION_SPEED = 45;\n\n/**\n * Maximum torso rotation range in degrees\n * Torso can rotate ±90° from facing direction\n *\n * @korean 최대몸통회전\n */\nexport const MAX_TORSO_ROTATION = 90;\n\n/**\n * Maximum head rotation offset in degrees\n * Head can track independently ±45° from torso\n *\n * @korean 최대머리회전\n */\nexport const MAX_HEAD_ROTATION = 45;\n\n/**\n * Threshold angle for triggering 180° turn animation\n * If angle difference exceeds this, play full turn animation\n *\n * @korean 180도회전기준각도\n */\nexport const TURN_THRESHOLD_ANGLE = 90;\n\n/**\n * Duration of 180° turn animation in milliseconds\n * 12 frames at 60fps = 200ms\n *\n * @korean 회전애니메이션시간\n */\nexport const TURN_ANIMATION_DURATION = 200;\n\n/**\n * Head tracking smoothing factor (0-1)\n * Lower values = smoother but slower head tracking\n * 0.1 = smooth, natural head movement\n *\n * @korean 머리추적부드러움\n */\nexport const HEAD_TRACKING_SMOOTHING = 0.1;\n\n/**\n * Normalizes an angle to 0-360 degree range\n *\n * @param angle - Angle in degrees\n * @returns Normalized angle in 0-360 range\n *\n * @example\n * ```typescript\n * normalizeAngle(370); // Returns 10\n * normalizeAngle(-30); // Returns 330\n * ```\n *\n * @korean 각도정규화\n */\nexport function normalizeAngle(angle: number): number {\n let normalized = angle % 360;\n if (normalized < 0) {\n normalized += 360;\n }\n // Handle -0 edge case (JavaScript quirk)\n return normalized === 0 ? 0 : normalized;\n}\n\n/**\n * Calculates the shortest angular difference between two angles\n * Returns value in range [-180, 180]\n * - Positive = clockwise rotation\n * - Negative = counter-clockwise rotation\n *\n * @param from - Starting angle in degrees\n * @param to - Target angle in degrees\n * @returns Shortest angular difference in degrees\n *\n * @example\n * ```typescript\n * calculateAngleDifference(10, 350); // Returns -20 (turn left)\n * calculateAngleDifference(350, 10); // Returns 20 (turn right)\n * calculateAngleDifference(0, 180); // Returns 180\n * ```\n *\n * @korean 각도차이계산\n */\nexport function calculateAngleDifference(from: number, to: number): number {\n const fromNorm = normalizeAngle(from);\n const toNorm = normalizeAngle(to);\n\n let diff = toNorm - fromNorm;\n\n // Find shortest path\n if (diff > 180) {\n diff -= 360;\n } else if (diff < -180) {\n diff += 360;\n }\n\n return diff;\n}\n\n/**\n * Calculates angle from one position to another\n * Returns angle in degrees (0-360)\n * - 0° = pointing right (+X)\n * - 90° = pointing down (+Z)\n * - 180° = pointing left (-X)\n * - 270° = pointing up (-Z)\n *\n * @param from - Starting position\n * @param to - Target position\n * @returns Angle in degrees\n *\n * @example\n * ```typescript\n * calculateAngleToTarget({ x: 0, y: 0 }, { x: 1, y: 0 }); // Returns 0° (right)\n * calculateAngleToTarget({ x: 0, y: 0 }, { x: 0, y: 1 }); // Returns 90° (down)\n * ```\n *\n * @korean 목표각도계산\n */\nexport function calculateAngleToTarget(from: Position, to: Position): number {\n const dx = to.x - from.x;\n const dz = to.y - from.y; // Position.y is Z coordinate in 2D top-down\n\n // atan2 returns angle in radians, convert to degrees\n // atan2(y, x) where y is forward/back (Z), x is left/right (X)\n const angle = Math.atan2(dz, dx) * (180 / Math.PI);\n\n return normalizeAngle(angle);\n}\n\n/**\n * Linear interpolation between two values\n *\n * @param start - Start value\n * @param end - End value\n * @param t - Interpolation factor (0-1)\n * @returns Interpolated value\n *\n * @private\n * @korean 선형보간\n */\nfunction lerp(start: number, end: number, t: number): number {\n return start + (end - start) * t;\n}\n\n/**\n * Creates default body facing state\n *\n * @param initialAngle - Initial facing angle in degrees (default: 0)\n * @returns Default BodyFacing state\n *\n * @korean 기본몸향하기생성\n */\nexport function createDefaultBodyFacing(initialAngle = 0): BodyFacing {\n const initialRadians = (initialAngle * Math.PI) / 180;\n return {\n currentAngle: normalizeAngle(initialAngle),\n targetAngle: normalizeAngle(initialAngle),\n rotationSpeed: DEFAULT_ROTATION_SPEED,\n headAngleOffset: 0,\n isLocked: false,\n isTurning: false,\n torsoRotation: 0, // No initial torso twist\n hipRotation: initialRadians, // Hips aligned with current angle\n };\n}\n\n/**\n * Updates body facing direction with smooth rotation\n *\n * Performs smooth rotation toward target angle at specified speed.\n * Handles:\n * - Rotation locking during attacks\n * - 180° turn animation triggering\n * - Head tracking with independent offset\n * - Smooth interpolation at 45°/sec\n *\n * @param facing - Current body facing state\n * @param targetAngle - Desired facing angle in degrees\n * @param deltaTime - Time elapsed since last update in seconds\n * @param currentTime - Current timestamp in milliseconds\n * @returns Updated body facing state\n *\n * @example\n * ```typescript\n * const facing = createDefaultBodyFacing(0);\n * const updated = updateBodyFacing(facing, 90, 0.016, Date.now());\n * // Rotates ~0.72° toward 90° (45°/sec * 0.016s)\n * ```\n *\n * @korean 몸향하기업데이트\n */\nexport function updateBodyFacing(\n facing: BodyFacing,\n targetAngle: number,\n deltaTime: number,\n currentTime: number\n): BodyFacing {\n // If locked, no rotation allowed\n if (facing.isLocked) {\n return facing;\n }\n\n // Check if 180° turn animation is in progress\n if (facing.isTurning && facing.turnStartTime) {\n const elapsed = currentTime - facing.turnStartTime;\n\n if (elapsed >= TURN_ANIMATION_DURATION) {\n // Turn animation complete - snap to target angle\n return {\n ...facing,\n currentAngle: normalizeAngle(targetAngle),\n targetAngle: normalizeAngle(targetAngle),\n headAngleOffset: 0,\n isTurning: false,\n turnDirection: undefined,\n turnStartTime: undefined,\n };\n }\n\n // Still turning - don't update angle yet\n return {\n ...facing,\n targetAngle: normalizeAngle(targetAngle),\n };\n }\n\n // Calculate angle difference\n const angleDiff = calculateAngleDifference(facing.currentAngle, targetAngle);\n\n // Check if 180° turn is needed\n if (Math.abs(angleDiff) > TURN_THRESHOLD_ANGLE && !facing.isTurning) {\n // Trigger 180° turn animation\n return {\n ...facing,\n targetAngle: normalizeAngle(targetAngle),\n isTurning: true,\n turnDirection: angleDiff > 0 ? \"right\" : \"left\",\n turnStartTime: currentTime,\n };\n }\n\n // Calculate maximum rotation for this frame\n const maxRotation = facing.rotationSpeed * deltaTime;\n\n // Calculate actual rotation (limited by max rotation)\n const rotation =\n Math.sign(angleDiff) * Math.min(Math.abs(angleDiff), maxRotation);\n\n // Update current angle\n const newCurrentAngle = normalizeAngle(facing.currentAngle + rotation);\n\n // Update head tracking (±45° range independent of torso)\n // Head smoothly tracks toward target within allowed range\n const remainingDiff = calculateAngleDifference(newCurrentAngle, targetAngle);\n const targetHeadOffset = Math.max(\n -MAX_HEAD_ROTATION,\n Math.min(MAX_HEAD_ROTATION, remainingDiff)\n );\n\n const newHeadOffset = lerp(\n facing.headAngleOffset,\n targetHeadOffset,\n HEAD_TRACKING_SMOOTHING\n );\n\n return {\n ...facing,\n currentAngle: newCurrentAngle,\n targetAngle: normalizeAngle(targetAngle),\n headAngleOffset: newHeadOffset,\n };\n}\n\n/**\n * Updates facing direction to point toward opponent\n *\n * Calculates target angle based on opponent position and updates\n * body facing state with smooth rotation.\n *\n * @param facing - Current body facing state\n * @param playerPosition - Player's current position\n * @param opponentPosition - Opponent's current position\n * @param deltaTime - Time elapsed since last update in seconds\n * @param currentTime - Current timestamp in milliseconds\n * @returns Updated body facing state\n *\n * @example\n * ```typescript\n * const updated = updateFacingTowardOpponent(\n * facing,\n * { x: 100, y: 200 },\n * { x: 300, y: 200 },\n * 0.016,\n * Date.now()\n * );\n * // Faces toward opponent (pointing right in this case)\n * ```\n *\n * @korean 상대방향하기업데이트\n */\nexport function updateFacingTowardOpponent(\n facing: BodyFacing,\n playerPosition: Position,\n opponentPosition: Position,\n deltaTime: number,\n currentTime: number\n): BodyFacing {\n const targetAngle = calculateAngleToTarget(playerPosition, opponentPosition);\n return updateBodyFacing(facing, targetAngle, deltaTime, currentTime);\n}\n\n/**\n * Locks facing direction (during attacks/defends)\n *\n * Prevents rotation while attack or defend animation is playing.\n * Maintains current facing angle.\n *\n * @param facing - Current body facing state\n * @returns Updated body facing state with lock enabled\n *\n * @korean 회전잠금\n */\nexport function lockFacing(facing: BodyFacing): BodyFacing {\n return {\n ...facing,\n isLocked: true,\n };\n}\n\n/**\n * Unlocks facing direction (after attacks/defends complete)\n *\n * Allows rotation to resume after attack or defend animation completes.\n *\n * @param facing - Current body facing state\n * @returns Updated body facing state with lock disabled\n *\n * @korean 회전잠금해제\n */\nexport function unlockFacing(facing: BodyFacing): BodyFacing {\n return {\n ...facing,\n isLocked: false,\n };\n}\n\n/**\n * Checks if character is currently turning (180° animation)\n *\n * @param facing - Current body facing state\n * @returns True if 180° turn animation is in progress\n *\n * @korean 회전중확인\n */\nexport function isTurning(facing: BodyFacing): boolean {\n return facing.isTurning;\n}\n\n/**\n * Gets current facing angle in radians\n * Useful for Three.js rotation (expects radians)\n *\n * @param facing - Current body facing state\n * @returns Current facing angle in radians\n *\n * @korean 라디안각도\n */\nexport function getFacingAngleRadians(facing: BodyFacing): number {\n return (facing.currentAngle * Math.PI) / 180;\n}\n\n/**\n * Gets head angle in radians including offset\n * Combines torso rotation with head tracking offset\n *\n * @param facing - Current body facing state\n * @returns Head rotation angle in radians\n *\n * @korean 머리각도라디안\n */\nexport function getHeadAngleRadians(facing: BodyFacing): number {\n const totalAngle = facing.currentAngle + facing.headAngleOffset;\n return (totalAngle * Math.PI) / 180;\n}\n\n/**\n * Gets torso rotation in radians\n * Returns the torso rotation relative to hips\n *\n * @param facing - Current body facing state\n * @returns Torso rotation in radians (defaults to 0 if not set)\n *\n * @korean 허리회전라디안\n */\nexport function getTorsoRotationRadians(facing: BodyFacing): number {\n return facing.torsoRotation ?? 0;\n}\n\n/**\n * Gets hip rotation in radians\n * Returns the hip/pelvis base rotation\n *\n * @param facing - Current body facing state\n * @returns Hip rotation in radians\n *\n * @korean 골반회전라디안\n */\nexport function getHipRotationRadians(facing: BodyFacing): number {\n return facing.hipRotation ?? getFacingAngleRadians(facing);\n}\n\n/**\n * Body Facing System singleton for managing character rotation\n *\n * Provides centralized system for body facing calculations and updates.\n *\n * @korean 몸향하기시스템\n */\nexport class BodyFacingSystem {\n /**\n * Creates default body facing state for a new player\n *\n * @param initialAngle - Initial facing angle in degrees\n * @returns Default body facing state\n *\n * @korean 기본상태생성\n */\n createDefaultState(initialAngle = 0): BodyFacing {\n return createDefaultBodyFacing(initialAngle);\n }\n\n /**\n * Updates body facing with opponent tracking\n *\n * @param facing - Current body facing state\n * @param playerPosition - Player position\n * @param opponentPosition - Opponent position\n * @param deltaTime - Delta time in seconds\n * @param currentTime - Current timestamp\n * @returns Updated body facing state\n *\n * @korean 업데이트\n */\n update(\n facing: BodyFacing,\n playerPosition: Position,\n opponentPosition: Position,\n deltaTime: number,\n currentTime: number\n ): BodyFacing {\n return updateFacingTowardOpponent(\n facing,\n playerPosition,\n opponentPosition,\n deltaTime,\n currentTime\n );\n }\n\n /**\n * Locks facing during attacks\n *\n * @param facing - Current body facing state\n * @returns Updated state with lock\n *\n * @korean 잠금\n */\n lock(facing: BodyFacing): BodyFacing {\n return lockFacing(facing);\n }\n\n /**\n * Unlocks facing after attacks\n *\n * @param facing - Current body facing state\n * @returns Updated state without lock\n *\n * @korean 잠금해제\n */\n unlock(facing: BodyFacing): BodyFacing {\n return unlockFacing(facing);\n }\n}\n\n/**\n * Default body facing system instance\n *\n * @korean 기본몸향하기시스템\n */\nexport const bodyFacingSystem = new BodyFacingSystem();\n\nexport default bodyFacingSystem;\n"],"mappings":";;;;;;;AAsEA,IAAa,0BAA0B;;;;;;;;;;;;;;;AAgBvC,SAAgB,eAAe,OAAuB;CACpD,IAAI,aAAa,QAAQ;CACzB,IAAI,aAAa,GACf,cAAc;CAGhB,OAAO,eAAe,IAAI,IAAI;AAChC;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,yBAAyB,MAAc,IAAoB;CACzE,MAAM,WAAW,eAAe,IAAI;CAGpC,IAAI,OAFW,eAAe,EAEnB,IAAS;CAGpB,IAAI,OAAO,KACT,QAAQ;MACH,IAAI,OAAO,MAChB,QAAQ;CAGV,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAgB,uBAAuB,MAAgB,IAAsB;CAC3E,MAAM,KAAK,GAAG,IAAI,KAAK;CACvB,MAAM,KAAK,GAAG,IAAI,KAAK;CAMvB,OAAO,eAFO,KAAK,MAAM,IAAI,EAAE,KAAK,MAAM,KAAK,GAEpB;AAC7B;;;;;;;;;;;;AAaA,SAAS,KAAK,OAAe,KAAa,GAAmB;CAC3D,OAAO,SAAS,MAAM,SAAS;AACjC;;;;;;;;;AAUA,SAAgB,wBAAwB,eAAe,GAAe;CACpE,MAAM,iBAAkB,eAAe,KAAK,KAAM;CAClD,OAAO;EACL,cAAc,eAAe,YAAY;EACzC,aAAa,eAAe,YAAY;EACxC,eAAA;EACA,iBAAiB;EACjB,UAAU;EACV,WAAW;EACX,eAAe;EACf,aAAa;CACf;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAgB,iBACd,QACA,aACA,WACA,aACY;CAEZ,IAAI,OAAO,UACT,OAAO;CAIT,IAAI,OAAO,aAAa,OAAO,eAAe;EAG5C,IAFgB,cAAc,OAAO,iBAAA,KAInC,OAAO;GACL,GAAG;GACH,cAAc,eAAe,WAAW;GACxC,aAAa,eAAe,WAAW;GACvC,iBAAiB;GACjB,WAAW;GACX,eAAe,KAAA;GACf,eAAe,KAAA;EACjB;EAIF,OAAO;GACL,GAAG;GACH,aAAa,eAAe,WAAW;EACzC;CACF;CAGA,MAAM,YAAY,yBAAyB,OAAO,cAAc,WAAW;CAG3E,IAAI,KAAK,IAAI,SAAS,IAAA,MAA4B,CAAC,OAAO,WAExD,OAAO;EACL,GAAG;EACH,aAAa,eAAe,WAAW;EACvC,WAAW;EACX,eAAe,YAAY,IAAI,UAAU;EACzC,eAAe;CACjB;CAIF,MAAM,cAAc,OAAO,gBAAgB;CAG3C,MAAM,WACJ,KAAK,KAAK,SAAS,IAAI,KAAK,IAAI,KAAK,IAAI,SAAS,GAAG,WAAW;CAGlE,MAAM,kBAAkB,eAAe,OAAO,eAAe,QAAQ;CAIrE,MAAM,gBAAgB,yBAAyB,iBAAiB,WAAW;CAC3E,MAAM,mBAAmB,KAAK,IAC5B,KACA,KAAK,IAAA,IAAuB,aAAa,CAC3C;CAEA,MAAM,gBAAgB,KACpB,OAAO,iBACP,kBACA,uBACF;CAEA,OAAO;EACL,GAAG;EACH,cAAc;EACd,aAAa,eAAe,WAAW;EACvC,iBAAiB;CACnB;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,2BACd,QACA,gBACA,kBACA,WACA,aACY;CAEZ,OAAO,iBAAiB,QADJ,uBAAuB,gBAAgB,gBAC3B,GAAa,WAAW,WAAW;AACrE;;;;;;;;;;;;AAaA,SAAgB,WAAW,QAAgC;CACzD,OAAO;EACL,GAAG;EACH,UAAU;CACZ;AACF;;;;;;;;;;;AAYA,SAAgB,aAAa,QAAgC;CAC3D,OAAO;EACL,GAAG;EACH,UAAU;CACZ;AACF;;;;;;;;;;AAoCA,SAAgB,oBAAoB,QAA4B;CAE9D,QADmB,OAAO,eAAe,OAAO,mBAC3B,KAAK,KAAM;AAClC;;;;;;;;AAmCA,IAAa,mBAAb,MAA8B;;;;;;;;;CAS5B,mBAAmB,eAAe,GAAe;EAC/C,OAAO,wBAAwB,YAAY;CAC7C;;;;;;;;;;;;;CAcA,OACE,QACA,gBACA,kBACA,WACA,aACY;EACZ,OAAO,2BACL,QACA,gBACA,kBACA,WACA,WACF;CACF;;;;;;;;;CAUA,KAAK,QAAgC;EACnC,OAAO,WAAW,MAAM;CAC1B;;;;;;;;;CAUA,OAAO,QAAgC;EACrC,OAAO,aAAa,MAAM;CAC5B;AACF;AAOgC,IAAI,iBAAiB"}
@@ -1 +1 @@
1
- {"version":3,"file":"FacialExpressions.js","names":[],"sources":["../../../../src/systems/animation/systems/FacialExpressions.ts"],"sourcesContent":["/**\n * Facial expression system for realistic combat emotion\n * \n * Manages facial expression state based on combat conditions:\n * - Health, stamina, pain, consciousness levels\n * - Recent combat events (hits taken/landed)\n * - Dynamic expression transitions\n * \n * @module systems/animation/FacialExpressions\n * @category Animation System\n * @korean 얼굴표정시스템\n */\n\nimport {\n FacialExpression,\n type ExpressionState,\n type FacialDamageState,\n DEFAULT_FACIAL_DAMAGE,\n DEFAULT_EXPRESSION_STATE,\n} from \"@/types/facial\";\n\n/**\n * Expression transition configuration\n * \n * @korean 표정전환설정\n */\nexport interface ExpressionTransitionConfig {\n /** Default transition time in seconds */\n readonly defaultTransitionTime: number;\n \n /** Quick transition time for immediate reactions */\n readonly quickTransitionTime: number;\n \n /** Slow transition time for gradual changes */\n readonly slowTransitionTime: number;\n}\n\n/**\n * Default expression transition configuration\n * \n * @korean 기본표정전환설정\n */\nexport const DEFAULT_TRANSITION_CONFIG: ExpressionTransitionConfig = {\n defaultTransitionTime: 0.2,\n quickTransitionTime: 0.1,\n slowTransitionTime: 0.5,\n};\n\n/**\n * Get facial expression based on current combat state\n * \n * Evaluates fighter's physical and mental state to determine appropriate\n * facial expression. Priority order:\n * 1. Defeated (unconscious)\n * 2. Pained (just hit)\n * 3. Exhausted (low stamina)\n * 4. Victorious (just landed hit)\n * 5. Focused (high resources)\n * 6. Neutral (default)\n * \n * @param health - Current health (0-100)\n * @param maxHealth - Maximum health\n * @param stamina - Current stamina (0-100)\n * @param pain - Pain level (0-100)\n * @param consciousness - Consciousness level (0-100)\n * @param justHit - Whether fighter was just hit\n * @param justLanded - Whether fighter just landed a hit\n * @returns Appropriate facial expression for combat state\n * \n * @example\n * ```typescript\n * const expression = getExpressionFromCombatState(\n * 85, // health\n * 100, // maxHealth\n * 60, // stamina\n * 20, // pain\n * 100, // consciousness\n * false, // justHit\n * true // justLanded\n * );\n * // Returns: FacialExpression.VICTORIOUS\n * ```\n * \n * @korean 전투상태로부터표정가져오기\n */\nexport const getExpressionFromCombatState = (\n health: number,\n maxHealth: number,\n stamina: number,\n _pain: number, // Reserved for future intensity calculation\n consciousness: number,\n justHit: boolean,\n justLanded: boolean\n): FacialExpression => {\n // Knocked out\n if (consciousness < 20) {\n return FacialExpression.DEFEATED;\n }\n\n // Just got hit (always show immediate reaction; pain level can control intensity)\n if (justHit) {\n return FacialExpression.PAINED;\n }\n\n // Low stamina (exhausted)\n if (stamina < 30) {\n return FacialExpression.EXHAUSTED;\n }\n\n // Just landed a hit (brief satisfaction)\n if (justLanded) {\n return FacialExpression.VICTORIOUS;\n }\n\n // High focus (ready to fight)\n const healthPercentage = (health / maxHealth) * 100;\n if (stamina > 70 && healthPercentage > 60) {\n return FacialExpression.FOCUSED;\n }\n\n // Default calm state\n return FacialExpression.NEUTRAL;\n};\n\n/**\n * Create new expression state with transition\n * \n * @param currentState - Current expression state\n * @param newExpression - New expression to transition to\n * @param transitionTime - Time to transition (seconds)\n * @returns New expression state with transition initialized\n * \n * @korean 새표정상태생성\n */\nexport const createExpressionTransition = (\n currentState: ExpressionState,\n newExpression: FacialExpression,\n transitionTime?: number\n): ExpressionState => {\n // No transition needed if same expression\n if (currentState.expression === newExpression) {\n return currentState;\n }\n\n return {\n expression: newExpression,\n intensity: 1.0,\n transitionTime: transitionTime ?? DEFAULT_TRANSITION_CONFIG.defaultTransitionTime,\n previousExpression: currentState.expression,\n transitionProgress: 0,\n };\n};\n\n/**\n * Update expression state during transition\n * \n * @param state - Current expression state\n * @param deltaTime - Time since last update (seconds)\n * @returns Updated expression state with transition progress\n * \n * @korean 표정상태업데이트\n */\nexport const updateExpressionState = (\n state: ExpressionState,\n deltaTime: number\n): ExpressionState => {\n // No transition in progress\n if (state.transitionProgress === undefined || state.transitionProgress >= 1.0) {\n return state;\n }\n\n // Calculate new progress\n const progressIncrement = deltaTime / state.transitionTime;\n const newProgress = Math.min(state.transitionProgress + progressIncrement, 1.0);\n\n // Transition complete\n if (newProgress >= 1.0) {\n return {\n expression: state.expression,\n intensity: state.intensity,\n transitionTime: state.transitionTime,\n previousExpression: undefined,\n transitionProgress: undefined,\n };\n }\n\n // Transition in progress\n return {\n ...state,\n transitionProgress: newProgress,\n };\n};\n\n/**\n * Calculate facial damage from hit\n * \n * Updates facial damage state based on hit location and damage amount.\n * Different facial regions accumulate damage independently.\n * \n * @param currentDamage - Current facial damage state\n * @param hitLocation - Location of hit on face (\"left_eye\", \"right_eye\", \"mouth\", \"nose\", etc.)\n * @param damageAmount - Amount of damage dealt (0-100)\n * @returns Updated facial damage state\n * \n * @example\n * ```typescript\n * const damage = calculateFacialDamage(\n * DEFAULT_FACIAL_DAMAGE,\n * \"left_eye\",\n * 25\n * );\n * // Returns damage state with left eye swelling increased\n * ```\n * \n * @korean 얼굴손상계산\n */\nexport const calculateFacialDamage = (\n currentDamage: FacialDamageState,\n hitLocation: string,\n damageAmount: number\n): FacialDamageState => {\n const damageIntensity = Math.min(damageAmount / 100, 1.0);\n const newDamage = { ...currentDamage };\n\n switch (hitLocation.toLowerCase()) {\n case \"left_eye\":\n case \"temple_left\":\n newDamage.leftEyeSwelling = Math.min(\n currentDamage.leftEyeSwelling + damageIntensity * 0.3,\n 1.0\n );\n newDamage.leftCheekBruise = Math.min(\n currentDamage.leftCheekBruise + damageIntensity * 0.2,\n 1.0\n );\n break;\n\n case \"right_eye\":\n case \"temple_right\":\n newDamage.rightEyeSwelling = Math.min(\n currentDamage.rightEyeSwelling + damageIntensity * 0.3,\n 1.0\n );\n newDamage.rightCheekBruise = Math.min(\n currentDamage.rightCheekBruise + damageIntensity * 0.2,\n 1.0\n );\n break;\n\n case \"mouth\":\n case \"jaw\":\n case \"chin\":\n newDamage.mouthBleeding = Math.min(\n currentDamage.mouthBleeding + damageIntensity * 0.4,\n 1.0\n );\n newDamage.jawBruise = Math.min(\n currentDamage.jawBruise + damageIntensity * 0.3,\n 1.0\n );\n break;\n\n case \"nose\":\n newDamage.noseBleeding = Math.min(\n currentDamage.noseBleeding + damageIntensity * 0.5,\n 1.0\n );\n break;\n\n case \"forehead\":\n case \"crown\":\n newDamage.foreheadBruise = Math.min(\n currentDamage.foreheadBruise + damageIntensity * 0.3,\n 1.0\n );\n break;\n\n case \"cheek_left\":\n newDamage.leftCheekBruise = Math.min(\n currentDamage.leftCheekBruise + damageIntensity * 0.4,\n 1.0\n );\n break;\n\n case \"cheek_right\":\n newDamage.rightCheekBruise = Math.min(\n currentDamage.rightCheekBruise + damageIntensity * 0.4,\n 1.0\n );\n break;\n\n default:\n // General facial hit - add minor bruising\n newDamage.leftCheekBruise = Math.min(\n currentDamage.leftCheekBruise + damageIntensity * 0.1,\n 1.0\n );\n newDamage.rightCheekBruise = Math.min(\n currentDamage.rightCheekBruise + damageIntensity * 0.1,\n 1.0\n );\n break;\n }\n\n // Update total facial damage\n newDamage.totalFacialDamage = Math.min(\n currentDamage.totalFacialDamage + damageAmount,\n 100\n );\n\n return newDamage;\n};\n\n/**\n * Reset facial damage (for new round or healing)\n * \n * @param partialReset - If true, only reduces damage by percentage (healing)\n * @param resetPercentage - Percentage to reduce damage (0-1)\n * @returns Fresh facial damage state\n * \n * @korean 얼굴손상초기화\n */\nexport const resetFacialDamage = (\n currentDamage: FacialDamageState,\n partialReset = false,\n resetPercentage = 1.0\n): FacialDamageState => {\n if (!partialReset) {\n return DEFAULT_FACIAL_DAMAGE;\n }\n\n // Partial healing - reduce all damage values\n const healingFactor = 1.0 - resetPercentage;\n return {\n leftEyeSwelling: currentDamage.leftEyeSwelling * healingFactor,\n rightEyeSwelling: currentDamage.rightEyeSwelling * healingFactor,\n mouthBleeding: currentDamage.mouthBleeding * healingFactor,\n noseBleeding: currentDamage.noseBleeding * healingFactor,\n leftCheekBruise: currentDamage.leftCheekBruise * healingFactor,\n rightCheekBruise: currentDamage.rightCheekBruise * healingFactor,\n foreheadBruise: currentDamage.foreheadBruise * healingFactor,\n jawBruise: currentDamage.jawBruise * healingFactor,\n totalFacialDamage: currentDamage.totalFacialDamage * healingFactor,\n };\n};\n\n/**\n * Get expression intensity based on combat state\n * \n * Expression intensity affects degree of facial movement.\n * Higher pain/damage = more intense expressions.\n * \n * @param expression - Current facial expression\n * @param pain - Pain level (0-100)\n * @param stamina - Stamina level (0-100)\n * @returns Expression intensity (0-1)\n * \n * @korean 표정강도가져오기\n */\nexport const getExpressionIntensity = (\n expression: FacialExpression,\n pain: number,\n stamina: number\n): number => {\n switch (expression) {\n case FacialExpression.PAINED:\n // Higher pain = more intense pained expression\n return Math.min(pain / 100, 1.0);\n\n case FacialExpression.EXHAUSTED:\n // Lower stamina = more intense exhaustion\n return Math.min(1.0 - stamina / 100, 1.0);\n\n case FacialExpression.FOCUSED:\n // High stamina = more intense focus\n return Math.min(stamina / 100, 1.0);\n\n case FacialExpression.VICTORIOUS:\n // Brief, moderate intensity\n return 0.7;\n\n case FacialExpression.DEFEATED:\n // Full intensity (unconscious)\n return 1.0;\n\n case FacialExpression.NEUTRAL:\n default:\n // Default intensity\n return 1.0;\n }\n};\n\n/**\n * Create default expression state\n * \n * @returns Default neutral expression state\n * \n * @korean 기본표정상태생성\n */\nexport const createDefaultExpressionState = (): ExpressionState => {\n return { ...DEFAULT_EXPRESSION_STATE };\n};\n\n/**\n * Create default facial damage state\n * \n * @returns Default facial damage state with no damage\n * \n * @korean 기본얼굴손상생성\n */\nexport const createDefaultFacialDamage = (): FacialDamageState => {\n return { ...DEFAULT_FACIAL_DAMAGE };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFA,IAAa,gCACX,QACA,WACA,SACA,OACA,eACA,SACA,eACqB;CAErB,IAAI,gBAAgB,IAClB,OAAO,iBAAiB;CAI1B,IAAI,SACF,OAAO,iBAAiB;CAI1B,IAAI,UAAU,IACZ,OAAO,iBAAiB;CAI1B,IAAI,YACF,OAAO,iBAAiB;CAI1B,MAAM,mBAAoB,SAAS,YAAa;CAChD,IAAI,UAAU,MAAM,mBAAmB,IACrC,OAAO,iBAAiB;CAI1B,OAAO,iBAAiB;;;;;;;;;AAiS1B,IAAa,kCAAqD;CAChE,OAAO,EAAE,GAAG,uBAAuB"}
1
+ {"version":3,"file":"FacialExpressions.js","names":[],"sources":["../../../../src/systems/animation/systems/FacialExpressions.ts"],"sourcesContent":["/**\n * Facial expression system for realistic combat emotion\n * \n * Manages facial expression state based on combat conditions:\n * - Health, stamina, pain, consciousness levels\n * - Recent combat events (hits taken/landed)\n * - Dynamic expression transitions\n * \n * @module systems/animation/FacialExpressions\n * @category Animation System\n * @korean 얼굴표정시스템\n */\n\nimport {\n FacialExpression,\n type ExpressionState,\n type FacialDamageState,\n DEFAULT_FACIAL_DAMAGE,\n DEFAULT_EXPRESSION_STATE,\n} from \"@/types/facial\";\n\n/**\n * Expression transition configuration\n * \n * @korean 표정전환설정\n */\nexport interface ExpressionTransitionConfig {\n /** Default transition time in seconds */\n readonly defaultTransitionTime: number;\n \n /** Quick transition time for immediate reactions */\n readonly quickTransitionTime: number;\n \n /** Slow transition time for gradual changes */\n readonly slowTransitionTime: number;\n}\n\n/**\n * Default expression transition configuration\n * \n * @korean 기본표정전환설정\n */\nexport const DEFAULT_TRANSITION_CONFIG: ExpressionTransitionConfig = {\n defaultTransitionTime: 0.2,\n quickTransitionTime: 0.1,\n slowTransitionTime: 0.5,\n};\n\n/**\n * Get facial expression based on current combat state\n * \n * Evaluates fighter's physical and mental state to determine appropriate\n * facial expression. Priority order:\n * 1. Defeated (unconscious)\n * 2. Pained (just hit)\n * 3. Exhausted (low stamina)\n * 4. Victorious (just landed hit)\n * 5. Focused (high resources)\n * 6. Neutral (default)\n * \n * @param health - Current health (0-100)\n * @param maxHealth - Maximum health\n * @param stamina - Current stamina (0-100)\n * @param pain - Pain level (0-100)\n * @param consciousness - Consciousness level (0-100)\n * @param justHit - Whether fighter was just hit\n * @param justLanded - Whether fighter just landed a hit\n * @returns Appropriate facial expression for combat state\n * \n * @example\n * ```typescript\n * const expression = getExpressionFromCombatState(\n * 85, // health\n * 100, // maxHealth\n * 60, // stamina\n * 20, // pain\n * 100, // consciousness\n * false, // justHit\n * true // justLanded\n * );\n * // Returns: FacialExpression.VICTORIOUS\n * ```\n * \n * @korean 전투상태로부터표정가져오기\n */\nexport const getExpressionFromCombatState = (\n health: number,\n maxHealth: number,\n stamina: number,\n _pain: number, // Reserved for future intensity calculation\n consciousness: number,\n justHit: boolean,\n justLanded: boolean\n): FacialExpression => {\n // Knocked out\n if (consciousness < 20) {\n return FacialExpression.DEFEATED;\n }\n\n // Just got hit (always show immediate reaction; pain level can control intensity)\n if (justHit) {\n return FacialExpression.PAINED;\n }\n\n // Low stamina (exhausted)\n if (stamina < 30) {\n return FacialExpression.EXHAUSTED;\n }\n\n // Just landed a hit (brief satisfaction)\n if (justLanded) {\n return FacialExpression.VICTORIOUS;\n }\n\n // High focus (ready to fight)\n const healthPercentage = (health / maxHealth) * 100;\n if (stamina > 70 && healthPercentage > 60) {\n return FacialExpression.FOCUSED;\n }\n\n // Default calm state\n return FacialExpression.NEUTRAL;\n};\n\n/**\n * Create new expression state with transition\n * \n * @param currentState - Current expression state\n * @param newExpression - New expression to transition to\n * @param transitionTime - Time to transition (seconds)\n * @returns New expression state with transition initialized\n * \n * @korean 새표정상태생성\n */\nexport const createExpressionTransition = (\n currentState: ExpressionState,\n newExpression: FacialExpression,\n transitionTime?: number\n): ExpressionState => {\n // No transition needed if same expression\n if (currentState.expression === newExpression) {\n return currentState;\n }\n\n return {\n expression: newExpression,\n intensity: 1.0,\n transitionTime: transitionTime ?? DEFAULT_TRANSITION_CONFIG.defaultTransitionTime,\n previousExpression: currentState.expression,\n transitionProgress: 0,\n };\n};\n\n/**\n * Update expression state during transition\n * \n * @param state - Current expression state\n * @param deltaTime - Time since last update (seconds)\n * @returns Updated expression state with transition progress\n * \n * @korean 표정상태업데이트\n */\nexport const updateExpressionState = (\n state: ExpressionState,\n deltaTime: number\n): ExpressionState => {\n // No transition in progress\n if (state.transitionProgress === undefined || state.transitionProgress >= 1.0) {\n return state;\n }\n\n // Calculate new progress\n const progressIncrement = deltaTime / state.transitionTime;\n const newProgress = Math.min(state.transitionProgress + progressIncrement, 1.0);\n\n // Transition complete\n if (newProgress >= 1.0) {\n return {\n expression: state.expression,\n intensity: state.intensity,\n transitionTime: state.transitionTime,\n previousExpression: undefined,\n transitionProgress: undefined,\n };\n }\n\n // Transition in progress\n return {\n ...state,\n transitionProgress: newProgress,\n };\n};\n\n/**\n * Calculate facial damage from hit\n * \n * Updates facial damage state based on hit location and damage amount.\n * Different facial regions accumulate damage independently.\n * \n * @param currentDamage - Current facial damage state\n * @param hitLocation - Location of hit on face (\"left_eye\", \"right_eye\", \"mouth\", \"nose\", etc.)\n * @param damageAmount - Amount of damage dealt (0-100)\n * @returns Updated facial damage state\n * \n * @example\n * ```typescript\n * const damage = calculateFacialDamage(\n * DEFAULT_FACIAL_DAMAGE,\n * \"left_eye\",\n * 25\n * );\n * // Returns damage state with left eye swelling increased\n * ```\n * \n * @korean 얼굴손상계산\n */\nexport const calculateFacialDamage = (\n currentDamage: FacialDamageState,\n hitLocation: string,\n damageAmount: number\n): FacialDamageState => {\n const damageIntensity = Math.min(damageAmount / 100, 1.0);\n const newDamage = { ...currentDamage };\n\n switch (hitLocation.toLowerCase()) {\n case \"left_eye\":\n case \"temple_left\":\n newDamage.leftEyeSwelling = Math.min(\n currentDamage.leftEyeSwelling + damageIntensity * 0.3,\n 1.0\n );\n newDamage.leftCheekBruise = Math.min(\n currentDamage.leftCheekBruise + damageIntensity * 0.2,\n 1.0\n );\n break;\n\n case \"right_eye\":\n case \"temple_right\":\n newDamage.rightEyeSwelling = Math.min(\n currentDamage.rightEyeSwelling + damageIntensity * 0.3,\n 1.0\n );\n newDamage.rightCheekBruise = Math.min(\n currentDamage.rightCheekBruise + damageIntensity * 0.2,\n 1.0\n );\n break;\n\n case \"mouth\":\n case \"jaw\":\n case \"chin\":\n newDamage.mouthBleeding = Math.min(\n currentDamage.mouthBleeding + damageIntensity * 0.4,\n 1.0\n );\n newDamage.jawBruise = Math.min(\n currentDamage.jawBruise + damageIntensity * 0.3,\n 1.0\n );\n break;\n\n case \"nose\":\n newDamage.noseBleeding = Math.min(\n currentDamage.noseBleeding + damageIntensity * 0.5,\n 1.0\n );\n break;\n\n case \"forehead\":\n case \"crown\":\n newDamage.foreheadBruise = Math.min(\n currentDamage.foreheadBruise + damageIntensity * 0.3,\n 1.0\n );\n break;\n\n case \"cheek_left\":\n newDamage.leftCheekBruise = Math.min(\n currentDamage.leftCheekBruise + damageIntensity * 0.4,\n 1.0\n );\n break;\n\n case \"cheek_right\":\n newDamage.rightCheekBruise = Math.min(\n currentDamage.rightCheekBruise + damageIntensity * 0.4,\n 1.0\n );\n break;\n\n default:\n // General facial hit - add minor bruising\n newDamage.leftCheekBruise = Math.min(\n currentDamage.leftCheekBruise + damageIntensity * 0.1,\n 1.0\n );\n newDamage.rightCheekBruise = Math.min(\n currentDamage.rightCheekBruise + damageIntensity * 0.1,\n 1.0\n );\n break;\n }\n\n // Update total facial damage\n newDamage.totalFacialDamage = Math.min(\n currentDamage.totalFacialDamage + damageAmount,\n 100\n );\n\n return newDamage;\n};\n\n/**\n * Reset facial damage (for new round or healing)\n * \n * @param partialReset - If true, only reduces damage by percentage (healing)\n * @param resetPercentage - Percentage to reduce damage (0-1)\n * @returns Fresh facial damage state\n * \n * @korean 얼굴손상초기화\n */\nexport const resetFacialDamage = (\n currentDamage: FacialDamageState,\n partialReset = false,\n resetPercentage = 1.0\n): FacialDamageState => {\n if (!partialReset) {\n return DEFAULT_FACIAL_DAMAGE;\n }\n\n // Partial healing - reduce all damage values\n const healingFactor = 1.0 - resetPercentage;\n return {\n leftEyeSwelling: currentDamage.leftEyeSwelling * healingFactor,\n rightEyeSwelling: currentDamage.rightEyeSwelling * healingFactor,\n mouthBleeding: currentDamage.mouthBleeding * healingFactor,\n noseBleeding: currentDamage.noseBleeding * healingFactor,\n leftCheekBruise: currentDamage.leftCheekBruise * healingFactor,\n rightCheekBruise: currentDamage.rightCheekBruise * healingFactor,\n foreheadBruise: currentDamage.foreheadBruise * healingFactor,\n jawBruise: currentDamage.jawBruise * healingFactor,\n totalFacialDamage: currentDamage.totalFacialDamage * healingFactor,\n };\n};\n\n/**\n * Get expression intensity based on combat state\n * \n * Expression intensity affects degree of facial movement.\n * Higher pain/damage = more intense expressions.\n * \n * @param expression - Current facial expression\n * @param pain - Pain level (0-100)\n * @param stamina - Stamina level (0-100)\n * @returns Expression intensity (0-1)\n * \n * @korean 표정강도가져오기\n */\nexport const getExpressionIntensity = (\n expression: FacialExpression,\n pain: number,\n stamina: number\n): number => {\n switch (expression) {\n case FacialExpression.PAINED:\n // Higher pain = more intense pained expression\n return Math.min(pain / 100, 1.0);\n\n case FacialExpression.EXHAUSTED:\n // Lower stamina = more intense exhaustion\n return Math.min(1.0 - stamina / 100, 1.0);\n\n case FacialExpression.FOCUSED:\n // High stamina = more intense focus\n return Math.min(stamina / 100, 1.0);\n\n case FacialExpression.VICTORIOUS:\n // Brief, moderate intensity\n return 0.7;\n\n case FacialExpression.DEFEATED:\n // Full intensity (unconscious)\n return 1.0;\n\n case FacialExpression.NEUTRAL:\n default:\n // Default intensity\n return 1.0;\n }\n};\n\n/**\n * Create default expression state\n * \n * @returns Default neutral expression state\n * \n * @korean 기본표정상태생성\n */\nexport const createDefaultExpressionState = (): ExpressionState => {\n return { ...DEFAULT_EXPRESSION_STATE };\n};\n\n/**\n * Create default facial damage state\n * \n * @returns Default facial damage state with no damage\n * \n * @korean 기본얼굴손상생성\n */\nexport const createDefaultFacialDamage = (): FacialDamageState => {\n return { ...DEFAULT_FACIAL_DAMAGE };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFA,IAAa,gCACX,QACA,WACA,SACA,OACA,eACA,SACA,eACqB;CAErB,IAAI,gBAAgB,IAClB,OAAO,iBAAiB;CAI1B,IAAI,SACF,OAAO,iBAAiB;CAI1B,IAAI,UAAU,IACZ,OAAO,iBAAiB;CAI1B,IAAI,YACF,OAAO,iBAAiB;CAI1B,MAAM,mBAAoB,SAAS,YAAa;CAChD,IAAI,UAAU,MAAM,mBAAmB,IACrC,OAAO,iBAAiB;CAI1B,OAAO,iBAAiB;AAC1B;;;;;;;;AAgSA,IAAa,kCAAqD;CAChE,OAAO,EAAE,GAAG,sBAAsB;AACpC"}