blacktrigram 0.7.39 → 0.7.40

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 (354) 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.js.map +1 -1
  14. package/lib/components/screens/combat/components/controls/CombatButtons.js.map +1 -1
  15. package/lib/components/screens/combat/components/controls/CombatControlsPanel.js.map +1 -1
  16. package/lib/components/screens/combat/components/controls/ControlsGuide.js.map +1 -1
  17. package/lib/components/screens/combat/components/controls/KeyboardHints.js.map +1 -1
  18. package/lib/components/screens/combat/components/controls/PauseMenu.js.map +1 -1
  19. package/lib/components/screens/combat/components/controls/PauseMenuButton.js.map +1 -1
  20. package/lib/components/screens/combat/components/controls/QuickSettings.js.map +1 -1
  21. package/lib/components/screens/combat/components/effects/BloodDecals3D.js.map +1 -1
  22. package/lib/components/screens/combat/components/effects/BloodLossOverlayHtml.js.map +1 -1
  23. package/lib/components/screens/combat/components/effects/BloodParticles3D.js.map +1 -1
  24. package/lib/components/screens/combat/components/effects/BloodViscosity3D.js.map +1 -1
  25. package/lib/components/screens/combat/components/effects/CombatParticleEffects3D.js.map +1 -1
  26. package/lib/components/screens/combat/components/effects/ConsciousnessBlur.js.map +1 -1
  27. package/lib/components/screens/combat/components/effects/InternalDamage3D.js.map +1 -1
  28. package/lib/components/screens/combat/components/effects/PainVignette.js.map +1 -1
  29. package/lib/components/screens/combat/components/effects/ParticleAudio3D.js.map +1 -1
  30. package/lib/components/screens/combat/components/effects/TraumaOverlay3D.js.map +1 -1
  31. package/lib/components/screens/combat/components/feedback/MatchCountdown.js.map +1 -1
  32. package/lib/components/screens/combat/components/feedback/RoundAnnouncementOverlayHtml.js.map +1 -1
  33. package/lib/components/screens/combat/components/feedback/RoundDisplayStatus.js.map +1 -1
  34. package/lib/components/screens/combat/components/feedback/RoundStartAnnouncementOverlayHtml.js.map +1 -1
  35. package/lib/components/screens/combat/components/hud/CombatBottomHUD.js.map +1 -1
  36. package/lib/components/screens/combat/components/hud/CombatLeftHUD.js.map +1 -1
  37. package/lib/components/screens/combat/components/hud/CombatPortraitStatusStrip.js.map +1 -1
  38. package/lib/components/screens/combat/components/hud/CombatRightHUD.js.map +1 -1
  39. package/lib/components/screens/combat/components/hud/CombatTopHUD.js.map +1 -1
  40. package/lib/components/screens/combat/components/hud/DifficultyIndicator.js.map +1 -1
  41. package/lib/components/screens/combat/components/hud/FPSMonitor.js.map +1 -1
  42. package/lib/components/screens/combat/components/hud/MobileControlsWrapper.js.map +1 -1
  43. package/lib/components/screens/combat/components/hud/PlayerStateOverlayHtml.js.map +1 -1
  44. package/lib/components/screens/combat/components/indicators/BalanceIndicator.js.map +1 -1
  45. package/lib/components/screens/combat/components/indicators/InputBufferDisplay.js.map +1 -1
  46. package/lib/components/screens/combat/components/indicators/StaminaWarning.js.map +1 -1
  47. package/lib/components/screens/combat/components/indicators/TechniqueNameDisplay.js.map +1 -1
  48. package/lib/components/screens/combat/helpers/AnimationUpdater.js.map +1 -1
  49. package/lib/components/screens/combat/helpers/combatHelpers.js.map +1 -1
  50. package/lib/components/screens/combat/hooks/useAICombat.js.map +1 -1
  51. package/lib/components/screens/combat/hooks/useCombatActions.js.map +1 -1
  52. package/lib/components/screens/combat/hooks/useCombatAttackMovement.js.map +1 -1
  53. package/lib/components/screens/combat/hooks/useCombatAudio.js.map +1 -1
  54. package/lib/components/screens/combat/hooks/useCombatLayout.js.map +1 -1
  55. package/lib/components/screens/combat/hooks/useCombatState.js.map +1 -1
  56. package/lib/components/screens/controls/ControlsScreen3D.js.map +1 -1
  57. package/lib/components/screens/controls/components/ControlBindingsOverlayHtml.js.map +1 -1
  58. package/lib/components/screens/controls/components/ControlCategoryTabsOverlayHtml.js.map +1 -1
  59. package/lib/components/screens/controls/components/GamepadVisualization3D.js.map +1 -1
  60. package/lib/components/screens/controls/components/InteractiveControlDemoOverlayHtml.js.map +1 -1
  61. package/lib/components/screens/controls/components/Key3D.js.map +1 -1
  62. package/lib/components/screens/controls/components/VisualKeyboard3D.js.map +1 -1
  63. package/lib/components/screens/controls/constants/ControlsConstants.js.map +1 -1
  64. package/lib/components/screens/controls/hooks/useControlsState.js.map +1 -1
  65. package/lib/components/screens/endscreen/EndScreen3D.js.map +1 -1
  66. package/lib/components/screens/endscreen/components/DefeatAnimation3D.js.map +1 -1
  67. package/lib/components/screens/endscreen/components/MatchStatisticsDisplayOverlayHtml.js.map +1 -1
  68. package/lib/components/screens/endscreen/components/NavigationButtonsOverlayHtml.js.map +1 -1
  69. package/lib/components/screens/endscreen/components/PerformanceBreakdownOverlayHtml.js.map +1 -1
  70. package/lib/components/screens/endscreen/components/PerformanceRatingOverlayHtml.js.map +1 -1
  71. package/lib/components/screens/endscreen/components/VictoryAnimation3D.js.map +1 -1
  72. package/lib/components/screens/endscreen/components/WinnerDisplayOverlayHtml.js.map +1 -1
  73. package/lib/components/screens/intro/IntroScreen3D.js +1 -1
  74. package/lib/components/screens/intro/IntroScreen3D.js.map +1 -1
  75. package/lib/components/screens/intro/components/AbilityListOverlayHtml.js.map +1 -1
  76. package/lib/components/screens/intro/components/ArchetypeCardGridOverlayHtml.js.map +1 -1
  77. package/lib/components/screens/intro/components/ArchetypeCardOverlayHtml.js.map +1 -1
  78. package/lib/components/screens/intro/components/ArchetypeDisplayOverlayHtml.js.map +1 -1
  79. package/lib/components/screens/intro/components/EnhancedArchetypeDisplayOverlayHtml.js.map +1 -1
  80. package/lib/components/screens/intro/components/MenuButtonsOverlayHtml.js.map +1 -1
  81. package/lib/components/screens/intro/components/MenuSectionOverlayHtml.js.map +1 -1
  82. package/lib/components/screens/intro/components/StatBarOverlayHtml.js.map +1 -1
  83. package/lib/components/screens/philosophy/PhilosophyScreen3D.js.map +1 -1
  84. package/lib/components/screens/training/TrainingScreen3D.js.map +1 -1
  85. package/lib/components/screens/training/components/AnatomyControlsOverlayHtml.js.map +1 -1
  86. package/lib/components/screens/training/components/AnatomyOverlay3D.js.map +1 -1
  87. package/lib/components/screens/training/components/FootPlacementMarkers3D.js.map +1 -1
  88. package/lib/components/screens/training/components/FootworkDrillsOverlayHtml.js.map +1 -1
  89. package/lib/components/screens/training/components/HitFeedbackEffect3D.js.map +1 -1
  90. package/lib/components/screens/training/components/TrainingButtonsOverlayHtml.js.map +1 -1
  91. package/lib/components/screens/training/components/TrainingControlsOverlayHtml.js.map +1 -1
  92. package/lib/components/screens/training/components/TrainingDummy3D.js.map +1 -1
  93. package/lib/components/screens/training/components/TrainingFeedbackOverlayHtml.js.map +1 -1
  94. package/lib/components/screens/training/components/TrainingModeSelectorOverlayHtml.js.map +1 -1
  95. package/lib/components/screens/training/components/TrainingStatsOverlayHtml.js.map +1 -1
  96. package/lib/components/screens/training/components/VitalPointMarker3D.js.map +1 -1
  97. package/lib/components/screens/training/components/VitalPointTrainingOverlayHtml.js.map +1 -1
  98. package/lib/components/screens/training/components/hud/TrainingBottomHUD.js.map +1 -1
  99. package/lib/components/screens/training/components/hud/TrainingLeftHUD.js.map +1 -1
  100. package/lib/components/screens/training/components/hud/TrainingRightHUD.js.map +1 -1
  101. package/lib/components/screens/training/components/hud/TrainingTopHUD.js.map +1 -1
  102. package/lib/components/screens/training/hooks/useAttackMovement.js.map +1 -1
  103. package/lib/components/screens/training/hooks/useTrainingActions.js.map +1 -1
  104. package/lib/components/screens/training/hooks/useTrainingLayout.js.map +1 -1
  105. package/lib/components/screens/training/hooks/useTrainingState.js.map +1 -1
  106. package/lib/components/shared/base/BaseButton.js.map +1 -1
  107. package/lib/components/shared/base/BaseButtonOverlayHtml.js.map +1 -1
  108. package/lib/components/shared/base/BasePanel.js.map +1 -1
  109. package/lib/components/shared/base/BaseText.js.map +1 -1
  110. package/lib/components/shared/base/useKoreanTheme.js.map +1 -1
  111. package/lib/components/shared/debug/PerformanceDebugOverlayHtml.js.map +1 -1
  112. package/lib/components/shared/mobile/ActionButtons.js.map +1 -1
  113. package/lib/components/shared/mobile/GestureRecognizerPure.js.map +1 -1
  114. package/lib/components/shared/mobile/HapticController.js.map +1 -1
  115. package/lib/components/shared/mobile/MobileControlsPure.js.map +1 -1
  116. package/lib/components/shared/mobile/StanceWheelPure.js.map +1 -1
  117. package/lib/components/shared/mobile/TouchOptimizer.js.map +1 -1
  118. package/lib/components/shared/mobile/VirtualDPad.js.map +1 -1
  119. package/lib/components/shared/three/anatomy/BodySurface.js.map +1 -1
  120. package/lib/components/shared/three/anatomy/BoneAttachedMuscles.js.map +1 -1
  121. package/lib/components/shared/three/anatomy/BoneClothing.js.map +1 -1
  122. package/lib/components/shared/three/anatomy/BoneRenderer.js.map +1 -1
  123. package/lib/components/shared/three/anatomy/Face3D.js.map +1 -1
  124. package/lib/components/shared/three/anatomy/Foot3D.js.map +1 -1
  125. package/lib/components/shared/three/anatomy/Hand3D.js.map +1 -1
  126. package/lib/components/shared/three/effects/ActionFeedback.js.map +1 -1
  127. package/lib/components/shared/three/effects/DamageNumbers.js.map +1 -1
  128. package/lib/components/shared/three/effects/HitEffects3D.js.map +1 -1
  129. package/lib/components/shared/three/effects/PlayerStateIndicators.js.map +1 -1
  130. package/lib/components/shared/three/effects/StanceSymbol3D.js.map +1 -1
  131. package/lib/components/shared/three/effects/StanceTransitionEffect.js.map +1 -1
  132. package/lib/components/shared/three/effects/VitalPointMarkers3D.js.map +1 -1
  133. package/lib/components/shared/three/indicators/ElementalColorSystem.js.map +1 -1
  134. package/lib/components/shared/three/indicators/GuardIndicator.js.map +1 -1
  135. package/lib/components/shared/three/indicators/HapticFeedback.js.map +1 -1
  136. package/lib/components/shared/three/indicators/StanceChangeIndicator.js.map +1 -1
  137. package/lib/components/shared/three/models/Player3DWithTransitions.js.map +1 -1
  138. package/lib/components/shared/three/models/SkeletalPlayer3D.js.map +1 -1
  139. package/lib/components/shared/three/optimization/AdaptiveQuality.js.map +1 -1
  140. package/lib/components/shared/three/scene/AtmosphericParticles3D.js.map +1 -1
  141. package/lib/components/shared/three/scene/BackgroundScene3D.js.map +1 -1
  142. package/lib/components/shared/three/scene/CombatArena3D.js.map +1 -1
  143. package/lib/components/shared/three/scene/KoreanSignage3D.js.map +1 -1
  144. package/lib/components/shared/three/ui/ArchetypeCard.js.map +1 -1
  145. package/lib/components/shared/three/ui/BodyPartHealthDisplay.js.map +1 -1
  146. package/lib/components/shared/three/ui/BreathingIndicator2.js.map +1 -1
  147. package/lib/components/shared/three/ui/CombatReadinessBar.js.map +1 -1
  148. package/lib/components/shared/three/ui/ComboCounter.js.map +1 -1
  149. package/lib/components/shared/three/ui/HealthBar.js.map +1 -1
  150. package/lib/components/shared/three/ui/KoreanButton.js.map +1 -1
  151. package/lib/components/shared/three/ui/KoreanPanel.js.map +1 -1
  152. package/lib/components/shared/three/ui/KoreanText.js.map +1 -1
  153. package/lib/components/shared/three/ui/MenuList.js.map +1 -1
  154. package/lib/components/shared/three/ui/PlayerHUD.js.map +1 -1
  155. package/lib/components/shared/three/ui/ProgressBar.js.map +1 -1
  156. package/lib/components/shared/three/ui/SpeedIndicatorHUD.js.map +1 -1
  157. package/lib/components/shared/three/ui/StaminaBar.js.map +1 -1
  158. package/lib/components/shared/three/ui/TechniqueBar.js.map +1 -1
  159. package/lib/components/shared/three/ui/TechniqueCard.js.map +1 -1
  160. package/lib/components/shared/three/ui/VitalPointOverlayControlsHtml.js.map +1 -1
  161. package/lib/components/shared/ui/BackButton.js.map +1 -1
  162. package/lib/components/shared/ui/BaseHUDContainer.js.map +1 -1
  163. package/lib/components/shared/ui/CombatTimer.js.map +1 -1
  164. package/lib/components/shared/ui/ErrorModal.js.map +1 -1
  165. package/lib/components/shared/ui/LoadingState.js.map +1 -1
  166. package/lib/components/shared/ui/SplashScreen.js +2 -2
  167. package/lib/components/shared/ui/SplashScreen.js.map +1 -1
  168. package/lib/components/shared/ui/VitalPointOverlayControlsPure.js.map +1 -1
  169. package/lib/components/shared/ui/VolumeControl.js.map +1 -1
  170. package/lib/components/shared/ui/shared/ConfirmDialog.js.map +1 -1
  171. package/lib/components/ui/combat/BalanceIndicatorOverlayHtml.js.map +1 -1
  172. package/lib/constants/bodyDimensions.js.map +1 -1
  173. package/lib/constants/bodyRenderingConstants.js.map +1 -1
  174. package/lib/data/archetypeClothing.js.map +1 -1
  175. package/lib/data/archetypePhysicalAttributes.js.map +1 -1
  176. package/lib/data/techniqueMappings.js.map +1 -1
  177. package/lib/data/techniques.js.map +1 -1
  178. package/lib/hooks/useActionFeedback.js.map +1 -1
  179. package/lib/hooks/useBalanceAnimations.js.map +1 -1
  180. package/lib/hooks/useCombatTimer.js.map +1 -1
  181. package/lib/hooks/useDebounce.js.map +1 -1
  182. package/lib/hooks/useHUDLayout.js.map +1 -1
  183. package/lib/hooks/useHandPoseTransitions.js.map +1 -1
  184. package/lib/hooks/useKeyboardControls.js.map +1 -1
  185. package/lib/hooks/useMatchCountdown.js.map +1 -1
  186. package/lib/hooks/useMuscleActivation.js.map +1 -1
  187. package/lib/hooks/usePauseMenu.js.map +1 -1
  188. package/lib/hooks/usePlayerAnimation.js.map +1 -1
  189. package/lib/hooks/useResponsiveLayout.js.map +1 -1
  190. package/lib/hooks/useRoundTransition.js.map +1 -1
  191. package/lib/hooks/useSkeletalAnimation.js.map +1 -1
  192. package/lib/hooks/useTechniqueSelection.js.map +1 -1
  193. package/lib/hooks/useThrottle.js.map +1 -1
  194. package/lib/hooks/useTouchControls.js.map +1 -1
  195. package/lib/hooks/useWebGLContextLossHandler.js.map +1 -1
  196. package/lib/hooks/useWindowSize.js.map +1 -1
  197. package/lib/systems/CombatSystem.js.map +1 -1
  198. package/lib/systems/EffectCalculator.js.map +1 -1
  199. package/lib/systems/LayoutSystem.js.map +1 -1
  200. package/lib/systems/PlayerEffectManager.js.map +1 -1
  201. package/lib/systems/ResponsiveScaling.js.map +1 -1
  202. package/lib/systems/TrigramSystem.js.map +1 -1
  203. package/lib/systems/VitalPointSystem.js.map +1 -1
  204. package/lib/systems/ai/AIPersonality.js.map +1 -1
  205. package/lib/systems/ai/AdaptiveDifficulty.js.map +1 -1
  206. package/lib/systems/ai/ArchetypeEnforcer.js.map +1 -1
  207. package/lib/systems/ai/ComboSystem.js.map +1 -1
  208. package/lib/systems/ai/DecisionTree.js.map +1 -1
  209. package/lib/systems/ai/TrainingAI.js.map +1 -1
  210. package/lib/systems/ai/types.js.map +1 -1
  211. package/lib/systems/animation/builders/AnimationBuilder.js.map +1 -1
  212. package/lib/systems/animation/builders/HandPoseApplicator.js.map +1 -1
  213. package/lib/systems/animation/builders/HandPoses.js.map +1 -1
  214. package/lib/systems/animation/builders/KeyframeConfig.js.map +1 -1
  215. package/lib/systems/animation/builders/KeyframeInterpolation.js +3 -90
  216. package/lib/systems/animation/builders/KeyframeInterpolation.js.map +1 -1
  217. package/lib/systems/animation/builders/KickPhaseApplicator.js.map +1 -1
  218. package/lib/systems/animation/builders/KoreanGuardPositions.js.map +1 -1
  219. package/lib/systems/animation/builders/MartialArtsAnimationBuilder.js.map +1 -1
  220. package/lib/systems/animation/builders/MartialArtsConstants.js.map +1 -1
  221. package/lib/systems/animation/builders/MartialPoseApplicator.js.map +1 -1
  222. package/lib/systems/animation/builders/PunchPhaseApplicator.js.map +1 -1
  223. package/lib/systems/animation/builders/SkeletonRig.js.map +1 -1
  224. package/lib/systems/animation/builders/TrigramGuardApplicator.js.map +1 -1
  225. package/lib/systems/animation/catalogs/DefensiveAnimations.js.map +1 -1
  226. package/lib/systems/animation/catalogs/FootworkSkeletalAnimations.js.map +1 -1
  227. package/lib/systems/animation/catalogs/RecoveryAnimations.js.map +1 -1
  228. package/lib/systems/animation/catalogs/StanceAnimations.js.map +1 -1
  229. package/lib/systems/animation/catalogs/StanceAttackAnimations.js.map +1 -1
  230. package/lib/systems/animation/catalogs/StanceGuardPoses.js.map +1 -1
  231. package/lib/systems/animation/catalogs/StanceIdleAnimations.js.map +1 -1
  232. package/lib/systems/animation/catalogs/StanceLocomotionAnimations.js.map +1 -1
  233. package/lib/systems/animation/catalogs/StepSkeletalAnimations.js.map +1 -1
  234. package/lib/systems/animation/core/AnimationHitTiming.js.map +1 -1
  235. package/lib/systems/animation/core/AnimationOptimizations.js.map +1 -1
  236. package/lib/systems/animation/core/AnimationPriority.js.map +1 -1
  237. package/lib/systems/animation/core/AnimationRegistry.js.map +1 -1
  238. package/lib/systems/animation/core/AnimationStateMachine.js.map +1 -1
  239. package/lib/systems/animation/core/AnimationTransitions.js.map +1 -1
  240. package/lib/systems/animation/core/LateralityTransform.js.map +1 -1
  241. package/lib/systems/animation/core/RecoveryPhaseEnhancer.js.map +1 -1
  242. package/lib/systems/animation/core/TechniqueAnimationMapper.js.map +1 -1
  243. package/lib/systems/animation/core/TechniqueAnimationMapping.js.map +1 -1
  244. package/lib/systems/animation/core/types.js.map +1 -1
  245. package/lib/systems/animation/systems/AdvancedJointMovements.js.map +1 -1
  246. package/lib/systems/animation/systems/BodyFacingSystem.js.map +1 -1
  247. package/lib/systems/animation/systems/FacialExpressions.js.map +1 -1
  248. package/lib/systems/animation/systems/FallAnimations.js.map +1 -1
  249. package/lib/systems/animation/systems/MuscleActivation.js.map +1 -1
  250. package/lib/systems/bodypart/BodyPartDamageIntegration.js.map +1 -1
  251. package/lib/systems/bodypart/BodyPartHealthSystem.js.map +1 -1
  252. package/lib/systems/bodypart/BodyPartPositionMapping.js.map +1 -1
  253. package/lib/systems/bodypart/CombatInjuryIntegration.js.map +1 -1
  254. package/lib/systems/bodypart/InjuryIntegration.js.map +1 -1
  255. package/lib/systems/bodypart/InjuryTracker.js.map +1 -1
  256. package/lib/systems/bodypart/MovementPenaltySystem.js.map +1 -1
  257. package/lib/systems/bodypart/PlayerInjuryTrackingManager.js.map +1 -1
  258. package/lib/systems/bodypart/types.js.map +1 -1
  259. package/lib/systems/breathing/BreathingDisruptionSystem.js.map +1 -1
  260. package/lib/systems/breathing/feedback.js.map +1 -1
  261. package/lib/systems/breathing/integration.js.map +1 -1
  262. package/lib/systems/combat/BalanceSystem.js.map +1 -1
  263. package/lib/systems/combat/BreakingStatusEffects.js.map +1 -1
  264. package/lib/systems/combat/CombatStateSystem.js.map +1 -1
  265. package/lib/systems/combat/ConsciousnessSystem.js.map +1 -1
  266. package/lib/systems/combat/FallIntegration.js.map +1 -1
  267. package/lib/systems/combat/GrappleSystem.js.map +1 -1
  268. package/lib/systems/combat/LimbExposureSystem.js.map +1 -1
  269. package/lib/systems/combat/PainResponseSystem.js.map +1 -1
  270. package/lib/systems/combat/TrainingCombatSystem.js.map +1 -1
  271. package/lib/systems/combat/painConsciousnessUtils.js.map +1 -1
  272. package/lib/systems/combat/typeGuards.js.map +1 -1
  273. package/lib/systems/effects.js.map +1 -1
  274. package/lib/systems/game.js.map +1 -1
  275. package/lib/systems/movement/InjuryMovementModifier.js.map +1 -1
  276. package/lib/systems/movement/helpers/AccelerationUpdater.js.map +1 -1
  277. package/lib/systems/movement/helpers/accelerationUtils.js.map +1 -1
  278. package/lib/systems/movement/integration.js.map +1 -1
  279. package/lib/systems/physics/AttackMovementPhysics.js.map +1 -1
  280. package/lib/systems/physics/CollisionDetection.js.map +1 -1
  281. package/lib/systems/physics/CoordinateMapper.js.map +1 -1
  282. package/lib/systems/physics/KnockbackPhysics.js.map +1 -1
  283. package/lib/systems/physics/MovementPhysics.js.map +1 -1
  284. package/lib/systems/physics/PhysicalReachCalculator.js.map +1 -1
  285. package/lib/systems/physics/SpeedModifierSystem.js.map +1 -1
  286. package/lib/systems/trigram/KoreanCulture.js.map +1 -1
  287. package/lib/systems/trigram/KoreanTechniques.js.map +1 -1
  288. package/lib/systems/trigram/StanceManager.js.map +1 -1
  289. package/lib/systems/trigram/TransitionCalculator.js.map +1 -1
  290. package/lib/systems/trigram/TrigramCalculator.js.map +1 -1
  291. package/lib/systems/trigram/techniques/DarkOpsTechniques.js.map +1 -1
  292. package/lib/systems/trigram/techniques/GamTechniques.js.map +1 -1
  293. package/lib/systems/trigram/techniques/GanTechniques.js.map +1 -1
  294. package/lib/systems/trigram/techniques/GonTechniques.js.map +1 -1
  295. package/lib/systems/trigram/techniques/SonTechniques.js.map +1 -1
  296. package/lib/systems/trigram/techniques/TechniqueConfig.js.map +1 -1
  297. package/lib/systems/trigram/techniques/index.js.map +1 -1
  298. package/lib/systems/trigram/types/GonTechniqueExtensions.js.map +1 -1
  299. package/lib/systems/trigram/types.js.map +1 -1
  300. package/lib/systems/types.js.map +1 -1
  301. package/lib/systems/vitalpoint/DamageCalculator.js.map +1 -1
  302. package/lib/systems/vitalpoint/HitDetection.js.map +1 -1
  303. package/lib/systems/vitalpoint/KoreanAnatomy.js.map +1 -1
  304. package/lib/systems/vitalpoint/KoreanVitalPoints.js.map +1 -1
  305. package/lib/systems/vitalpoint/MeridianVitalPointMapping.js.map +1 -1
  306. package/lib/types/AccessibilityTypes.js.map +1 -1
  307. package/lib/types/PhysicsTypes.js.map +1 -1
  308. package/lib/types/common.js.map +1 -1
  309. package/lib/types/constants/colors.js.map +1 -1
  310. package/lib/types/constants/designSystem.js.map +1 -1
  311. package/lib/types/constants/layout.js.map +1 -1
  312. package/lib/types/constants/performance.js.map +1 -1
  313. package/lib/types/constants/typography.js.map +1 -1
  314. package/lib/types/facial.js.map +1 -1
  315. package/lib/types/hand-animation.js.map +1 -1
  316. package/lib/types/injury.js.map +1 -1
  317. package/lib/types/physics.js.map +1 -1
  318. package/lib/types/skeletal.js.map +1 -1
  319. package/lib/types/techniqueId.js.map +1 -1
  320. package/lib/utils/accessibility.js.map +1 -1
  321. package/lib/utils/arenaWorldDimensions.js.map +1 -1
  322. package/lib/utils/assetConfig.js.map +1 -1
  323. package/lib/utils/characterScaling.js.map +1 -1
  324. package/lib/utils/colorHelpers.js.map +1 -1
  325. package/lib/utils/colorUtils.js.map +1 -1
  326. package/lib/utils/combatReadiness.js.map +1 -1
  327. package/lib/utils/controlMapping.js.map +1 -1
  328. package/lib/utils/deviceDetection.js.map +1 -1
  329. package/lib/utils/effectUtils.js.map +1 -1
  330. package/lib/utils/fabricTextures.js.map +1 -1
  331. package/lib/utils/hapticFeedback.js.map +1 -1
  332. package/lib/utils/haptics.js.map +1 -1
  333. package/lib/utils/htmlOverlayHelpers.js.map +1 -1
  334. package/lib/utils/inputSystem.js.map +1 -1
  335. package/lib/utils/koreanThemeHelpers.js.map +1 -1
  336. package/lib/utils/math.js.map +1 -1
  337. package/lib/utils/mobileLayoutHelpers.js.map +1 -1
  338. package/lib/utils/mobileUIUtils.js.map +1 -1
  339. package/lib/utils/performance/PerformanceMonitor.js.map +1 -1
  340. package/lib/utils/performance/PerformanceOverlay3D.js.map +1 -1
  341. package/lib/utils/performance/usePerformanceMonitor.js.map +1 -1
  342. package/lib/utils/performanceOptimization.js.map +1 -1
  343. package/lib/utils/player3DHelpers.js.map +1 -1
  344. package/lib/utils/playerUtils.js.map +1 -1
  345. package/lib/utils/responsiveLayout.js.map +1 -1
  346. package/lib/utils/responsiveLayoutHelpers.js.map +1 -1
  347. package/lib/utils/responsiveOrientationConstants.js.map +1 -1
  348. package/lib/utils/safeAreaUtils.js.map +1 -1
  349. package/lib/utils/sharedPhysicsConfig.js.map +1 -1
  350. package/lib/utils/skeletonScaling.js.map +1 -1
  351. package/lib/utils/stanceHelpers.js.map +1 -1
  352. package/lib/utils/threeObjectPool.js.map +1 -1
  353. package/lib/utils/visualEffects.js.map +1 -1
  354. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"BloodParticles3D.js","names":[],"sources":["../../../../../../src/components/screens/combat/components/effects/BloodParticles3D.tsx"],"sourcesContent":["/**\n * BloodParticles3D - Realistic blood splatter particle system\n *\n * Creates physics-based blood particles that spray from impact points with gravity,\n * creating pools on the arena floor. Optimized for 60fps with instanced rendering.\n *\n * Features:\n * - Gravity-based particle physics\n * - Blood pool accumulation on floor\n * - 10-second fade-out for pools\n * - Instanced rendering for performance\n * - Mobile-optimized particle counts\n *\n * @module components/combat/BloodParticles3D\n * @category Combat Effects\n * @korean 피입자3D\n */\n\nimport { Points, PointMaterial } from \"@react-three/drei\";\nimport { useFrame } from \"@react-three/fiber\";\nimport React, { useRef, useMemo } from \"react\";\nimport * as THREE from \"three\";\nimport { KOREAN_COLORS } from \"../../../../../types/constants\";\nimport { ThreeObjectPools } from \"../../../../../utils/threeObjectPool\";\n\n/**\n * Blood particle data structure for efficient simulation\n * \n * PERFORMANCE: position and velocity now use pooled Vector3 objects\n * that are acquired on particle creation and released on expiration\n */\ninterface BloodParticle {\n /** Current position [x, y, z] - POOLED Vector3 */\n position: THREE.Vector3;\n /** Current velocity [x, y, z] - POOLED Vector3 */\n velocity: THREE.Vector3;\n /** Particle lifetime in seconds */\n lifetime: number;\n /** Time elapsed since creation */\n age: number;\n /** Whether particle has settled on floor */\n settled: boolean;\n /** Flag to track if vectors are pooled and need release */\n isPooled: boolean;\n}\n\n/**\n * Blood splatter effect configuration\n */\nexport interface BloodSplatterEffect {\n /** Unique identifier */\n readonly id: string;\n /** Origin position in 3D world space */\n readonly position: [number, number, number];\n /** Impact direction for splatter */\n readonly direction: [number, number, number];\n /** Intensity of effect (0.0 to 1.0) */\n readonly intensity: number;\n /** Timestamp when effect was created */\n readonly startTime: number;\n}\n\n/**\n * Props for BloodParticles3D component\n */\nexport interface BloodParticles3DProps {\n /** Active blood splatter effects to render */\n readonly effects: readonly BloodSplatterEffect[];\n /** Whether to enable blood effects (violence settings) */\n readonly enabled?: boolean;\n /** Mobile device mode (reduced particle count) */\n readonly isMobile?: boolean;\n /** Callback when effect completes */\n readonly onEffectComplete?: (effectId: string) => void;\n}\n\n/**\n * Performance and physics constants\n */\nconst BLOOD_CONSTANTS = {\n /** Gravity acceleration (m/s²) */\n GRAVITY: -9.8,\n /** Maximum particles per splatter effect */\n MAX_PARTICLES_DESKTOP: 300,\n MAX_PARTICLES_MOBILE: 100,\n /** Particle lifetime in seconds */\n PARTICLE_LIFETIME: 2.0,\n /** Blood pool fade duration in seconds */\n POOL_FADE_DURATION: 10.0,\n /** Initial velocity range */\n VELOCITY_MIN: 2.0,\n VELOCITY_MAX: 5.0,\n /** Spread angle in radians */\n SPREAD_ANGLE: Math.PI / 3,\n /** Floor Y position */\n FLOOR_Y: 0.0,\n /** Particle size */\n PARTICLE_SIZE: 0.05,\n /**\n * Maximum per-frame delta time (seconds) used to clamp the blood physics update.\n * \n * We cap the simulation step at ~33ms (1/30) to avoid the classic\n * \"spiral of death\" when the frame rate drops: very large timesteps can\n * cause unstable motion, particles tunneling through the floor, or\n * visually exaggerated splatter. Treating anything below 30fps as\n * \"slow motion\" for this effect keeps the blood behavior stable even\n * on slower devices. If the engine's minimum target frame rate changes,\n * adjust this threshold accordingly.\n */\n MAX_DELTA: 1 / 30,\n} as const;\n\n/**\n * Generate initial particles for a blood splatter effect\n * \n * PERFORMANCE OPTIMIZATION: Uses ThreeObjectPools for ALL Vector3 allocations\n * \n * Pooling Strategy (UPDATED):\n * - Acquire temp vectors for calculations (baseDir, origin, axis vectors) - RELEASED\n * - Acquire position/velocity from pool for particle ownership - MUST BE RELEASED on expiration\n * \n * Memory Impact:\n * - Before: 600 Vector3 allocations per splatter (2 per particle × 300)\n * - After: 5 temp vectors (reused) + particles use pooled vectors (released on expiration)\n * - Reduction: ~99.2% fewer allocations (600 → 5 temp + pooled reuse)\n * \n * @param effect - Blood splatter effect configuration\n * @param maxParticles - Maximum number of particles to generate\n * @returns Array of blood particles with ALL vectors from pool (must be released later)\n */\nconst generateBloodParticles = (\n effect: BloodSplatterEffect,\n maxParticles: number\n): BloodParticle[] => {\n const particles: BloodParticle[] = [];\n const particleCount = Math.floor(maxParticles * effect.intensity);\n\n // Acquire pooled temp vectors for reuse across all particles\n // These will be released after the loop completes\n const baseDir = ThreeObjectPools.vector3.acquire();\n const origin = ThreeObjectPools.vector3.acquire();\n const direction = ThreeObjectPools.vector3.acquire();\n const yAxis = ThreeObjectPools.vector3.acquire();\n const zAxis = ThreeObjectPools.vector3.acquire();\n\n // Initialize reusable vectors\n baseDir.set(...effect.direction).normalize();\n origin.set(...effect.position);\n yAxis.set(0, 1, 0);\n zAxis.set(0, 0, 1);\n\n for (let i = 0; i < particleCount; i++) {\n // Random spread around impact direction\n const spreadAngle = BLOOD_CONSTANTS.SPREAD_ANGLE;\n const phi = (Math.random() - 0.5) * spreadAngle;\n const theta = Math.random() * Math.PI * 2;\n\n // Reuse direction vector: copy base direction and apply rotations\n direction.copy(baseDir);\n direction.applyAxisAngle(yAxis, phi);\n direction.applyAxisAngle(zAxis, theta);\n\n // Random velocity magnitude\n const speed =\n BLOOD_CONSTANTS.VELOCITY_MIN +\n Math.random() * (BLOOD_CONSTANTS.VELOCITY_MAX - BLOOD_CONSTANTS.VELOCITY_MIN);\n\n // CRITICAL CHANGE: Acquire pooled vectors for particle ownership\n // These MUST be released when particle expires!\n const particlePosition = ThreeObjectPools.vector3.acquire();\n const particleVelocity = ThreeObjectPools.vector3.acquire();\n \n particlePosition.copy(origin);\n particleVelocity.copy(direction).multiplyScalar(speed);\n\n particles.push({\n position: particlePosition,\n velocity: particleVelocity,\n lifetime: BLOOD_CONSTANTS.PARTICLE_LIFETIME,\n age: 0,\n settled: false,\n isPooled: true, // Mark as pooled for cleanup\n });\n }\n\n // Release all temp vectors back to pool for reuse\n ThreeObjectPools.vector3.release(baseDir);\n ThreeObjectPools.vector3.release(origin);\n ThreeObjectPools.vector3.release(direction);\n ThreeObjectPools.vector3.release(yAxis);\n ThreeObjectPools.vector3.release(zAxis);\n\n return particles;\n};\n\n/**\n * BloodParticles3D Component\n *\n * Renders realistic blood splatter effects using physics-based particle simulation.\n * Optimized for performance with instanced rendering and efficient physics updates.\n *\n * @example\n * ```tsx\n * const [bloodEffects, setBloodEffects] = useState<BloodSplatterEffect[]>([]);\n *\n * // On hit event\n * const handleHit = (position: [number, number, number], direction: [number, number, number]) => {\n * setBloodEffects([...bloodEffects, {\n * id: generateId(),\n * position,\n * direction,\n * intensity: 0.8,\n * startTime: Date.now(),\n * }]);\n * };\n *\n * <BloodParticles3D\n * effects={bloodEffects}\n * enabled={violenceSettings.blood}\n * isMobile={isMobile}\n * onEffectComplete={(id) => {\n * setBloodEffects(prev => prev.filter(e => e.id !== id));\n * }}\n * />\n * ```\n */\nexport const BloodParticles3D: React.FC<BloodParticles3DProps> = ({\n effects,\n enabled = true,\n isMobile = false,\n onEffectComplete,\n}) => {\n // Particle system state\n const particlesRef = useRef<Map<string, BloodParticle[]>>(new Map());\n const poolParticlesRef = useRef<BloodParticle[]>([]);\n const pointsRef = useRef<THREE.Points>(null);\n const completedEffectsRef = useRef<Set<string>>(new Set());\n\n // Performance configuration\n const maxParticles = isMobile\n ? BLOOD_CONSTANTS.MAX_PARTICLES_MOBILE\n : BLOOD_CONSTANTS.MAX_PARTICLES_DESKTOP;\n\n // Blood color from Korean theme\n const bloodColor = useMemo(() => KOREAN_COLORS.BLOODLOSS_INDICATOR, []);\n\n // Initialize particles for new effects\n React.useEffect(() => {\n if (!enabled) return;\n\n effects.forEach((effect) => {\n if (!particlesRef.current.has(effect.id)) {\n const particles = generateBloodParticles(effect, maxParticles);\n particlesRef.current.set(effect.id, particles);\n }\n });\n\n // Clean up removed effects - IMPORTANT: Release pooled vectors!\n const effectIds = new Set(effects.map((e) => e.id));\n particlesRef.current.forEach((particles, id) => {\n if (!effectIds.has(id)) {\n // Release all pooled vectors for this effect\n particles.forEach((p) => {\n if (p.isPooled) {\n ThreeObjectPools.vector3.release(p.position);\n ThreeObjectPools.vector3.release(p.velocity);\n p.isPooled = false;\n }\n });\n particlesRef.current.delete(id);\n completedEffectsRef.current.delete(id);\n }\n });\n }, [effects, enabled, maxParticles]);\n\n // Cleanup on unmount - Release ALL pooled vectors\n React.useEffect(() => {\n // Capture refs at the start of effect to avoid stale closures\n const currentParticles = particlesRef.current;\n const currentPoolParticles = poolParticlesRef.current;\n const currentCompletedEffects = completedEffectsRef.current;\n \n return () => {\n // Release all active effect particles\n currentParticles.forEach((particles) => {\n particles.forEach((p) => {\n if (p.isPooled) {\n ThreeObjectPools.vector3.release(p.position);\n ThreeObjectPools.vector3.release(p.velocity);\n p.isPooled = false;\n }\n });\n });\n \n // Release all pool particles\n currentPoolParticles.forEach((p) => {\n if (p.isPooled) {\n ThreeObjectPools.vector3.release(p.position);\n ThreeObjectPools.vector3.release(p.velocity);\n p.isPooled = false;\n }\n });\n \n // Clear the pool particles array for complete cleanup\n poolParticlesRef.current = [];\n \n // Clear refs\n currentParticles.clear();\n currentCompletedEffects.clear();\n };\n }, []);\n\n // Initial particle positions for first render\n // Actual positions are updated in useFrame\n const initialPositions = useMemo(() => {\n const positions = new Float32Array(maxParticles * 3);\n // Initialize with zeros - actual positions set in useFrame\n return positions;\n }, [maxParticles]);\n\n // Physics update loop\n useFrame((_, delta) => {\n if (!enabled || !pointsRef.current) return;\n\n const safeDelta = Math.min(delta, BLOOD_CONSTANTS.MAX_DELTA);\n\n let totalParticleIndex = 0;\n const attr = pointsRef.current.geometry.attributes.position;\n const posArray = attr.array as Float32Array;\n\n // Update active splatter particles\n particlesRef.current.forEach((particles, effectId) => {\n let hasActiveParticles = false;\n\n for (let i = 0; i < particles.length; i++) {\n const p = particles[i];\n p.age += safeDelta;\n\n if (!p.settled) {\n // Apply gravity\n p.velocity.y += BLOOD_CONSTANTS.GRAVITY * safeDelta;\n\n // Update position\n p.position.addScaledVector(p.velocity, safeDelta);\n\n // Check floor collision\n if (p.position.y <= BLOOD_CONSTANTS.FLOOR_Y) {\n p.position.y = BLOOD_CONSTANTS.FLOOR_Y;\n p.velocity.set(0, 0, 0);\n p.settled = true;\n p.lifetime = BLOOD_CONSTANTS.POOL_FADE_DURATION;\n p.age = 0;\n\n // Add to pool particles\n poolParticlesRef.current.push(p);\n } else {\n hasActiveParticles = true;\n }\n }\n\n // Update render position\n if (totalParticleIndex < posArray.length / 3) {\n posArray[totalParticleIndex * 3] = p.position.x;\n posArray[totalParticleIndex * 3 + 1] = p.position.y;\n posArray[totalParticleIndex * 3 + 2] = p.position.z;\n totalParticleIndex++;\n } else if (process.env.NODE_ENV === \"development\") {\n // Warn in development when particles are being dropped due to buffer overflow\n console.warn(\n `BloodParticles3D: Particle buffer full (${posArray.length / 3} particles). ` +\n `Additional particles are not rendered. Consider reducing particle counts or ` +\n `increasing maxParticles if this happens frequently.`\n );\n }\n }\n\n // Check if effect is complete\n if (!hasActiveParticles && !completedEffectsRef.current.has(effectId)) {\n completedEffectsRef.current.add(effectId);\n onEffectComplete?.(effectId);\n }\n });\n\n // Determine the maximum number of particles we can safely render this frame.\n // This explicitly ties the visible particle cap to both the buffer size and maxParticles.\n const maxVisibleParticles = Math.min(maxParticles, posArray.length / 3);\n\n // Update blood pool particles (fade out)\n if (totalParticleIndex >= maxVisibleParticles) {\n // Buffer is full: continue aging and culling pool particles, but do not write positions.\n poolParticlesRef.current = poolParticlesRef.current.filter((p) => {\n p.age += safeDelta;\n const isAlive = p.age < p.lifetime;\n \n // Release pooled vectors when particle dies\n if (!isAlive && p.isPooled) {\n ThreeObjectPools.vector3.release(p.position);\n ThreeObjectPools.vector3.release(p.velocity);\n p.isPooled = false; // Mark as released\n }\n \n return isAlive;\n });\n } else {\n // There is still room in the buffer: write pool particle positions up to the cap.\n poolParticlesRef.current = poolParticlesRef.current.filter((p) => {\n p.age += safeDelta;\n const isAlive = p.age < p.lifetime;\n\n if (isAlive && totalParticleIndex < maxVisibleParticles) {\n posArray[totalParticleIndex * 3] = p.position.x;\n posArray[totalParticleIndex * 3 + 1] = p.position.y;\n posArray[totalParticleIndex * 3 + 2] = p.position.z;\n totalParticleIndex++;\n }\n\n // Release pooled vectors when particle dies\n if (!isAlive && p.isPooled) {\n ThreeObjectPools.vector3.release(p.position);\n ThreeObjectPools.vector3.release(p.velocity);\n p.isPooled = false; // Mark as released\n }\n\n return isAlive;\n });\n }\n\n attr.needsUpdate = true;\n });\n\n // Don't render if disabled or no effects\n if (!enabled || effects.length === 0) {\n return null;\n }\n\n return (\n <Points\n ref={pointsRef}\n positions={initialPositions}\n data-testid=\"blood-particles-3d\"\n >\n <PointMaterial\n color={bloodColor}\n size={BLOOD_CONSTANTS.PARTICLE_SIZE}\n sizeAttenuation\n transparent\n opacity={0.9}\n depthWrite={false}\n blending={THREE.NormalBlending}\n />\n </Points>\n );\n};\n\nexport default BloodParticles3D;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,IAAM,kBAAkB;;CAEtB,SAAS;;CAET,uBAAuB;CACvB,sBAAsB;;CAEtB,mBAAmB;;CAEnB,oBAAoB;;CAEpB,cAAc;CACd,cAAc;;CAEd,cAAc,KAAK,KAAK;;CAExB,SAAS;;CAET,eAAe;;;;;;;;;;;;CAYf,WAAW,IAAI;CAChB;;;;;;;;;;;;;;;;;;;AAoBD,IAAM,0BACJ,QACA,iBACoB;CACpB,MAAM,YAA6B,EAAE;CACrC,MAAM,gBAAgB,KAAK,MAAM,eAAe,OAAO,UAAU;CAIjE,MAAM,UAAU,iBAAiB,QAAQ,SAAS;CAClD,MAAM,SAAS,iBAAiB,QAAQ,SAAS;CACjD,MAAM,YAAY,iBAAiB,QAAQ,SAAS;CACpD,MAAM,QAAQ,iBAAiB,QAAQ,SAAS;CAChD,MAAM,QAAQ,iBAAiB,QAAQ,SAAS;AAGhD,SAAQ,IAAI,GAAG,OAAO,UAAU,CAAC,WAAW;AAC5C,QAAO,IAAI,GAAG,OAAO,SAAS;AAC9B,OAAM,IAAI,GAAG,GAAG,EAAE;AAClB,OAAM,IAAI,GAAG,GAAG,EAAE;AAElB,MAAK,IAAI,IAAI,GAAG,IAAI,eAAe,KAAK;EAEtC,MAAM,cAAc,gBAAgB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,SAAS;AAC5C,qBAAiB,QAAQ,QAAQ,EAAE,SAAS;AAC5C,MAAE,WAAW;;AAGf,UAAO;IACP;MAGF,kBAAiB,UAAU,iBAAiB,QAAQ,QAAQ,MAAM;AAChE,KAAE,OAAO;GACT,MAAM,UAAU,EAAE,MAAM,EAAE;AAE1B,OAAI,WAAW,qBAAqB,qBAAqB;AACvD,aAAS,qBAAqB,KAAK,EAAE,SAAS;AAC9C,aAAS,qBAAqB,IAAI,KAAK,EAAE,SAAS;AAClD,aAAS,qBAAqB,IAAI,KAAK,EAAE,SAAS;AAClD;;AAIF,OAAI,CAAC,WAAW,EAAE,UAAU;AAC1B,qBAAiB,QAAQ,QAAQ,EAAE,SAAS;AAC5C,qBAAiB,QAAQ,QAAQ,EAAE,SAAS;AAC5C,MAAE,WAAW;;AAGf,UAAO;IACP;AAGJ,OAAK,cAAc;GACnB;AAGF,KAAI,CAAC,WAAW,QAAQ,WAAW,EACjC,QAAO;AAGT,QACE,oBAAC,QAAD;EACE,KAAK;EACL,WAAW;EACX,eAAY;YAEZ,oBAAC,eAAD;GACE,OAAO;GACP,MAAM,gBAAgB;GACtB,iBAAA;GACA,aAAA;GACA,SAAS;GACT,YAAY;GACZ,UAAU,MAAM;GAChB,CAAA;EACK,CAAA"}
1
+ {"version":3,"file":"BloodParticles3D.js","names":[],"sources":["../../../../../../src/components/screens/combat/components/effects/BloodParticles3D.tsx"],"sourcesContent":["/**\n * BloodParticles3D - Realistic blood splatter particle system\n *\n * Creates physics-based blood particles that spray from impact points with gravity,\n * creating pools on the arena floor. Optimized for 60fps with instanced rendering.\n *\n * Features:\n * - Gravity-based particle physics\n * - Blood pool accumulation on floor\n * - 10-second fade-out for pools\n * - Instanced rendering for performance\n * - Mobile-optimized particle counts\n *\n * @module components/combat/BloodParticles3D\n * @category Combat Effects\n * @korean 피입자3D\n */\n\nimport { Points, PointMaterial } from \"@react-three/drei\";\nimport { useFrame } from \"@react-three/fiber\";\nimport React, { useRef, useMemo } from \"react\";\nimport * as THREE from \"three\";\nimport { KOREAN_COLORS } from \"../../../../../types/constants\";\nimport { ThreeObjectPools } from \"../../../../../utils/threeObjectPool\";\n\n/**\n * Blood particle data structure for efficient simulation\n * \n * PERFORMANCE: position and velocity now use pooled Vector3 objects\n * that are acquired on particle creation and released on expiration\n */\ninterface BloodParticle {\n /** Current position [x, y, z] - POOLED Vector3 */\n position: THREE.Vector3;\n /** Current velocity [x, y, z] - POOLED Vector3 */\n velocity: THREE.Vector3;\n /** Particle lifetime in seconds */\n lifetime: number;\n /** Time elapsed since creation */\n age: number;\n /** Whether particle has settled on floor */\n settled: boolean;\n /** Flag to track if vectors are pooled and need release */\n isPooled: boolean;\n}\n\n/**\n * Blood splatter effect configuration\n */\nexport interface BloodSplatterEffect {\n /** Unique identifier */\n readonly id: string;\n /** Origin position in 3D world space */\n readonly position: [number, number, number];\n /** Impact direction for splatter */\n readonly direction: [number, number, number];\n /** Intensity of effect (0.0 to 1.0) */\n readonly intensity: number;\n /** Timestamp when effect was created */\n readonly startTime: number;\n}\n\n/**\n * Props for BloodParticles3D component\n */\nexport interface BloodParticles3DProps {\n /** Active blood splatter effects to render */\n readonly effects: readonly BloodSplatterEffect[];\n /** Whether to enable blood effects (violence settings) */\n readonly enabled?: boolean;\n /** Mobile device mode (reduced particle count) */\n readonly isMobile?: boolean;\n /** Callback when effect completes */\n readonly onEffectComplete?: (effectId: string) => void;\n}\n\n/**\n * Performance and physics constants\n */\nconst BLOOD_CONSTANTS = {\n /** Gravity acceleration (m/s²) */\n GRAVITY: -9.8,\n /** Maximum particles per splatter effect */\n MAX_PARTICLES_DESKTOP: 300,\n MAX_PARTICLES_MOBILE: 100,\n /** Particle lifetime in seconds */\n PARTICLE_LIFETIME: 2.0,\n /** Blood pool fade duration in seconds */\n POOL_FADE_DURATION: 10.0,\n /** Initial velocity range */\n VELOCITY_MIN: 2.0,\n VELOCITY_MAX: 5.0,\n /** Spread angle in radians */\n SPREAD_ANGLE: Math.PI / 3,\n /** Floor Y position */\n FLOOR_Y: 0.0,\n /** Particle size */\n PARTICLE_SIZE: 0.05,\n /**\n * Maximum per-frame delta time (seconds) used to clamp the blood physics update.\n * \n * We cap the simulation step at ~33ms (1/30) to avoid the classic\n * \"spiral of death\" when the frame rate drops: very large timesteps can\n * cause unstable motion, particles tunneling through the floor, or\n * visually exaggerated splatter. Treating anything below 30fps as\n * \"slow motion\" for this effect keeps the blood behavior stable even\n * on slower devices. If the engine's minimum target frame rate changes,\n * adjust this threshold accordingly.\n */\n MAX_DELTA: 1 / 30,\n} as const;\n\n/**\n * Generate initial particles for a blood splatter effect\n * \n * PERFORMANCE OPTIMIZATION: Uses ThreeObjectPools for ALL Vector3 allocations\n * \n * Pooling Strategy (UPDATED):\n * - Acquire temp vectors for calculations (baseDir, origin, axis vectors) - RELEASED\n * - Acquire position/velocity from pool for particle ownership - MUST BE RELEASED on expiration\n * \n * Memory Impact:\n * - Before: 600 Vector3 allocations per splatter (2 per particle × 300)\n * - After: 5 temp vectors (reused) + particles use pooled vectors (released on expiration)\n * - Reduction: ~99.2% fewer allocations (600 → 5 temp + pooled reuse)\n * \n * @param effect - Blood splatter effect configuration\n * @param maxParticles - Maximum number of particles to generate\n * @returns Array of blood particles with ALL vectors from pool (must be released later)\n */\nconst generateBloodParticles = (\n effect: BloodSplatterEffect,\n maxParticles: number\n): BloodParticle[] => {\n const particles: BloodParticle[] = [];\n const particleCount = Math.floor(maxParticles * effect.intensity);\n\n // Acquire pooled temp vectors for reuse across all particles\n // These will be released after the loop completes\n const baseDir = ThreeObjectPools.vector3.acquire();\n const origin = ThreeObjectPools.vector3.acquire();\n const direction = ThreeObjectPools.vector3.acquire();\n const yAxis = ThreeObjectPools.vector3.acquire();\n const zAxis = ThreeObjectPools.vector3.acquire();\n\n // Initialize reusable vectors\n baseDir.set(...effect.direction).normalize();\n origin.set(...effect.position);\n yAxis.set(0, 1, 0);\n zAxis.set(0, 0, 1);\n\n for (let i = 0; i < particleCount; i++) {\n // Random spread around impact direction\n const spreadAngle = BLOOD_CONSTANTS.SPREAD_ANGLE;\n const phi = (Math.random() - 0.5) * spreadAngle;\n const theta = Math.random() * Math.PI * 2;\n\n // Reuse direction vector: copy base direction and apply rotations\n direction.copy(baseDir);\n direction.applyAxisAngle(yAxis, phi);\n direction.applyAxisAngle(zAxis, theta);\n\n // Random velocity magnitude\n const speed =\n BLOOD_CONSTANTS.VELOCITY_MIN +\n Math.random() * (BLOOD_CONSTANTS.VELOCITY_MAX - BLOOD_CONSTANTS.VELOCITY_MIN);\n\n // CRITICAL CHANGE: Acquire pooled vectors for particle ownership\n // These MUST be released when particle expires!\n const particlePosition = ThreeObjectPools.vector3.acquire();\n const particleVelocity = ThreeObjectPools.vector3.acquire();\n \n particlePosition.copy(origin);\n particleVelocity.copy(direction).multiplyScalar(speed);\n\n particles.push({\n position: particlePosition,\n velocity: particleVelocity,\n lifetime: BLOOD_CONSTANTS.PARTICLE_LIFETIME,\n age: 0,\n settled: false,\n isPooled: true, // Mark as pooled for cleanup\n });\n }\n\n // Release all temp vectors back to pool for reuse\n ThreeObjectPools.vector3.release(baseDir);\n ThreeObjectPools.vector3.release(origin);\n ThreeObjectPools.vector3.release(direction);\n ThreeObjectPools.vector3.release(yAxis);\n ThreeObjectPools.vector3.release(zAxis);\n\n return particles;\n};\n\n/**\n * BloodParticles3D Component\n *\n * Renders realistic blood splatter effects using physics-based particle simulation.\n * Optimized for performance with instanced rendering and efficient physics updates.\n *\n * @example\n * ```tsx\n * const [bloodEffects, setBloodEffects] = useState<BloodSplatterEffect[]>([]);\n *\n * // On hit event\n * const handleHit = (position: [number, number, number], direction: [number, number, number]) => {\n * setBloodEffects([...bloodEffects, {\n * id: generateId(),\n * position,\n * direction,\n * intensity: 0.8,\n * startTime: Date.now(),\n * }]);\n * };\n *\n * <BloodParticles3D\n * effects={bloodEffects}\n * enabled={violenceSettings.blood}\n * isMobile={isMobile}\n * onEffectComplete={(id) => {\n * setBloodEffects(prev => prev.filter(e => e.id !== id));\n * }}\n * />\n * ```\n */\nexport const BloodParticles3D: React.FC<BloodParticles3DProps> = ({\n effects,\n enabled = true,\n isMobile = false,\n onEffectComplete,\n}) => {\n // Particle system state\n const particlesRef = useRef<Map<string, BloodParticle[]>>(new Map());\n const poolParticlesRef = useRef<BloodParticle[]>([]);\n const pointsRef = useRef<THREE.Points>(null);\n const completedEffectsRef = useRef<Set<string>>(new Set());\n\n // Performance configuration\n const maxParticles = isMobile\n ? BLOOD_CONSTANTS.MAX_PARTICLES_MOBILE\n : BLOOD_CONSTANTS.MAX_PARTICLES_DESKTOP;\n\n // Blood color from Korean theme\n const bloodColor = useMemo(() => KOREAN_COLORS.BLOODLOSS_INDICATOR, []);\n\n // Initialize particles for new effects\n React.useEffect(() => {\n if (!enabled) return;\n\n effects.forEach((effect) => {\n if (!particlesRef.current.has(effect.id)) {\n const particles = generateBloodParticles(effect, maxParticles);\n particlesRef.current.set(effect.id, particles);\n }\n });\n\n // Clean up removed effects - IMPORTANT: Release pooled vectors!\n const effectIds = new Set(effects.map((e) => e.id));\n particlesRef.current.forEach((particles, id) => {\n if (!effectIds.has(id)) {\n // Release all pooled vectors for this effect\n particles.forEach((p) => {\n if (p.isPooled) {\n ThreeObjectPools.vector3.release(p.position);\n ThreeObjectPools.vector3.release(p.velocity);\n p.isPooled = false;\n }\n });\n particlesRef.current.delete(id);\n completedEffectsRef.current.delete(id);\n }\n });\n }, [effects, enabled, maxParticles]);\n\n // Cleanup on unmount - Release ALL pooled vectors\n React.useEffect(() => {\n // Capture refs at the start of effect to avoid stale closures\n const currentParticles = particlesRef.current;\n const currentPoolParticles = poolParticlesRef.current;\n const currentCompletedEffects = completedEffectsRef.current;\n \n return () => {\n // Release all active effect particles\n currentParticles.forEach((particles) => {\n particles.forEach((p) => {\n if (p.isPooled) {\n ThreeObjectPools.vector3.release(p.position);\n ThreeObjectPools.vector3.release(p.velocity);\n p.isPooled = false;\n }\n });\n });\n \n // Release all pool particles\n currentPoolParticles.forEach((p) => {\n if (p.isPooled) {\n ThreeObjectPools.vector3.release(p.position);\n ThreeObjectPools.vector3.release(p.velocity);\n p.isPooled = false;\n }\n });\n \n // Clear the pool particles array for complete cleanup\n poolParticlesRef.current = [];\n \n // Clear refs\n currentParticles.clear();\n currentCompletedEffects.clear();\n };\n }, []);\n\n // Initial particle positions for first render\n // Actual positions are updated in useFrame\n const initialPositions = useMemo(() => {\n const positions = new Float32Array(maxParticles * 3);\n // Initialize with zeros - actual positions set in useFrame\n return positions;\n }, [maxParticles]);\n\n // Physics update loop\n useFrame((_, delta) => {\n if (!enabled || !pointsRef.current) return;\n\n const safeDelta = Math.min(delta, BLOOD_CONSTANTS.MAX_DELTA);\n\n let totalParticleIndex = 0;\n const attr = pointsRef.current.geometry.attributes.position;\n const posArray = attr.array as Float32Array;\n\n // Update active splatter particles\n particlesRef.current.forEach((particles, effectId) => {\n let hasActiveParticles = false;\n\n for (let i = 0; i < particles.length; i++) {\n const p = particles[i];\n p.age += safeDelta;\n\n if (!p.settled) {\n // Apply gravity\n p.velocity.y += BLOOD_CONSTANTS.GRAVITY * safeDelta;\n\n // Update position\n p.position.addScaledVector(p.velocity, safeDelta);\n\n // Check floor collision\n if (p.position.y <= BLOOD_CONSTANTS.FLOOR_Y) {\n p.position.y = BLOOD_CONSTANTS.FLOOR_Y;\n p.velocity.set(0, 0, 0);\n p.settled = true;\n p.lifetime = BLOOD_CONSTANTS.POOL_FADE_DURATION;\n p.age = 0;\n\n // Add to pool particles\n poolParticlesRef.current.push(p);\n } else {\n hasActiveParticles = true;\n }\n }\n\n // Update render position\n if (totalParticleIndex < posArray.length / 3) {\n posArray[totalParticleIndex * 3] = p.position.x;\n posArray[totalParticleIndex * 3 + 1] = p.position.y;\n posArray[totalParticleIndex * 3 + 2] = p.position.z;\n totalParticleIndex++;\n } else if (process.env.NODE_ENV === \"development\") {\n // Warn in development when particles are being dropped due to buffer overflow\n console.warn(\n `BloodParticles3D: Particle buffer full (${posArray.length / 3} particles). ` +\n `Additional particles are not rendered. Consider reducing particle counts or ` +\n `increasing maxParticles if this happens frequently.`\n );\n }\n }\n\n // Check if effect is complete\n if (!hasActiveParticles && !completedEffectsRef.current.has(effectId)) {\n completedEffectsRef.current.add(effectId);\n onEffectComplete?.(effectId);\n }\n });\n\n // Determine the maximum number of particles we can safely render this frame.\n // This explicitly ties the visible particle cap to both the buffer size and maxParticles.\n const maxVisibleParticles = Math.min(maxParticles, posArray.length / 3);\n\n // Update blood pool particles (fade out)\n if (totalParticleIndex >= maxVisibleParticles) {\n // Buffer is full: continue aging and culling pool particles, but do not write positions.\n poolParticlesRef.current = poolParticlesRef.current.filter((p) => {\n p.age += safeDelta;\n const isAlive = p.age < p.lifetime;\n \n // Release pooled vectors when particle dies\n if (!isAlive && p.isPooled) {\n ThreeObjectPools.vector3.release(p.position);\n ThreeObjectPools.vector3.release(p.velocity);\n p.isPooled = false; // Mark as released\n }\n \n return isAlive;\n });\n } else {\n // There is still room in the buffer: write pool particle positions up to the cap.\n poolParticlesRef.current = poolParticlesRef.current.filter((p) => {\n p.age += safeDelta;\n const isAlive = p.age < p.lifetime;\n\n if (isAlive && totalParticleIndex < maxVisibleParticles) {\n posArray[totalParticleIndex * 3] = p.position.x;\n posArray[totalParticleIndex * 3 + 1] = p.position.y;\n posArray[totalParticleIndex * 3 + 2] = p.position.z;\n totalParticleIndex++;\n }\n\n // Release pooled vectors when particle dies\n if (!isAlive && p.isPooled) {\n ThreeObjectPools.vector3.release(p.position);\n ThreeObjectPools.vector3.release(p.velocity);\n p.isPooled = false; // Mark as released\n }\n\n return isAlive;\n });\n }\n\n attr.needsUpdate = true;\n });\n\n // Don't render if disabled or no effects\n if (!enabled || effects.length === 0) {\n return null;\n }\n\n return (\n <Points\n ref={pointsRef}\n positions={initialPositions}\n data-testid=\"blood-particles-3d\"\n >\n <PointMaterial\n color={bloodColor}\n size={BLOOD_CONSTANTS.PARTICLE_SIZE}\n sizeAttenuation\n transparent\n opacity={0.9}\n depthWrite={false}\n blending={TH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AK,EAAE,SAAS;IAClD;;GAIF,IAAI,CAAC,WAAW,EAAE,UAAU;IAC1B,iBAAiB,QAAQ,QAAQ,EAAE,SAAS;IAC5C,iBAAiB,QAAQ,QAAQ,EAAE,SAAS;IAC5C,EAAE,WAAW;;GAGf,OAAO;IACP;EAGJ,KAAK,cAAc;GACnB;CAGF,IAAI,CAAC,WAAW,QAAQ,WAAW,GACjC,OAAO;CAGT,OACE,oBAAC,QAAD;EACE,KAAK;EACL,WAAW;EACX,eAAY;YAEZ,oBAAC,eAAD;GACE,OAAO;GACP,MAAM,gBAAgB;GACtB,iBAAA;GACA,aAAA;GACA,SAAS;GACT,YAAY;GACZ,UAAU,MAAM;GAChB,CAAA;EACK,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"BloodViscosity3D.js","names":[],"sources":["../../../../../../src/components/screens/combat/components/effects/BloodViscosity3D.tsx"],"sourcesContent":["/**\n * BloodViscosity3D - Enhanced blood droplets with thicker physics for brutal combat realism\n *\n * Priority #5: Enhanced Blood Viscosity\n * - Thicker droplets with slower fall rate\n * - Variable splatter sizes (gouts vs mist)\n * - Cling/drip physics (stick to surfaces)\n * - Enhanced viscosity simulation\n *\n * PERFORMANCE OPTIMIZATION (Object Pooling):\n * - Reduced allocations from ~85+ per effect to ~4 pooled objects\n * - Pooling strategy:\n * 1. Temporary calculation objects (direction, color, velocity) use pool\n * 2. Owned objects (particle velocities) are cloned from pooled objects\n * 3. All pooled objects released after particle creation\n * - Estimated reduction: \n * - thin: 50 Color + 50 Vector3 = 100 allocations → 4 pooled objects\n * - medium: 80 Color + 80 Vector3 = 160 allocations → 4 pooled objects\n * - thick: 120 Color + 120 Vector3 = 240 allocations → 4 pooled objects\n * - gout: 200 Color + 200 Vector3 = 400 allocations → 4 pooled objects\n *\n * Korean martial arts context:\n * - 절단격 (Cutting strikes) - Thin blood mist\n * - 타격 (Impact strikes) - Medium blood splatter\n * - 관통격 (Penetrating strikes) - Thick blood droplets\n * - 깊은 상처 (Deep wounds) - Large blood gouts\n */\n\nimport React, { useEffect, useMemo } from 'react';\nimport { useFrame } from '@react-three/fiber';\nimport * as THREE from 'three';\nimport { ThreeObjectPools } from '../../../../../utils/threeObjectPool';\n\n/**\n * Viscosity types for blood splatter\n */\nexport type ViscosityType = 'thin' | 'medium' | 'thick' | 'gout';\n\n/**\n * Individual blood viscosity effect\n */\nexport interface BloodViscosityEffect {\n readonly id: string;\n readonly position: [number, number, number];\n readonly direction: [number, number, number];\n readonly viscosityType: ViscosityType;\n readonly intensity: number; // 0.0-1.0\n readonly startTime: number;\n}\n\n/**\n * Props for BloodViscosity3D component\n */\nexport interface BloodViscosity3DProps {\n readonly effects: readonly BloodViscosityEffect[];\n readonly enabled?: boolean;\n readonly isMobile?: boolean;\n readonly onEffectComplete?: (id: string) => void;\n}\n\n// Physics constants for blood viscosity\nconst BLOOD_VISCOSITY_CONSTANTS = {\n // Gravity and air resistance\n GRAVITY: -9.8, // m/s²\n AIR_RESISTANCE: 0.94, // Thicker than arterial (0.97) or bone (0.96)\n \n // Particle counts by viscosity type (desktop)\n PARTICLE_COUNT: {\n thin: 50, // Mist\n medium: 80, // Normal splatter\n thick: 120, // Heavy droplets\n gout: 200, // Deep wound large gouts\n },\n \n // Velocity ranges (m/s) - slower than arterial\n VELOCITY: {\n thin: { min: 2.0, max: 4.0 },\n medium: { min: 1.5, max: 3.0 },\n thick: { min: 1.0, max: 2.5 },\n gout: { min: 0.5, max: 2.0 },\n },\n \n // Particle sizes\n SIZE: {\n thin: { min: 0.02, max: 0.04 },\n medium: { min: 0.04, max: 0.08 },\n thick: { min: 0.06, max: 0.12 },\n gout: { min: 0.10, max: 0.20 },\n },\n \n // Spread cone angles (radians)\n SPREAD_ANGLE: {\n thin: Math.PI / 3, // 60° wide spray\n medium: Math.PI / 4, // 45° normal\n thick: Math.PI / 6, // 30° narrow\n gout: Math.PI / 8, // 22.5° very narrow\n },\n \n // Lifetimes\n ACTIVE_LIFETIME: 2.5, // Active falling time\n CLING_LIFETIME: 3.0, // Time stuck to ground\n TOTAL_LIFETIME: 5.5, // Total before cleanup\n \n // Ground cling physics\n GROUND_LEVEL: 0.1, // y-position for ground contact\n CLING_DAMPING: 0.3, // Velocity reduction on contact\n \n // Color\n BLOOD_COLOR: 0x8b0000, // Dark red\n \n // Max delta time to prevent physics spiral\n MAX_DELTA: 1 / 30,\n} as const;\n\n/**\n * BloodViscosity3D - Enhanced blood droplets with realistic thicker physics\n *\n * Features:\n * - Variable viscosity types (thin mist to thick gouts)\n * - Cling/drip physics when hitting ground\n * - Slower fall rates than arterial spray\n * - Larger droplet sizes\n * - Mobile optimization (50% particles)\n */\nexport const BloodViscosity3D: React.FC<BloodViscosity3DProps> = ({\n effects,\n enabled = true,\n isMobile = false,\n onEffectComplete,\n}) => {\n // Track active effect instances\n const [effectInstances, setEffectInstances] = React.useState<\n Map<\n string,\n {\n particles: THREE.Points;\n velocities: THREE.Vector3[];\n startTime: number;\n effect: BloodViscosityEffect;\n clinging: boolean[];\n }\n >\n >(new Map());\n\n // Calculate particle count based on viscosity and mobile\n const getParticleCount = useMemo(\n () => (viscosityType: ViscosityType) => {\n const baseCount = BLOOD_VISCOSITY_CONSTANTS.PARTICLE_COUNT[viscosityType];\n return isMobile ? Math.floor(baseCount * 0.5) : baseCount;\n },\n [isMobile]\n );\n\n // Create particle system for blood droplets\n const createBloodParticles = useMemo(\n () => (effect: BloodViscosityEffect) => {\n const count = getParticleCount(effect.viscosityType);\n const geometry = new THREE.BufferGeometry();\n const positions = new Float32Array(count * 3);\n const colors = new Float32Array(count * 3);\n const sizes = new Float32Array(count);\n const velocities: THREE.Vector3[] = [];\n const clinging: boolean[] = [];\n\n // Pooled objects for calculations - PERFORMANCE: Eliminates 2 + (count * 3) allocations\n const tempDirection = ThreeObjectPools.vector3.acquire();\n const tempColor = ThreeObjectPools.color.acquire();\n const tempVelocity = ThreeObjectPools.vector3.acquire();\n const tempDeviation = ThreeObjectPools.vector3.acquire();\n\n try {\n tempDirection.set(...effect.direction).normalize();\n const spreadAngle = BLOOD_VISCOSITY_CONSTANTS.SPREAD_ANGLE[effect.viscosityType];\n const velocityRange = BLOOD_VISCOSITY_CONSTANTS.VELOCITY[effect.viscosityType];\n const sizeRange = BLOOD_VISCOSITY_CONSTANTS.SIZE[effect.viscosityType];\n\n // Set color once from pool\n tempColor.set(BLOOD_VISCOSITY_CONSTANTS.BLOOD_COLOR);\n\n for (let i = 0; i < count; i++) {\n // Start at impact position\n positions[i * 3] = 0;\n positions[i * 3 + 1] = 0;\n positions[i * 3 + 2] = 0;\n\n // Dark red color (reuse pooled color)\n colors[i * 3] = tempColor.r;\n colors[i * 3 + 1] = tempColor.g;\n colors[i * 3 + 2] = tempColor.b;\n\n // Variable size based on viscosity\n const size =\n sizeRange.min +\n Math.random() * (sizeRange.max - sizeRange.min) *\n effect.intensity;\n sizes[i] = size;\n\n // Calculate velocity with spread\n const speed =\n velocityRange.min +\n Math.random() * (velocityRange.max - velocityRange.min);\n\n // Random deviation within spread angle\n const theta = (Math.random() - 0.5) * spreadAngle;\n const phi = Math.random() * Math.PI * 2;\n\n // Use pooled vectors for calculation\n tempDeviation.set(\n Math.sin(theta) * Math.cos(phi),\n Math.sin(theta) * Math.sin(phi),\n Math.cos(theta)\n );\n\n tempVelocity.copy(tempDirection)\n .add(tempDeviation)\n .normalize()\n .multiplyScalar(speed);\n\n // Clone for ownership - particles own their velocity vectors\n velocities.push(tempVelocity.clone());\n clinging.push(false);\n }\n } finally {\n // Release all pooled objects back to pool\n ThreeObjectPools.vector3.release(tempDirection);\n ThreeObjectPools.color.release(tempColor);\n ThreeObjectPools.vector3.release(tempVelocity);\n ThreeObjectPools.vector3.release(tempDeviation);\n }\n\n geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3));\n geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3));\n geometry.setAttribute('size', new THREE.BufferAttribute(sizes, 1));\n\n const material = new THREE.PointsMaterial({\n size: 0.08,\n vertexColors: true,\n transparent: true,\n opacity: 0.9,\n blending: THREE.NormalBlending,\n depthWrite: false,\n sizeAttenuation: true,\n });\n\n const points = new THREE.Points(geometry, material);\n points.position.set(...effect.position);\n\n return { points, velocities, clinging };\n },\n [getParticleCount]\n );\n\n // Update effect instances\n useEffect(() => {\n if (!enabled) return;\n\n setEffectInstances((prev) => {\n const updated = new Map(prev);\n\n effects.forEach((effect) => {\n if (!updated.has(effect.id)) {\n const { points, velocities, clinging } = createBloodParticles(effect);\n updated.set(effect.id, {\n particles: points,\n velocities,\n startTime: effect.startTime,\n effect,\n clinging,\n });\n }\n });\n\n const currentIds = new Set(effects.map((e) => e.id));\n Array.from(updated.keys()).forEach((id) => {\n if (!currentIds.has(id)) {\n const instance = updated.get(id);\n if (instance) {\n instance.particles.geometry.dispose();\n (instance.particles.material as THREE.Material).dispose();\n }\n updated.delete(id);\n }\n });\n\n return updated;\n });\n }, [effects, enabled, createBloodParticles]);\n\n // Animation loop\n useFrame((_state, delta) => {\n if (!enabled || effectInstances.size === 0) return;\n\n const clampedDelta = Math.min(delta, BLOOD_VISCOSITY_CONSTANTS.MAX_DELTA);\n const now = Date.now();\n const completedIds: string[] = [];\n\n effectInstances.forEach((instance, id) => {\n const elapsed = (now - instance.startTime) / 1000;\n\n // Check for completion\n if (elapsed >= BLOOD_VISCOSITY_CONSTANTS.TOTAL_LIFETIME) {\n completedIds.push(id);\n return;\n }\n\n const geometry = instance.particles.geometry;\n const positions = geometry.attributes.position.array as Float32Array;\n const count = positions.length / 3;\n\n // Update each particle\n for (let i = 0; i < count; i++) {\n const idx = i * 3;\n\n if (!instance.clinging[i]) {\n // Apply gravity\n instance.velocities[i].y +=\n BLOOD_VISCOSITY_CONSTANTS.GRAVITY * clampedDelta;\n\n // Apply air resistance\n instance.velocities[i].multiplyScalar(\n BLOOD_VISCOSITY_CONSTANTS.AIR_RESISTANCE\n );\n\n // Update position\n positions[idx] += instance.velocities[i].x * clampedDelta;\n positions[idx + 1] += instance.velocities[i].y * clampedDelta;\n positions[idx + 2] += instance.velocities[i].z * clampedDelta;\n\n // Check ground contact\n if (positions[idx + 1] <= BLOOD_VISCOSITY_CONSTANTS.GROUND_LEVEL) {\n positions[idx + 1] = BLOOD_VISCOSITY_CONSTANTS.GROUND_LEVEL;\n instance.velocities[i].multiplyScalar(\n BLOOD_VISCOSITY_CONSTANTS.CLING_DAMPING\n );\n instance.clinging[i] = true;\n }\n }\n }\n\n geometry.attributes.position.needsUpdate = true;\n\n // Fade out during cling phase\n if (elapsed >= BLOOD_VISCOSITY_CONSTANTS.ACTIVE_LIFETIME) {\n const fadeProgress =\n (elapsed - BLOOD_VISCOSITY_CONSTANTS.ACTIVE_LIFETIME) /\n BLOOD_VISCOSITY_CONSTANTS.CLING_LIFETIME;\n const material = instance.particles.material as THREE.PointsMaterial;\n material.opacity = 0.9 * (1.0 - fadeProgress);\n }\n });\n\n completedIds.forEach((id) => {\n onEffectComplete?.(id);\n });\n });\n\n return (\n <>\n {Array.from(effectInstances.values()).map((instance) => (\n <primitive key={instance.effect.id} object={instance.particles} />\n ))}\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,IAAM,4BAA4B;CAEhC,SAAS;CACT,gBAAgB;CAGhB,gBAAgB;EACd,MAAM;EACN,QAAQ;EACR,OAAO;EACP,MAAM;EACP;CAGD,UAAU;EACR,MAAM;GAAE,KAAK;GAAK,KAAK;GAAK;EAC5B,QAAQ;GAAE,KAAK;GAAK,KAAK;GAAK;EAC9B,OAAO;GAAE,KAAK;GAAK,KAAK;GAAK;EAC7B,MAAM;GAAE,KAAK;GAAK,KAAK;GAAK;EAC7B;CAGD,MAAM;EACJ,MAAM;GAAE,KAAK;GAAM,KAAK;GAAM;EAC9B,QAAQ;GAAE,KAAK;GAAM,KAAK;GAAM;EAChC,OAAO;GAAE,KAAK;GAAM,KAAK;GAAM;EAC/B,MAAM;GAAE,KAAK;GAAM,KAAK;GAAM;EAC/B;CAGD,cAAc;EACZ,MA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B,MAAM,MAAM,IAAI;AAEhB,QAAI,CAAC,SAAS,SAAS,IAAI;AAEzB,cAAS,WAAW,GAAG,KACrB,0BAA0B,UAAU;AAGtC,cAAS,WAAW,GAAG,eACrB,0BAA0B,eAC3B;AAGD,eAAU,QAAQ,SAAS,WAAW,GAAG,IAAI;AAC7C,eAAU,MAAM,MAAM,SAAS,WAAW,GAAG,IAAI;AACjD,eAAU,MAAM,MAAM,SAAS,WAAW,GAAG,IAAI;AAGjD,SAAI,UAAU,MAAM,MAAM,0BAA0B,cAAc;AAChE,gBAAU,MAAM,KAAK,0BAA0B;AAC/C,eAAS,WAAW,GAAG,eACrB,0BAA0B,cAC3B;AACD,eAAS,SAAS,KAAK;;;;AAK7B,YAAS,WAAW,SAAS,cAAc;AAG3C,OAAI,WAAW,0BAA0B,iBAAiB;IACxD,MAAM,gBACH,UAAU,0BAA0B,mBACrC,0BAA0B;IAC5B,MAAM,WAAW,SAAS,UAAU;AACpC,aAAS,UAAU,MAAO,IAAM;;IAElC;AAEF,eAAa,SAAS,OAAO;AAC3B,sBAAmB,GAAG;IACtB;GACF;AAEF,QACE,oBAAA,UAAA,EAAA,UACG,MAAM,KAAK,gBAAgB,QAAQ,CAAC,CAAC,KAAK,aACzC,oBAAC,aAAD,EAAoC,QAAQ,SAAS,WAAa,EAAlD,SAAS,OAAO,GAAkC,CAClE,EACD,CAAA"}
1
+ {"version":3,"file":"BloodViscosity3D.js","names":[],"sources":["../../../../../../src/components/screens/combat/components/effects/BloodViscosity3D.tsx"],"sourcesContent":["/**\n * BloodViscosity3D - Enhanced blood droplets with thicker physics for brutal combat realism\n *\n * Priority #5: Enhanced Blood Viscosity\n * - Thicker droplets with slower fall rate\n * - Variable splatter sizes (gouts vs mist)\n * - Cling/drip physics (stick to surfaces)\n * - Enhanced viscosity simulation\n *\n * PERFORMANCE OPTIMIZATION (Object Pooling):\n * - Reduced allocations from ~85+ per effect to ~4 pooled objects\n * - Pooling strategy:\n * 1. Temporary calculation objects (direction, color, velocity) use pool\n * 2. Owned objects (particle velocities) are cloned from pooled objects\n * 3. All pooled objects released after particle creation\n * - Estimated reduction: \n * - thin: 50 Color + 50 Vector3 = 100 allocations → 4 pooled objects\n * - medium: 80 Color + 80 Vector3 = 160 allocations → 4 pooled objects\n * - thick: 120 Color + 120 Vector3 = 240 allocations → 4 pooled objects\n * - gout: 200 Color + 200 Vector3 = 400 allocations → 4 pooled objects\n *\n * Korean martial arts context:\n * - 절단격 (Cutting strikes) - Thin blood mist\n * - 타격 (Impact strikes) - Medium blood splatter\n * - 관통격 (Penetrating strikes) - Thick blood droplets\n * - 깊은 상처 (Deep wounds) - Large blood gouts\n */\n\nimport React, { useEffect, useMemo } from 'react';\nimport { useFrame } from '@react-three/fiber';\nimport * as THREE from 'three';\nimport { ThreeObjectPools } from '../../../../../utils/threeObjectPool';\n\n/**\n * Viscosity types for blood splatter\n */\nexport type ViscosityType = 'thin' | 'medium' | 'thick' | 'gout';\n\n/**\n * Individual blood viscosity effect\n */\nexport interface BloodViscosityEffect {\n readonly id: string;\n readonly position: [number, number, number];\n readonly direction: [number, number, number];\n readonly viscosityType: ViscosityType;\n readonly intensity: number; // 0.0-1.0\n readonly startTime: number;\n}\n\n/**\n * Props for BloodViscosity3D component\n */\nexport interface BloodViscosity3DProps {\n readonly effects: readonly BloodViscosityEffect[];\n readonly enabled?: boolean;\n readonly isMobile?: boolean;\n readonly onEffectComplete?: (id: string) => void;\n}\n\n// Physics constants for blood viscosity\nconst BLOOD_VISCOSITY_CONSTANTS = {\n // Gravity and air resistance\n GRAVITY: -9.8, // m/s²\n AIR_RESISTANCE: 0.94, // Thicker than arterial (0.97) or bone (0.96)\n \n // Particle counts by viscosity type (desktop)\n PARTICLE_COUNT: {\n thin: 50, // Mist\n medium: 80, // Normal splatter\n thick: 120, // Heavy droplets\n gout: 200, // Deep wound large gouts\n },\n \n // Velocity ranges (m/s) - slower than arterial\n VELOCITY: {\n thin: { min: 2.0, max: 4.0 },\n medium: { min: 1.5, max: 3.0 },\n thick: { min: 1.0, max: 2.5 },\n gout: { min: 0.5, max: 2.0 },\n },\n \n // Particle sizes\n SIZE: {\n thin: { min: 0.02, max: 0.04 },\n medium: { min: 0.04, max: 0.08 },\n thick: { min: 0.06, max: 0.12 },\n gout: { min: 0.10, max: 0.20 },\n },\n \n // Spread cone angles (radians)\n SPREAD_ANGLE: {\n thin: Math.PI / 3, // 60° wide spray\n medium: Math.PI / 4, // 45° normal\n thick: Math.PI / 6, // 30° narrow\n gout: Math.PI / 8, // 22.5° very narrow\n },\n \n // Lifetimes\n ACTIVE_LIFETIME: 2.5, // Active falling time\n CLING_LIFETIME: 3.0, // Time stuck to ground\n TOTAL_LIFETIME: 5.5, // Total before cleanup\n \n // Ground cling physics\n GROUND_LEVEL: 0.1, // y-position for ground contact\n CLING_DAMPING: 0.3, // Velocity reduction on contact\n \n // Color\n BLOOD_COLOR: 0x8b0000, // Dark red\n \n // Max delta time to prevent physics spiral\n MAX_DELTA: 1 / 30,\n} as const;\n\n/**\n * BloodViscosity3D - Enhanced blood droplets with realistic thicker physics\n *\n * Features:\n * - Variable viscosity types (thin mist to thick gouts)\n * - Cling/drip physics when hitting ground\n * - Slower fall rates than arterial spray\n * - Larger droplet sizes\n * - Mobile optimization (50% particles)\n */\nexport const BloodViscosity3D: React.FC<BloodViscosity3DProps> = ({\n effects,\n enabled = true,\n isMobile = false,\n onEffectComplete,\n}) => {\n // Track active effect instances\n const [effectInstances, setEffectInstances] = React.useState<\n Map<\n string,\n {\n particles: THREE.Points;\n velocities: THREE.Vector3[];\n startTime: number;\n effect: BloodViscosityEffect;\n clinging: boolean[];\n }\n >\n >(new Map());\n\n // Calculate particle count based on viscosity and mobile\n const getParticleCount = useMemo(\n () => (viscosityType: ViscosityType) => {\n const baseCount = BLOOD_VISCOSITY_CONSTANTS.PARTICLE_COUNT[viscosityType];\n return isMobile ? Math.floor(baseCount * 0.5) : baseCount;\n },\n [isMobile]\n );\n\n // Create particle system for blood droplets\n const createBloodParticles = useMemo(\n () => (effect: BloodViscosityEffect) => {\n const count = getParticleCount(effect.viscosityType);\n const geometry = new THREE.BufferGeometry();\n const positions = new Float32Array(count * 3);\n const colors = new Float32Array(count * 3);\n const sizes = new Float32Array(count);\n const velocities: THREE.Vector3[] = [];\n const clinging: boolean[] = [];\n\n // Pooled objects for calculations - PERFORMANCE: Eliminates 2 + (count * 3) allocations\n const tempDirection = ThreeObjectPools.vector3.acquire();\n const tempColor = ThreeObjectPools.color.acquire();\n const tempVelocity = ThreeObjectPools.vector3.acquire();\n const tempDeviation = ThreeObjectPools.vector3.acquire();\n\n try {\n tempDirection.set(...effect.direction).normalize();\n const spreadAngle = BLOOD_VISCOSITY_CONSTANTS.SPREAD_ANGLE[effect.viscosityType];\n const velocityRange = BLOOD_VISCOSITY_CONSTANTS.VELOCITY[effect.viscosityType];\n const sizeRange = BLOOD_VISCOSITY_CONSTANTS.SIZE[effect.viscosityType];\n\n // Set color once from pool\n tempColor.set(BLOOD_VISCOSITY_CONSTANTS.BLOOD_COLOR);\n\n for (let i = 0; i < count; i++) {\n // Start at impact position\n positions[i * 3] = 0;\n positions[i * 3 + 1] = 0;\n positions[i * 3 + 2] = 0;\n\n // Dark red color (reuse pooled color)\n colors[i * 3] = tempColor.r;\n colors[i * 3 + 1] = tempColor.g;\n colors[i * 3 + 2] = tempColor.b;\n\n // Variable size based on viscosity\n const size =\n sizeRange.min +\n Math.random() * (sizeRange.max - sizeRange.min) *\n effect.intensity;\n sizes[i] = size;\n\n // Calculate velocity with spread\n const speed =\n velocityRange.min +\n Math.random() * (velocityRange.max - velocityRange.min);\n\n // Random deviation within spread angle\n const theta = (Math.random() - 0.5) * spreadAngle;\n const phi = Math.random() * Math.PI * 2;\n\n // Use pooled vectors for calculation\n tempDeviation.set(\n Math.sin(theta) * Math.cos(phi),\n Math.sin(theta) * Math.sin(phi),\n Math.cos(theta)\n );\n\n tempVelocity.copy(tempDirection)\n .add(tempDeviation)\n .normalize()\n .multiplyScalar(speed);\n\n // Clone for ownership - particles own their velocity vectors\n velocities.push(tempVelocity.clone());\n clinging.push(false);\n }\n } finally {\n // Release all pooled objects back to pool\n ThreeObjectPools.vector3.release(tempDirection);\n ThreeObjectPools.color.release(tempColor);\n ThreeObjectPools.vector3.release(tempVelocity);\n ThreeObjectPools.vector3.release(tempDeviation);\n }\n\n geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3));\n geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3));\n geometry.setAttribute('size', new THREE.BufferAttribute(sizes, 1));\n\n const material = new THREE.PointsMaterial({\n size: 0.08,\n vertexColors: true,\n transparent: true,\n opacity: 0.9,\n blending: THREE.NormalBlending,\n depthWrite: false,\n sizeAttenuation: true,\n });\n\n const points = new THREE.Points(geometry, material);\n points.position.set(...effect.position);\n\n return { points, velocities, clinging };\n },\n [getParticleCount]\n );\n\n // Update effect instances\n useEffect(() => {\n if (!enabled) return;\n\n setEffectInstances((prev) => {\n const updated = new Map(prev);\n\n effects.forEach((effect) => {\n if (!updated.has(effect.id)) {\n const { points, velocities, clinging } = createBloodParticles(effect);\n updated.set(effect.id, {\n particles: points,\n velocities,\n startTime: effect.startTime,\n effect,\n clinging,\n });\n }\n });\n\n const currentIds = new Set(effects.map((e) => e.id));\n Array.from(updated.keys()).forEach((id) => {\n if (!currentIds.has(id)) {\n const instance = updated.get(id);\n if (instance) {\n instance.particles.geometry.dispose();\n (instance.particles.material as THREE.Material).dispose();\n }\n updated.delete(id);\n }\n });\n\n return updated;\n });\n }, [effects, enabled, createBloodParticles]);\n\n // Animation loop\n useFrame((_state, delta) => {\n if (!enabled || effectInstances.size === 0) return;\n\n const clampedDelta = Math.min(delta, BLOOD_VISCOSITY_CONSTANTS.MAX_DELTA);\n const now = Date.now();\n const completedIds: string[] = [];\n\n effectInstances.forEach((instance, id) => {\n const elapsed = (now - instance.startTime) / 1000;\n\n // Check for completion\n if (elapsed >= BLOOD_VISCOSITY_CONSTANTS.TOTAL_LIFETIME) {\n completedIds.push(id);\n return;\n }\n\n const geometry = instance.particles.geometry;\n const positions = geometry.attributes.position.array as Float32Array;\n const count = positions.length / 3;\n\n // Update each particle\n for (let i = 0; i < count; i++) {\n const idx = i * 3;\n\n if (!instance.clinging[i]) {\n // Apply gravity\n instance.velocities[i].y +=\n BLOOD_VISCOSITY_CONSTANTS.GRAVITY * clampedDelta;\n\n // Apply air resistance\n instance.velocities[i].multiplyScalar(\n BLOOD_VISCOSITY_CONSTANTS.AIR_RESISTANCE\n );\n\n // Update position\n positions[idx] += instance.velocities[i].x * clampedDelta;\n positions[idx + 1] += instance.velocities[i].y * clampedDelta;\n positions[idx + 2] += instance.velocities[i].z * clampedDelta;\n\n // Check ground contact\n if (positions[idx + 1] <= BLOOD_VISCOSITY_CONSTANTS.GROUND_LEVEL) {\n positions[idx + 1] = BLOOD_VISCOSITY_CONSTANTS.GROUND_LEVEL;\n instance.velocities[i].multiplyScalar(\n BLOOD_VISCOSITY_CONSTANTS.CLING_DAMPING\n );\n instance.clinging[i] = true;\n }\n }\n }\n\n geometry.attributes.position.needsUpdate = true;\n\n // Fade out during cling phase\n if (elapsed >= BLOOD_VISCOSITY_CONSTANTS.ACTIVE_LIFETIME) {\n const fadeProgress =\n (elapsed - BLOOD_VISCOSITY_CONSTANTS.ACTIVE_LIFETIME) /\n BLOOD_VISCOSITY_CONSTANTS.CLING_LIFETIME;\n const material = instance.particles.material as THREE.PointsMaterial;\n material.opacity = 0.9 * (1.0 - fadeProgress);\n }\n });\n\n completedIds.forEach((id) => {\n onEffectComplete?.(id);\n });\n });\n\n return (\n <>\n {Array.from(effectInstances.values()).map((instance) => (\n <primitive key={instance.effect.id} object={instance.particles} />\n ))}\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,IAAM,4BAA4B;CAEhC,SAAS;CACT,gBAAgB;CAGhB,gBAAgB;EACd,MAAM;EACN,QAAQ;EACR,OAAO;EACP,MAAM;EACP;CAGD,UAAU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D,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"CombatParticleEffects3D.js","names":[],"sources":["../../../../../../src/components/screens/combat/components/effects/CombatParticleEffects3D.tsx"],"sourcesContent":["/**\n * CombatParticleEffects3D - Particle effects coordinator for combat\n * 전투 입자 효과 통합 관리\n *\n * Maps HitEffect events to advanced particle effects:\n * - BloodViscosity3D for blood physics on hits\n * - InternalDamage3D for organ damage visualization on vital point strikes\n * - ParticleAudio3D for synchronized combat audio\n *\n * @module components/effects\n * @category Combat Effects\n * @korean 전투입자효과\n */\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { HitEffect } from \"../../../../../systems\";\nimport { HitEffectType } from \"../../../../../systems/effects\";\nimport {\n BloodViscosity3D,\n type BloodViscosityEffect,\n type ViscosityType,\n} from \"./BloodViscosity3D\";\nimport {\n InternalDamage3D,\n type InternalDamageEffect,\n type OrganType,\n type PenetrationDepth,\n} from \"./InternalDamage3D\";\nimport {\n ParticleAudio3D,\n type ParticleAudioTrigger,\n type ParticleEffectType,\n} from \"./ParticleAudio3D\";\n\n/**\n * Props for CombatParticleEffects3D\n */\nexport interface CombatParticleEffects3DProps {\n /** Active hit effects from the combat state */\n readonly hitEffects: readonly HitEffect[];\n /** Whether effects are enabled */\n readonly enabled?: boolean;\n /** Mobile optimization flag */\n readonly isMobile?: boolean;\n}\n\n/**\n * Map HitEffectType → blood viscosity type\n * 타격 유형 → 혈액 점도 매핑\n */\nfunction getViscosityForHitType(type: HitEffectType): ViscosityType | null {\n switch (type) {\n case HitEffectType.HIT:\n return \"thin\";\n case HitEffectType.COUNTER:\n return \"medium\";\n case HitEffectType.CRITICAL_HIT:\n return \"thick\";\n case HitEffectType.VITAL_POINT_STRIKE:\n return \"gout\";\n default:\n return null;\n }\n}\n\n/**\n * Map HitEffectType → organ type based on strike position\n * 급소 유형 → 장기 매핑 (타격 위치 기반)\n */\nfunction getOrganForPosition(\n position: { x: number; y: number } | undefined,\n): OrganType {\n if (!position) return \"stomach\";\n // Map y-position to organ (based on typical character model height)\n const y = position.y;\n if (y > 1.4) return \"heart\"; // 심장 - upper chest\n if (y > 1.1) return \"stomach\"; // 명치 - solar plexus\n if (y > 0.8) return \"liver\"; // 간 - right side mid-torso\n if (y > 0.5) return \"spleen\"; // 비장 - left side mid-torso\n return \"kidney\"; // 신장 - lower back\n}\n\n/**\n * Map HitEffect intensity → penetration depth\n * 타격 강도 → 관통 깊이 매핑\n */\nfunction getPenetrationDepth(intensity: number): PenetrationDepth {\n if (intensity >= 1.5) return \"critical\";\n if (intensity >= 1.0) return \"deep\";\n if (intensity >= 0.5) return \"shallow\";\n return \"surface\";\n}\n\n/**\n * Map HitEffectType → audio effect type\n * 타격 유형 → 오디오 효과 매핑\n */\nfunction getAudioEffectType(type: HitEffectType): ParticleEffectType | null {\n switch (type) {\n case HitEffectType.HIT:\n case HitEffectType.COUNTER:\n return \"viscosity\";\n case HitEffectType.CRITICAL_HIT:\n return \"bone\";\n case HitEffectType.VITAL_POINT_STRIKE:\n return \"organ\";\n case HitEffectType.BLOCK:\n case HitEffectType.PARRY:\n return \"bone\";\n default:\n return null;\n }\n}\n\n/** Maximum concurrent effects to prevent performance issues */\nconst MAX_BLOOD_EFFECTS = 8;\nconst MAX_ORGAN_EFFECTS = 4;\n\n/**\n * Simple deterministic hash from string → [0, 1)\n * Used for deterministic direction calculations inside useMemo\n */\nfunction hashToFloat(str: string): number {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n hash = (hash * 31 + str.charCodeAt(i)) | 0;\n }\n return Math.abs(hash % 10000) / 10000;\n}\n\n/**\n * CombatParticleEffects3D - Coordinates particle effects for combat\n *\n * Converts HitEffect events into:\n * - Blood viscosity particles (thin/medium/thick/gout based on strike type)\n * - Internal organ damage pulses (for vital point strikes)\n * - Synchronized audio triggers\n *\n * @korean 전투 입자 효과 통합 (타격→혈액물리+장기손상+오디오)\n */\nexport const CombatParticleEffects3D: React.FC<\n CombatParticleEffects3DProps\n> = ({ hitEffects, enabled = true, isMobile = false }) => {\n // Track processed hit effect IDs to avoid duplicates\n const processedIds = useRef<Set<string>>(new Set());\n\n // Effect state arrays\n const [bloodEffects, setBloodEffects] = useState<BloodViscosityEffect[]>([]);\n const [organEffects, setOrganEffects] = useState<InternalDamageEffect[]>([]);\n const [audioTriggers, setAudioTriggers] = useState<ParticleAudioTrigger[]>(\n [],\n );\n\n // Process new HitEffects in useEffect (not during render)\n useEffect(() => {\n const newBlood: BloodViscosityEffect[] = [];\n const newOrgan: InternalDamageEffect[] = [];\n const newAudio: ParticleAudioTrigger[] = [];\n\n for (const hit of hitEffects) {\n if (processedIds.current.has(hit.id)) continue;\n processedIds.current.add(hit.id);\n\n const pos: [number, number, number] = [\n hit.position?.x ?? 0,\n hit.position?.y ?? 1.0,\n 0,\n ];\n\n // Blood viscosity effect\n const viscosity = getViscosityForHitType(hit.type);\n if (viscosity) {\n // Direction: deterministic spray based on hit ID\n const angle = hashToFloat(hit.id) * Math.PI * 2;\n const ySpread = 0.3 + hashToFloat(hit.id + \"_y\") * 0.4;\n const dir: [number, number, number] = [\n Math.cos(angle) * 0.5,\n ySpread,\n Math.sin(angle) * 0.5,\n ];\n\n newBlood.push({\n id: `blood_${hit.id}`,\n position: pos,\n direction: dir,\n viscosityType: viscosity,\n intensity: Math.min(1, hit.intensity),\n startTime: hit.startTime,\n });\n }\n\n // Internal damage for vital point strikes\n if (hit.type === HitEffectType.VITAL_POINT_STRIKE) {\n newOrgan.push({\n id: `organ_${hit.id}`,\n position: pos,\n organType: getOrganForPosition(hit.position),\n penetrationDepth: getPenetrationDepth(hit.intensity),\n startTime: hit.startTime,\n });\n }\n\n // Audio trigger\n const audioType = getAudioEffectType(hit.type);\n if (audioType) {\n newAudio.push({\n effectType: audioType,\n intensity: Math.min(1, hit.intensity),\n timestamp: hit.timestamp,\n });\n }\n }\n\n // Batch merge with existing effects (respecting limits)\n if (newBlood.length > 0) {\n setBloodEffects((prev) =>\n [...prev, ...newBlood].slice(-MAX_BLOOD_EFFECTS),\n );\n }\n if (newOrgan.length > 0) {\n setOrganEffects((prev) =>\n [...prev, ...newOrgan].slice(-MAX_ORGAN_EFFECTS),\n );\n }\n if (newAudio.length > 0) {\n setAudioTriggers((prev) => [...prev, ...newAudio]);\n }\n\n // Clean up old processed IDs periodically\n if (processedIds.current.size > 500) {\n const arr = Array.from(processedIds.current);\n processedIds.current = new Set(arr.slice(-250));\n }\n }, [hitEffects]);\n\n // Effect completion handlers\n const handleBloodComplete = useCallback((id: string) => {\n setBloodEffects((prev) => prev.filter((e) => e.id !== id));\n }, []);\n\n const handleOrganComplete = useCallback((id: string) => {\n setOrganEffects((prev) => prev.filter((e) => e.id !== id));\n }, []);\n\n const handleAudioProcessed = useCallback((timestamp: number) => {\n setAudioTriggers((prev) => prev.filter((t) => t.timestamp !== timestamp));\n }, []);\n\n if (!enabled) return null;\n\n return (\n <>\n {/* Blood Viscosity Particles - 혈액 점도 입자 */}\n <BloodViscosity3D\n effects={bloodEffects}\n enabled={enabled}\n isMobile={isMobile}\n onEffectComplete={handleBloodComplete}\n />\n\n {/* Internal Organ Damage Pulses - 장기 손상 시각화 */}\n <InternalDamage3D\n effects={organEffects}\n enabled={enabled}\n isMobile={isMobile}\n onEffectComplete={handleOrganComplete}\n />\n\n {/* Audio Coordination - 입자 효과 오디오 동기화 */}\n <ParticleAudio3D\n triggers={audioTriggers}\n enabled={enabled}\n onTriggerProcessed={handleAudioProcessed}\n />\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAkDA,SAAS,uBAAuB,MAA2C;AACzE,SAAQ,MAAR;EACE,KAAK,cAAc,IACjB,QAAO;EACT,KAAK,cAAc,QACjB,QAAO;EACT,KAAK,cAAc,aACjB,QAAO;EACT,KAAK,cAAc,mBACjB,QAAO;EACT,QACE,QAAO;;;;;;;AAQb,SAAS,oBACP,UACW;AACX,KAAI,CAAC,SAAU,QAAO;CAEtB,MAAM,IAAI,SAAS;AACnB,KAAI,IAAI,IAAK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CAAC;CAGhB,MAAM,sBAAsB,aAAa,OAAe;AACtD,mBAAiB,SAAS,KAAK,QAAQ,MAAM,EAAE,OAAO,GAAG,CAAC;IACzD,EAAE,CAAC;CAEN,MAAM,sBAAsB,aAAa,OAAe;AACtD,mBAAiB,SAAS,KAAK,QAAQ,MAAM,EAAE,OAAO,GAAG,CAAC;IACzD,EAAE,CAAC;CAEN,MAAM,uBAAuB,aAAa,cAAsB;AAC9D,oBAAkB,SAAS,KAAK,QAAQ,MAAM,EAAE,cAAc,UAAU,CAAC;IACxE,EAAE,CAAC;AAEN,KAAI,CAAC,QAAS,QAAO;AAErB,QACE,qBAAA,UAAA,EAAA,UAAA;EAEE,oBAAC,kBAAD;GACE,SAAS;GACA;GACC;GACV,kBAAkB;GAClB,CAAA;EAGF,oBAAC,kBAAD;GACE,SAAS;GACA;GACC;GACV,kBAAkB;GAClB,CAAA;EAGF,oBAAC,iBAAD;GACE,UAAU;GACD;GACT,oBAAoB;GACpB,CAAA;EACD,EAAA,CAAA"}
1
+ {"version":3,"file":"CombatParticleEffects3D.js","names":[],"sources":["../../../../../../src/components/screens/combat/components/effects/CombatParticleEffects3D.tsx"],"sourcesContent":["/**\n * CombatParticleEffects3D - Particle effects coordinator for combat\n * 전투 입자 효과 통합 관리\n *\n * Maps HitEffect events to advanced particle effects:\n * - BloodViscosity3D for blood physics on hits\n * - InternalDamage3D for organ damage visualization on vital point strikes\n * - ParticleAudio3D for synchronized combat audio\n *\n * @module components/effects\n * @category Combat Effects\n * @korean 전투입자효과\n */\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { HitEffect } from \"../../../../../systems\";\nimport { HitEffectType } from \"../../../../../systems/effects\";\nimport {\n BloodViscosity3D,\n type BloodViscosityEffect,\n type ViscosityType,\n} from \"./BloodViscosity3D\";\nimport {\n InternalDamage3D,\n type InternalDamageEffect,\n type OrganType,\n type PenetrationDepth,\n} from \"./InternalDamage3D\";\nimport {\n ParticleAudio3D,\n type ParticleAudioTrigger,\n type ParticleEffectType,\n} from \"./ParticleAudio3D\";\n\n/**\n * Props for CombatParticleEffects3D\n */\nexport interface CombatParticleEffects3DProps {\n /** Active hit effects from the combat state */\n readonly hitEffects: readonly HitEffect[];\n /** Whether effects are enabled */\n readonly enabled?: boolean;\n /** Mobile optimization flag */\n readonly isMobile?: boolean;\n}\n\n/**\n * Map HitEffectType → blood viscosity type\n * 타격 유형 → 혈액 점도 매핑\n */\nfunction getViscosityForHitType(type: HitEffectType): ViscosityType | null {\n switch (type) {\n case HitEffectType.HIT:\n return \"thin\";\n case HitEffectType.COUNTER:\n return \"medium\";\n case HitEffectType.CRITICAL_HIT:\n return \"thick\";\n case HitEffectType.VITAL_POINT_STRIKE:\n return \"gout\";\n default:\n return null;\n }\n}\n\n/**\n * Map HitEffectType → organ type based on strike position\n * 급소 유형 → 장기 매핑 (타격 위치 기반)\n */\nfunction getOrganForPosition(\n position: { x: number; y: number } | undefined,\n): OrganType {\n if (!position) return \"stomach\";\n // Map y-position to organ (based on typical character model height)\n const y = position.y;\n if (y > 1.4) return \"heart\"; // 심장 - upper chest\n if (y > 1.1) return \"stomach\"; // 명치 - solar plexus\n if (y > 0.8) return \"liver\"; // 간 - right side mid-torso\n if (y > 0.5) return \"spleen\"; // 비장 - left side mid-torso\n return \"kidney\"; // 신장 - lower back\n}\n\n/**\n * Map HitEffect intensity → penetration depth\n * 타격 강도 → 관통 깊이 매핑\n */\nfunction getPenetrationDepth(intensity: number): PenetrationDepth {\n if (intensity >= 1.5) return \"critical\";\n if (intensity >= 1.0) return \"deep\";\n if (intensity >= 0.5) return \"shallow\";\n return \"surface\";\n}\n\n/**\n * Map HitEffectType → audio effect type\n * 타격 유형 → 오디오 효과 매핑\n */\nfunction getAudioEffectType(type: HitEffectType): ParticleEffectType | null {\n switch (type) {\n case HitEffectType.HIT:\n case HitEffectType.COUNTER:\n return \"viscosity\";\n case HitEffectType.CRITICAL_HIT:\n return \"bone\";\n case HitEffectType.VITAL_POINT_STRIKE:\n return \"organ\";\n case HitEffectType.BLOCK:\n case HitEffectType.PARRY:\n return \"bone\";\n default:\n return null;\n }\n}\n\n/** Maximum concurrent effects to prevent performance issues */\nconst MAX_BLOOD_EFFECTS = 8;\nconst MAX_ORGAN_EFFECTS = 4;\n\n/**\n * Simple deterministic hash from string → [0, 1)\n * Used for deterministic direction calculations inside useMemo\n */\nfunction hashToFloat(str: string): number {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n hash = (hash * 31 + str.charCodeAt(i)) | 0;\n }\n return Math.abs(hash % 10000) / 10000;\n}\n\n/**\n * CombatParticleEffects3D - Coordinates particle effects for combat\n *\n * Converts HitEffect events into:\n * - Blood viscosity particles (thin/medium/thick/gout based on strike type)\n * - Internal organ damage pulses (for vital point strikes)\n * - Synchronized audio triggers\n *\n * @korean 전투 입자 효과 통합 (타격→혈액물리+장기손상+오디오)\n */\nexport const CombatParticleEffects3D: React.FC<\n CombatParticleEffects3DProps\n> = ({ hitEffects, enabled = true, isMobile = false }) => {\n // Track processed hit effect IDs to avoid duplicates\n const processedIds = useRef<Set<string>>(new Set());\n\n // Effect state arrays\n const [bloodEffects, setBloodEffects] = useState<BloodViscosityEffect[]>([]);\n const [organEffects, setOrganEffects] = useState<InternalDamageEffect[]>([]);\n const [audioTriggers, setAudioTriggers] = useState<ParticleAudioTrigger[]>(\n [],\n );\n\n // Process new HitEffects in useEffect (not during render)\n useEffect(() => {\n const newBlood: BloodViscosityEffect[] = [];\n const newOrgan: InternalDamageEffect[] = [];\n const newAudio: ParticleAudioTrigger[] = [];\n\n for (const hit of hitEffects) {\n if (processedIds.current.has(hit.id)) continue;\n processedIds.current.add(hit.id);\n\n const pos: [number, number, number] = [\n hit.position?.x ?? 0,\n hit.position?.y ?? 1.0,\n 0,\n ];\n\n // Blood viscosity effect\n const viscosity = getViscosityForHitType(hit.type);\n if (viscosity) {\n // Direction: deterministic spray based on hit ID\n const angle = hashToFloat(hit.id) * Math.PI * 2;\n const ySpread = 0.3 + hashToFloat(hit.id + \"_y\") * 0.4;\n const dir: [number, number, number] = [\n Math.cos(angle) * 0.5,\n ySpread,\n Math.sin(angle) * 0.5,\n ];\n\n newBlood.push({\n id: `blood_${hit.id}`,\n position: pos,\n direction: dir,\n viscosityType: viscosity,\n intensity: Math.min(1, hit.intensity),\n startTime: hit.startTime,\n });\n }\n\n // Internal damage for vital point strikes\n if (hit.type === HitEffectType.VITAL_POINT_STRIKE) {\n newOrgan.push({\n id: `organ_${hit.id}`,\n position: pos,\n organType: getOrganForPosition(hit.position),\n penetrationDepth: getPenetrationDepth(hit.intensity),\n startTime: hit.startTime,\n });\n }\n\n // Audio trigger\n const audioType = getAudioEffectType(hit.type);\n if (audioType) {\n newAudio.push({\n effectType: audioType,\n intensity: Math.min(1, hit.intensity),\n timestamp: hit.timestamp,\n });\n }\n }\n\n // Batch merge with existing effects (respecting limits)\n if (newBlood.length > 0) {\n setBloodEffects((prev) =>\n [...prev, ...newBlood].slice(-MAX_BLOOD_EFFECTS),\n );\n }\n if (newOrgan.length > 0) {\n setOrganEffects((prev) =>\n [...prev, ...newOrgan].slice(-MAX_ORGAN_EFFECTS),\n );\n }\n if (newAudio.length > 0) {\n setAudioTriggers((prev) => [...prev, ...newAudio]);\n }\n\n // Clean up old processed IDs periodically\n if (processedIds.current.size > 500) {\n const arr = Array.from(processedIds.current);\n processedIds.current = new Set(arr.slice(-250));\n }\n }, [hitEffects]);\n\n // Effect completion handlers\n const handleBloodComplete = useCallback((id: string) => {\n setBloodEffects((prev) => prev.filter((e) => e.id !== id));\n }, []);\n\n const handleOrganComplete = useCallback((id: string) => {\n setOrganEffects((prev) => prev.filter((e) => e.id !== id));\n }, []);\n\n const handleAudioProcessed = useCallback((timestamp: number) => {\n setAudioTriggers((prev) => prev.filter((t) => t.timestamp !== timestamp));\n }, []);\n\n if (!enabled) return null;\n\n return (\n <>\n {/* Blood Viscosity Particles - 혈액 점도 입자 */}\n <BloodViscosity3D\n effects={bloodEffects}\n enabled={enabled}\n isMobile={isMobile}\n onEffectComplete={handleBloodComplete}\n />\n\n {/* Internal Organ Damage Pulses - 장기 손상 시각화 */}\n <InternalDamage3D\n effects={organEffects}\n enabled={enabled}\n isMobile={isMobile}\n onEffectComplete={handleOrganComplete}\n />\n\n {/* Audio Coordination - 입자 효과 오디오 동기화 */}\n <ParticleAudio3D\n triggers={audioTriggers}\n enabled={enabled}\n onTriggerProcessed={handleAudioProcessed}\n />\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAkDA,SAAS,uBAAuB,MAA2C;CACzE,QAAQ,MAAR;EACE,KAAK,cAAc,KACjB,OAAO;EACT,KAAK,cAAc,SACjB,OAAO;EACT,KAAK,cAAc,cACjB,OAAO;EACT,KAAK,cAAc,oBACjB,OAAO;EACT,SACE,OAAO;;;;;;;AAQb,SAAS,oBACP,UACW;CACX,IAAI,CAAC,UAAU,OAAO;CAEtB,MAAM,IAAI,SAAS;CACnB,IAAI,IAAI,KAAK,OAAO;CACpB,IAAI,IAAI,KAAK,OAAO;CACpB,IAAI,IAAI,IAAK,OAAO;CACpB,IAAI,IAAI,IAAK,OAAO;CACpB,OAAO;;;;;;AAOT,SAAS,oBAAoB,WAAqC;CAChE,IAAI,aAAa,KAAK,OAAO;CAC7B,IAAI,aAAa,GAAK,OAAO;CAC7B,IAAI,aAAa,IAAK,OAAO;CAC7B,OAAO;;;;;;AAOT,SAAS,mBAAmB,MAAgD;CAC1E,QAAQ,MAAR;EACE,KAAK,cAAc;EACnB,KAAK,cAAc,SACjB,OAAO;EACT,KAAK,cAAc,cACjB,OAAO;EACT,KAAK,cAAc,oBACjB,OAAO;EACT,KAAK,cAAc;EACnB,KAAK,cAAc,OACjB,OAAO;EACT,SACE,OAAO;;;;AAKb,IAAM,oBAAoB;AAC1B,IAAM,oBAAoB;;;;;AAM1B,SAAS,YAAY,KAAqB;CACxC,IAAI,OAAO;CACX,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,KAC9B,OA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A"}
@@ -1 +1 @@
1
- {"version":3,"file":"ConsciousnessBlur.js","names":[],"sources":["../../../../../../src/components/screens/combat/components/effects/ConsciousnessBlur.tsx"],"sourcesContent":["/**\n * ConsciousnessBlur Component - Visual effect for consciousness impairment\n *\n * Applies a blur effect to the screen that intensifies as consciousness decreases.\n * Uses CSS backdrop-filter for performance-efficient blur rendering.\n *\n * NOTE: This component is rendered OUTSIDE the Canvas as part of the HTML overlay.\n * It does NOT use Html from drei - it's a standard React component.\n *\n * @module components/combat/ConsciousnessBlur\n * @category Combat UI\n * @korean 의식흐림효과\n */\n\nimport React, { useMemo } from \"react\";\n\nexport interface ConsciousnessBlurProps {\n /**\n * Current consciousness level (0-100)\n * 100 = fully conscious, 0 = unconscious\n * @korean 의식수준\n */\n readonly consciousness: number;\n\n /**\n * Mobile responsive mode (reduced blur strength)\n * @korean 모바일여부\n */\n readonly isMobile: boolean;\n\n /**\n * Multiplier applied to the effect's maximum blur + darkening (0.0-1.0).\n *\n * Use this to soften the fullscreen effect when the 3D arena is already\n * visually compressed (e.g. portrait mobile). Default is `1.0`.\n *\n * @korean 효과강도배수\n */\n readonly intensityScale?: number;\n}\n\n/**\n * ConsciousnessBlur - Screen blur effect based on consciousness level\n *\n * Renders a fullscreen overlay with blur effect that intensifies as\n * consciousness decreases. Only visible when consciousness is 90 or below.\n * Optimized for 60fps with CSS backdrop-filter.\n * \n * Accessibility behavior:\n * - Purely decorative visual effect\n * - Marked with aria-hidden=\"true\" and excluded from the accessibility tree\n * - Does not announce consciousness level to screen readers\n * (use a separate, dedicated announcement channel if needed)\n *\n * @example\n * ```tsx\n * <ConsciousnessBlur consciousness={45} isMobile={false} />\n * // No render if consciousness > 90\n * <ConsciousnessBlur consciousness={95} isMobile={false} />\n * ```\n */\nexport const ConsciousnessBlur: React.FC<ConsciousnessBlurProps> = ({\n consciousness,\n isMobile,\n intensityScale = 1,\n}) => {\n const blurStyle = useMemo(() => {\n // Clamp consciousness to 0-100 range\n const clampedConsciousness = Math.max(0, Math.min(100, consciousness));\n\n // Caller-provided attenuation (e.g. 0.5 on portrait mobile).\n const safeScale = Math.max(0, Math.min(1, intensityScale));\n\n // Calculate blur amount (inverse of consciousness)\n // 100 consciousness = 0px blur, 0 consciousness = 12px blur (8px on mobile)\n const maxBlur = (isMobile ? 8 : 12) * safeScale;\n const blurAmount = Math.round(\n ((100 - clampedConsciousness) / 100) * maxBlur\n );\n\n // Also add slight opacity darkening for dramatic effect\n const opacity =\n Math.pow((100 - clampedConsciousness) / 100, 2) * 0.3 * safeScale;\n\n // Don't apply blur if consciousness is high (> 90)\n if (clampedConsciousness > 90) {\n return null;\n }\n\n return {\n position: \"fixed\" as const,\n inset: 0,\n pointerEvents: \"none\" as const,\n backdropFilter: `blur(${blurAmount}px)`,\n WebkitBackdropFilter: `blur(${blurAmount}px)`, // Safari support\n backgroundColor: `rgba(0, 0, 0, ${opacity})`,\n transition:\n \"backdrop-filter 0.5s ease-out, background-color 0.5s ease-out\",\n zIndex: 60, // Above game content but below HUD\n };\n }, [consciousness, isMobile, intensityScale]);\n\n // Don't render if consciousness is very high\n if (consciousness > 90 || !blurStyle) {\n return null;\n }\n\n // Decorative visual overlay; aria-hidden with no live region or additional ARIA roles needed\n return (\n <div\n data-testid=\"consciousness-blur\"\n style={blurStyle}\n aria-hidden=\"true\"\n />\n );\n};\n\nConsciousnessBlur.displayName = \"ConsciousnessBlur\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,IAAa,qBAAuD,EAClE,eACA,UACA,iBAAiB,QACb;CACJ,MAAM,YAAY,cAAc;EAE9B,MAAM,uBAAuB,KAAK,IAAI,GAAG,KAAK,IAAI,KAAK,cAAc,CAAC;EAGtE,MAAM,YAAY,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,eAAe,CAAC;EAI1D,MAAM,WAAW,WAAW,IAAI,MAAM;EACtC,MAAM,aAAa,KAAK,OACpB,MAAM,wBAAwB,MAAO,QACxC;EAGD,MAAM,UACJ,KAAK,KAAK,MAAM,wBAAwB,KAAK,EAAE,GAAG,KAAM;AAG1D,MAAI,uBAAuB,GACzB,QAAO;AAGT,SAAO;GACL,UAAU;GACV,OAAO;GACP,eAAe;GACf,gBAAgB,QAAQ,WAAW;GACnC,sBAAsB,QAAQ,WAAW;GACzC,iBAAiB,iBAAiB,QAAQ;GAC1C,YACE;GACF,QAAQ;GACT;IACA;EAAC;EAAe;EAAU;EAAe,CAAC;AAG7C,KAAI,gBAAgB,MAAM,CAAC,UACzB,QAAO;AAIT,QACE,oBAAC,OAAD;EACE,eAAY;EACZ,OAAO;EACP,eAAY;EACZ,CAAA;;AAIN,kBAAkB,cAAc"}
1
+ {"version":3,"file":"ConsciousnessBlur.js","names":[],"sources":["../../../../../../src/components/screens/combat/components/effects/ConsciousnessBlur.tsx"],"sourcesContent":["/**\n * ConsciousnessBlur Component - Visual effect for consciousness impairment\n *\n * Applies a blur effect to the screen that intensifies as consciousness decreases.\n * Uses CSS backdrop-filter for performance-efficient blur rendering.\n *\n * NOTE: This component is rendered OUTSIDE the Canvas as part of the HTML overlay.\n * It does NOT use Html from drei - it's a standard React component.\n *\n * @module components/combat/ConsciousnessBlur\n * @category Combat UI\n * @korean 의식흐림효과\n */\n\nimport React, { useMemo } from \"react\";\n\nexport interface ConsciousnessBlurProps {\n /**\n * Current consciousness level (0-100)\n * 100 = fully conscious, 0 = unconscious\n * @korean 의식수준\n */\n readonly consciousness: number;\n\n /**\n * Mobile responsive mode (reduced blur strength)\n * @korean 모바일여부\n */\n readonly isMobile: boolean;\n\n /**\n * Multiplier applied to the effect's maximum blur + darkening (0.0-1.0).\n *\n * Use this to soften the fullscreen effect when the 3D arena is already\n * visually compressed (e.g. portrait mobile). Default is `1.0`.\n *\n * @korean 효과강도배수\n */\n readonly intensityScale?: number;\n}\n\n/**\n * ConsciousnessBlur - Screen blur effect based on consciousness level\n *\n * Renders a fullscreen overlay with blur effect that intensifies as\n * consciousness decreases. Only visible when consciousness is 90 or below.\n * Optimized for 60fps with CSS backdrop-filter.\n * \n * Accessibility behavior:\n * - Purely decorative visual effect\n * - Marked with aria-hidden=\"true\" and excluded from the accessibility tree\n * - Does not announce consciousness level to screen readers\n * (use a separate, dedicated announcement channel if needed)\n *\n * @example\n * ```tsx\n * <ConsciousnessBlur consciousness={45} isMobile={false} />\n * // No render if consciousness > 90\n * <ConsciousnessBlur consciousness={95} isMobile={false} />\n * ```\n */\nexport const ConsciousnessBlur: React.FC<ConsciousnessBlurProps> = ({\n consciousness,\n isMobile,\n intensityScale = 1,\n}) => {\n const blurStyle = useMemo(() => {\n // Clamp consciousness to 0-100 range\n const clampedConsciousness = Math.max(0, Math.min(100, consciousness));\n\n // Caller-provided attenuation (e.g. 0.5 on portrait mobile).\n const safeScale = Math.max(0, Math.min(1, intensityScale));\n\n // Calculate blur amount (inverse of consciousness)\n // 100 consciousness = 0px blur, 0 consciousness = 12px blur (8px on mobile)\n const maxBlur = (isMobile ? 8 : 12) * safeScale;\n const blurAmount = Math.round(\n ((100 - clampedConsciousness) / 100) * maxBlur\n );\n\n // Also add slight opacity darkening for dramatic effect\n const opacity =\n Math.pow((100 - clampedConsciousness) / 100, 2) * 0.3 * safeScale;\n\n // Don't apply blur if consciousness is high (> 90)\n if (clampedConsciousness > 90) {\n return null;\n }\n\n return {\n position: \"fixed\" as const,\n inset: 0,\n pointerEvents: \"none\" as const,\n backdropFilter: `blur(${blurAmount}px)`,\n WebkitBackdropFilter: `blur(${blurAmount}px)`, // Safari support\n backgroundColor: `rgba(0, 0, 0, ${opacity})`,\n transition:\n \"backdrop-filter 0.5s ease-out, background-color 0.5s ease-out\",\n zIndex: 60, // Above game content but below HUD\n };\n }, [consciousness, isMobile, intensityScale]);\n\n // Don't render if consciousness is very high\n if (consciousness > 90 || !blurStyle) {\n return null;\n }\n\n // Decorative visual overlay; aria-hidden with no live region or additional ARIA roles needed\n return (\n <div\n data-testid=\"consciousness-blur\"\n style={blurStyle}\n aria-hidden=\"true\"\n />\n );\n};\n\nConsciousnessBlur.displayName = \"ConsciousnessBlur\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,IAAa,qBAAuD,EAClE,eACA,UACA,iBAAiB,QACb;CACJ,MAAM,YAAY,cAAc;EAE9B,MAAM,uBAAuB,KAAK,IAAI,GAAG,KAAK,IAAI,KAAK,cAAc,CAAC;EAGtE,MAAM,YAAY,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,eAAe,CAAC;EAI1D,MAAM,WAAW,WAAW,IAAI,MAAM;EACtC,MAAM,aAAa,KAAK,OACpB,MAAM,wBAAwB,MAAO,QACxC;EAGD,MAAM,UACJ,KAAK,KAAK,MAAM,wBAAwB,KAAK,EAAE,GAAG,KAAM;EAG1D,IAAI,uBAAuB,IACzB,OAAO;EAGT,OAAO;GACL,UAAU;GACV,OAAO;GACP,eAAe;GACf,gBAAgB,QAAQ,WAAW;GACnC,sBAAsB,QAAQ,WAAW;GACzC,iBAAiB,iBAAiB,QAAQ;GAC1C,YACE;GACF,QAAQ;GACT;IACA;EAAC;EAAe;EAAU;EAAe,CAAC;CAG7C,IAAI,gBAAgB,MAAM,CAAC,WACzB,OAAO;CAIT,OACE,oBAAC,OAAD;EACE,eAAY;EACZ,OAAO;EACP,eAAY;EACZ,CAAA;;AAIN,kBAAkB,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"InternalDamage3D.js","names":[],"sources":["../../../../../../src/components/screens/combat/components/effects/InternalDamage3D.tsx"],"sourcesContent":["/**\n * InternalDamage3D - Deep red organ pulses for Korean martial arts organ strikes\n *\n * Priority #4: Internal Damage Visualization\n * - Deep red organ pulses (liver, kidney, spleen, stomach, heart)\n * - Tissue deformation ripples\n * - Penetration depth visualization\n * - Critical organ damage feedback\n *\n * PERFORMANCE OPTIMIZATION (Object Pooling):\n * - Reduced allocations from ~120+ per effect to 2 pooled objects\n * - Pooling strategy:\n * 1. Temporary Color objects for particle initialization use pool\n * 2. Colors are copied to Float32Array (no ownership needed)\n * 3. All pooled objects released after particle system creation\n * - Estimated reduction:\n * - Pulse particles: 60 Color allocations → 1 pooled object\n * - Ripple particles: 30 Color allocations → 1 pooled object\n * - Total: ~90 Color allocations per effect → 2 pooled objects\n *\n * Korean martial arts context (내장 공격 - Internal organ strikes):\n * - 간격 (Liver strike) - Right side body blow\n * - 신장격 (Kidney strike) - Lower back strike\n * - 비장격 (Spleen strike) - Left side body blow\n * - 명치격 (Solar plexus) - Stomach strike\n * - 심장격 (Heart strike) - Chest strike (critical)\n */\n\nimport React, { useEffect, useMemo, useRef } from 'react';\nimport { useFrame } from '@react-three/fiber';\nimport * as THREE from 'three';\nimport { ThreeObjectPools } from '../../../../../utils/threeObjectPool';\n\n/**\n * Organ types for Korean martial arts internal strikes\n */\nexport type OrganType = 'liver' | 'kidney' | 'spleen' | 'stomach' | 'heart';\n\n/**\n * Penetration depth levels for organ damage\n */\nexport type PenetrationDepth = 'surface' | 'shallow' | 'deep' | 'critical';\n\n/**\n * Individual internal damage effect\n */\nexport interface InternalDamageEffect {\n readonly id: string;\n readonly position: [number, number, number];\n readonly organType: OrganType;\n readonly penetrationDepth: PenetrationDepth;\n readonly startTime: number;\n}\n\n/**\n * Props for InternalDamage3D component\n */\nexport interface InternalDamage3DProps {\n readonly effects: readonly InternalDamageEffect[];\n readonly enabled?: boolean;\n readonly isMobile?: boolean;\n readonly onEffectComplete?: (id: string) => void;\n}\n\n// Physics constants for organ damage pulses\nconst INTERNAL_DAMAGE_CONSTANTS = {\n // Pulse expansion speeds\n PULSE_SPEED: 2.5, // m/s expansion rate\n \n // Lifetimes\n PULSE_LIFETIME: 1.5, // seconds for pulse to complete\n RIPPLE_LIFETIME: 0.8, // seconds for tissue ripple\n \n // Max radii by penetration depth\n MAX_RADIUS: {\n surface: 0.4,\n shallow: 0.7,\n deep: 1.0,\n critical: 1.2,\n },\n \n // Intensity multipliers\n INTENSITY: {\n surface: 0.5,\n shallow: 0.8,\n deep: 1.2,\n critical: 1.5,\n },\n \n // Particle counts (desktop)\n PULSE_PARTICLES: 60,\n RIPPLE_PARTICLES: 30,\n \n // Colors\n ORGAN_COLOR: 0x8b0000, // Dark red for organs\n RIPPLE_COLOR: 0xdc143c, // Crimson for tissue ripples\n \n // Emissive intensity\n EMISSIVE_INTENSITY: 0.8,\n} as const;\n\n/**\n * InternalDamage3D - Visualizes internal organ damage with deep red pulses\n *\n * Features:\n * - Expanding sphere pulses from organ impacts\n * - Tissue deformation ripples\n * - Penetration depth-based sizing\n * - Korean martial arts organ strike feedback\n * - Mobile optimization (50% particles)\n */\nexport const InternalDamage3D: React.FC<InternalDamage3DProps> = ({\n effects,\n enabled = true,\n isMobile = false,\n onEffectComplete,\n}) => {\n // Track active effect instances\n const [effectInstances, setEffectInstances] = React.useState<\n Map<\n string,\n {\n pulseParticles: THREE.Points;\n rippleParticles: THREE.Points;\n startTime: number;\n effect: InternalDamageEffect;\n }\n >\n >(new Map());\n\n // Calculate particle counts based on mobile optimization\n const particleCounts = useMemo(() => {\n const pulseCount = isMobile\n ? Math.floor(INTERNAL_DAMAGE_CONSTANTS.PULSE_PARTICLES * 0.5)\n : INTERNAL_DAMAGE_CONSTANTS.PULSE_PARTICLES;\n const rippleCount = isMobile\n ? Math.floor(INTERNAL_DAMAGE_CONSTANTS.RIPPLE_PARTICLES * 0.5)\n : INTERNAL_DAMAGE_CONSTANTS.RIPPLE_PARTICLES;\n return { pulseCount, rippleCount };\n }, [isMobile]);\n\n // Create particle system for organ pulse\n const createPulseParticles = useMemo(\n () => (effect: InternalDamageEffect) => {\n const { pulseCount } = particleCounts;\n const geometry = new THREE.BufferGeometry();\n const positions = new Float32Array(pulseCount * 3);\n const colors = new Float32Array(pulseCount * 3);\n const sizes = new Float32Array(pulseCount);\n\n // Pooled color for calculations - PERFORMANCE: Eliminates pulseCount Color allocations\n const tempColor = ThreeObjectPools.color.acquire();\n\n try {\n // Set color once from pool\n tempColor.set(INTERNAL_DAMAGE_CONSTANTS.ORGAN_COLOR);\n\n // Create sphere distribution\n for (let i = 0; i < pulseCount; i++) {\n // Fibonacci sphere distribution for phi/theta calculations\n // (values calculated but not stored in positions yet - used later for expansion)\n\n positions[i * 3] = 0;\n positions[i * 3 + 1] = 0;\n positions[i * 3 + 2] = 0;\n\n // Dark red color (reuse pooled color)\n colors[i * 3] = tempColor.r;\n colors[i * 3 + 1] = tempColor.g;\n colors[i * 3 + 2] = tempColor.b;\n\n // Size based on penetration depth\n const baseSize = 0.03;\n const depthMultiplier =\n INTERNAL_DAMAGE_CONSTANTS.INTENSITY[effect.penetrationDepth];\n sizes[i] = baseSize * depthMultiplier;\n }\n } finally {\n // Release pooled color back to pool\n ThreeObjectPools.color.release(tempColor);\n }\n\n geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3));\n geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3));\n geometry.setAttribute('size', new THREE.BufferAttribute(sizes, 1));\n\n const material = new THREE.PointsMaterial({\n size: 0.05,\n vertexColors: true,\n transparent: true,\n opacity: 1.0,\n blending: THREE.AdditiveBlending,\n depthWrite: false,\n sizeAttenuation: true,\n });\n\n const points = new THREE.Points(geometry, material);\n points.position.set(...effect.position);\n\n // Store phi/theta for sphere expansion\n (geometry as THREE.BufferGeometry & { sphereData: Record<string, number | Float32Array> }).sphereData = { positions: positions.slice() };\n for (let i = 0; i < pulseCount; i++) {\n const phi = Math.acos(1 - 2 * (i + 0.5) / pulseCount);\n const theta = Math.PI * (1 + Math.sqrt(5)) * i;\n (geometry as THREE.BufferGeometry & { sphereData: Record<string, number | Float32Array> }).sphereData[`phi_${i}`] = phi;\n (geometry as THREE.BufferGeometry & { sphereData: Record<string, number | Float32Array> }).sphereData[`theta_${i}`] = theta;\n }\n\n return points;\n },\n [particleCounts]\n );\n\n // Create particle system for tissue ripples\n const createRippleParticles = useMemo(\n () => (effect: InternalDamageEffect) => {\n const { rippleCount } = particleCounts;\n const geometry = new THREE.BufferGeometry();\n const positions = new Float32Array(rippleCount * 3);\n const colors = new Float32Array(rippleCount * 3);\n const sizes = new Float32Array(rippleCount);\n\n // Pooled color for calculations - PERFORMANCE: Eliminates rippleCount Color allocations\n const tempColor = ThreeObjectPools.color.acquire();\n\n try {\n // Set color once from pool\n tempColor.set(INTERNAL_DAMAGE_CONSTANTS.RIPPLE_COLOR);\n\n // Create ring distribution\n for (let i = 0; i < rippleCount; i++) {\n const angle = (i / rippleCount) * Math.PI * 2;\n positions[i * 3] = 0;\n positions[i * 3 + 1] = 0;\n positions[i * 3 + 2] = 0;\n\n // Crimson color for ripples (reuse pooled color)\n colors[i * 3] = tempColor.r;\n colors[i * 3 + 1] = tempColor.g;\n colors[i * 3 + 2] = tempColor.b;\n\n sizes[i] = 0.02;\n\n // Store angle for ring expansion\n (geometry as THREE.BufferGeometry & { [key: string]: number })[`angle_${i}`] = angle;\n }\n } finally {\n // Release pooled color back to pool\n ThreeObjectPools.color.release(tempColor);\n }\n\n geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3));\n geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3));\n geometry.setAttribute('size', new THREE.BufferAttribute(sizes, 1));\n\n const material = new THREE.PointsMaterial({\n size: 0.03,\n vertexColors: true,\n transparent: true,\n opacity: 1.0,\n blending: THREE.NormalBlending,\n depthWrite: false,\n sizeAttenuation: true,\n });\n\n const points = new THREE.Points(geometry, material);\n points.position.set(...effect.position);\n\n return points;\n },\n [particleCounts]\n );\n\n // Update effect instances when effects prop changes\n useEffect(() => {\n if (!enabled) return;\n\n setEffectInstances((prev) => {\n const updated = new Map(prev);\n\n // Add new effects\n effects.forEach((effect) => {\n if (!updated.has(effect.id)) {\n const pulseParticles = createPulseParticles(effect);\n const rippleParticles = createRippleParticles(effect);\n updated.set(effect.id, {\n pulseParticles,\n rippleParticles,\n startTime: effect.startTime,\n effect,\n });\n }\n });\n\n // Remove completed effects\n const currentIds = new Set(effects.map((e) => e.id));\n Array.from(updated.keys()).forEach((id) => {\n if (!currentIds.has(id)) {\n const instance = updated.get(id);\n if (instance) {\n instance.pulseParticles.geometry.dispose();\n (instance.pulseParticles.material as THREE.Material).dispose();\n instance.rippleParticles.geometry.dispose();\n (instance.rippleParticles.material as THREE.Material).dispose();\n }\n updated.delete(id);\n }\n });\n\n return updated;\n });\n }, [effects, enabled, createPulseParticles, createRippleParticles]);\n\n // 자원 정리 | Resource cleanup - Dispose all particle systems on unmount\n // Using a ref to track instances to avoid stale closure issues\n const effectInstancesRef = useRef<Map<\n string,\n {\n pulseParticles: THREE.Points;\n rippleParticles: THREE.Points;\n startTime: number;\n effect: InternalDamageEffect;\n }\n >>(effectInstances);\n useEffect(() => {\n effectInstancesRef.current = effectInstances;\n }, [effectInstances]);\n\n useEffect(() => {\n return () => {\n effectInstancesRef.current.forEach((instance: {\n pulseParticles: THREE.Points;\n rippleParticles: THREE.Points;\n startTime: number;\n effect: InternalDamageEffect;\n }) => {\n instance.pulseParticles.geometry.dispose();\n (instance.pulseParticles.material as THREE.Material).dispose();\n instance.rippleParticles.geometry.dispose();\n (instance.rippleParticles.material as THREE.Material).dispose();\n });\n };\n }, []); // Empty deps - cleanup on unmount only\n\n // Animation loop\n useFrame(() => {\n if (!enabled || effectInstances.size === 0) return;\n\n const now = Date.now();\n const completedIds: string[] = [];\n\n effectInstances.forEach((instance, id) => {\n const elapsed = (now - instance.startTime) / 1000;\n const { effect } = instance;\n\n // Pulse animation\n const pulseProgress = Math.min(\n elapsed / INTERNAL_DAMAGE_CONSTANTS.PULSE_LIFETIME,\n 1.0\n );\n if (pulseProgress < 1.0) {\n const pulseGeometry = instance.pulseParticles.geometry;\n const pulsePositions = pulseGeometry.attributes.position\n .array as Float32Array;\n const maxRadius =\n INTERNAL_DAMAGE_CONSTANTS.MAX_RADIUS[effect.penetrationDepth];\n\n const { pulseCount } = particleCounts;\n const sphereData = (pulseGeometry as THREE.BufferGeometry & { sphereData: Record<string, number | Float32Array> }).sphereData;\n for (let i = 0; i < pulseCount; i++) {\n const phi = sphereData[`phi_${i}`] as number;\n const theta = sphereData[`theta_${i}`] as number;\n const radius = maxRadius * pulseProgress;\n\n pulsePositions[i * 3] = radius * Math.sin(phi) * Math.cos(theta);\n pulsePositions[i * 3 + 1] = radius * Math.sin(phi) * Math.sin(theta);\n pulsePositions[i * 3 + 2] = radius * Math.cos(phi);\n }\n\n pulseGeometry.attributes.position.needsUpdate = true;\n\n // Fade opacity\n const material = instance.pulseParticles.material as THREE.PointsMaterial;\n material.opacity = 1.0 - pulseProgress * 0.7;\n }\n\n // Ripple animation\n const rippleProgress = Math.min(\n elapsed / INTERNAL_DAMAGE_CONSTANTS.RIPPLE_LIFETIME,\n 1.0\n );\n if (rippleProgress < 1.0) {\n const rippleGeometry = instance.rippleParticles.geometry;\n const ripplePositions = rippleGeometry.attributes.position\n .array as Float32Array;\n\n const { rippleCount } = particleCounts;\n const rippleRadius = 0.6 * rippleProgress;\n for (let i = 0; i < rippleCount; i++) {\n const angle = (rippleGeometry as THREE.BufferGeometry & { [key: string]: number })[`angle_${i}`];\n ripplePositions[i * 3] = rippleRadius * Math.cos(angle);\n ripplePositions[i * 3 + 1] = 0;\n ripplePositions[i * 3 + 2] = rippleRadius * Math.sin(angle);\n }\n\n rippleGeometry.attributes.position.needsUpdate = true;\n\n // Fade opacity\n const material = instance.rippleParticles\n .material as THREE.PointsMaterial;\n material.opacity = 1.0 - rippleProgress;\n }\n\n // Check completion\n if (\n elapsed >= INTERNAL_DAMAGE_CONSTANTS.PULSE_LIFETIME &&\n elapsed >= INTERNAL_DAMAGE_CONSTANTS.RIPPLE_LIFETIME\n ) {\n completedIds.push(id);\n }\n });\n\n // Notify completed effects\n completedIds.forEach((id) => {\n onEffectComplete?.(id);\n });\n });\n\n // Render all active particle systems\n return (\n <>\n {Array.from(effectInstances.values()).map((instance) => (\n <React.Fragment key={instance.effect.id}>\n <primitive object={instance.pulseParticles} />\n <primitive object={instance.rippleParticles} />\n </React.Fragment>\n ))}\n </>\n );\n};\n"],"mappings":";;;;;;;;;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AI,IAAI,GAAG,KAAK,IAAI,MAAM;AACpE,oBAAe,IAAI,IAAI,KAAK,SAAS,KAAK,IAAI,IAAI;;AAGpD,kBAAc,WAAW,SAAS,cAAc;IAGhD,MAAM,WAAW,SAAS,eAAe;AACzC,aAAS,UAAU,IAAM,gBAAgB;;GAI3C,MAAM,iBAAiB,KAAK,IAC1B,UAAU,0BAA0B,iBACpC,EACD;AACD,OAAI,iBAAiB,GAAK;IACxB,MAAM,iBAAiB,SAAS,gBAAgB;IAChD,MAAM,kBAAkB,eAAe,WAAW,SAC/C;IAEH,MAAM,EAAE,gBAAgB;IACxB,MAAM,eAAe,KAAM;AAC3B,SAAK,IAAI,IAAI,GAAG,IAAI,aAAa,KAAK;KACpC,MAAM,QAAS,eAAoE,SAAS;AAC5F,qBAAgB,IAAI,KAAK,eAAe,KAAK,IAAI,MAAM;AACvD,qBAAgB,IAAI,IAAI,KAAK;AAC7B,qBAAgB,IAAI,IAAI,KAAK,eAAe,KAAK,IAAI,MAAM;;AAG7D,mBAAe,WAAW,SAAS,cAAc;IAGjD,MAAM,WAAW,SAAS,gBACvB;AACH,aAAS,UAAU,IAAM;;AAI3B,OACE,WAAW,0BAA0B,kBACrC,WAAW,0BAA0B,gBAErC,cAAa,KAAK,GAAG;IAEvB;AAGF,eAAa,SAAS,OAAO;AAC3B,sBAAmB,GAAG;IACtB;GACF;AAGF,QACE,oBAAA,UAAA,EAAA,UACG,MAAM,KAAK,gBAAgB,QAAQ,CAAC,CAAC,KAAK,aACzC,qBAAC,MAAM,UAAP,EAAA,UAAA,CACE,oBAAC,aAAD,EAAW,QAAQ,SAAS,gBAAkB,CAAA,EAC9C,oBAAC,aAAD,EAAW,QAAQ,SAAS,iBAAmB,CAAA,CAChC,EAAA,EAHI,SAAS,OAAO,GAGpB,CACjB,EACD,CAAA"}
1
+ {"version":3,"file":"InternalDamage3D.js","names":[],"sources":["../../../../../../src/components/screens/combat/components/effects/InternalDamage3D.tsx"],"sourcesContent":["/**\n * InternalDamage3D - Deep red organ pulses for Korean martial arts organ strikes\n *\n * Priority #4: Internal Damage Visualization\n * - Deep red organ pulses (liver, kidney, spleen, stomach, heart)\n * - Tissue deformation ripples\n * - Penetration depth visualization\n * - Critical organ damage feedback\n *\n * PERFORMANCE OPTIMIZATION (Object Pooling):\n * - Reduced allocations from ~120+ per effect to 2 pooled objects\n * - Pooling strategy:\n * 1. Temporary Color objects for particle initialization use pool\n * 2. Colors are copied to Float32Array (no ownership needed)\n * 3. All pooled objects released after particle system creation\n * - Estimated reduction:\n * - Pulse particles: 60 Color allocations → 1 pooled object\n * - Ripple particles: 30 Color allocations → 1 pooled object\n * - Total: ~90 Color allocations per effect → 2 pooled objects\n *\n * Korean martial arts context (내장 공격 - Internal organ strikes):\n * - 간격 (Liver strike) - Right side body blow\n * - 신장격 (Kidney strike) - Lower back strike\n * - 비장격 (Spleen strike) - Left side body blow\n * - 명치격 (Solar plexus) - Stomach strike\n * - 심장격 (Heart strike) - Chest strike (critical)\n */\n\nimport React, { useEffect, useMemo, useRef } from 'react';\nimport { useFrame } from '@react-three/fiber';\nimport * as THREE from 'three';\nimport { ThreeObjectPools } from '../../../../../utils/threeObjectPool';\n\n/**\n * Organ types for Korean martial arts internal strikes\n */\nexport type OrganType = 'liver' | 'kidney' | 'spleen' | 'stomach' | 'heart';\n\n/**\n * Penetration depth levels for organ damage\n */\nexport type PenetrationDepth = 'surface' | 'shallow' | 'deep' | 'critical';\n\n/**\n * Individual internal damage effect\n */\nexport interface InternalDamageEffect {\n readonly id: string;\n readonly position: [number, number, number];\n readonly organType: OrganType;\n readonly penetrationDepth: PenetrationDepth;\n readonly startTime: number;\n}\n\n/**\n * Props for InternalDamage3D component\n */\nexport interface InternalDamage3DProps {\n readonly effects: readonly InternalDamageEffect[];\n readonly enabled?: boolean;\n readonly isMobile?: boolean;\n readonly onEffectComplete?: (id: string) => void;\n}\n\n// Physics constants for organ damage pulses\nconst INTERNAL_DAMAGE_CONSTANTS = {\n // Pulse expansion speeds\n PULSE_SPEED: 2.5, // m/s expansion rate\n \n // Lifetimes\n PULSE_LIFETIME: 1.5, // seconds for pulse to complete\n RIPPLE_LIFETIME: 0.8, // seconds for tissue ripple\n \n // Max radii by penetration depth\n MAX_RADIUS: {\n surface: 0.4,\n shallow: 0.7,\n deep: 1.0,\n critical: 1.2,\n },\n \n // Intensity multipliers\n INTENSITY: {\n surface: 0.5,\n shallow: 0.8,\n deep: 1.2,\n critical: 1.5,\n },\n \n // Particle counts (desktop)\n PULSE_PARTICLES: 60,\n RIPPLE_PARTICLES: 30,\n \n // Colors\n ORGAN_COLOR: 0x8b0000, // Dark red for organs\n RIPPLE_COLOR: 0xdc143c, // Crimson for tissue ripples\n \n // Emissive intensity\n EMISSIVE_INTENSITY: 0.8,\n} as const;\n\n/**\n * InternalDamage3D - Visualizes internal organ damage with deep red pulses\n *\n * Features:\n * - Expanding sphere pulses from organ impacts\n * - Tissue deformation ripples\n * - Penetration depth-based sizing\n * - Korean martial arts organ strike feedback\n * - Mobile optimization (50% particles)\n */\nexport const InternalDamage3D: React.FC<InternalDamage3DProps> = ({\n effects,\n enabled = true,\n isMobile = false,\n onEffectComplete,\n}) => {\n // Track active effect instances\n const [effectInstances, setEffectInstances] = React.useState<\n Map<\n string,\n {\n pulseParticles: THREE.Points;\n rippleParticles: THREE.Points;\n startTime: number;\n effect: InternalDamageEffect;\n }\n >\n >(new Map());\n\n // Calculate particle counts based on mobile optimization\n const particleCounts = useMemo(() => {\n const pulseCount = isMobile\n ? Math.floor(INTERNAL_DAMAGE_CONSTANTS.PULSE_PARTICLES * 0.5)\n : INTERNAL_DAMAGE_CONSTANTS.PULSE_PARTICLES;\n const rippleCount = isMobile\n ? Math.floor(INTERNAL_DAMAGE_CONSTANTS.RIPPLE_PARTICLES * 0.5)\n : INTERNAL_DAMAGE_CONSTANTS.RIPPLE_PARTICLES;\n return { pulseCount, rippleCount };\n }, [isMobile]);\n\n // Create particle system for organ pulse\n const createPulseParticles = useMemo(\n () => (effect: InternalDamageEffect) => {\n const { pulseCount } = particleCounts;\n const geometry = new THREE.BufferGeometry();\n const positions = new Float32Array(pulseCount * 3);\n const colors = new Float32Array(pulseCount * 3);\n const sizes = new Float32Array(pulseCount);\n\n // Pooled color for calculations - PERFORMANCE: Eliminates pulseCount Color allocations\n const tempColor = ThreeObjectPools.color.acquire();\n\n try {\n // Set color once from pool\n tempColor.set(INTERNAL_DAMAGE_CONSTANTS.ORGAN_COLOR);\n\n // Create sphere distribution\n for (let i = 0; i < pulseCount; i++) {\n // Fibonacci sphere distribution for phi/theta calculations\n // (values calculated but not stored in positions yet - used later for expansion)\n\n positions[i * 3] = 0;\n positions[i * 3 + 1] = 0;\n positions[i * 3 + 2] = 0;\n\n // Dark red color (reuse pooled color)\n colors[i * 3] = tempColor.r;\n colors[i * 3 + 1] = tempColor.g;\n colors[i * 3 + 2] = tempColor.b;\n\n // Size based on penetration depth\n const baseSize = 0.03;\n const depthMultiplier =\n INTERNAL_DAMAGE_CONSTANTS.INTENSITY[effect.penetrationDepth];\n sizes[i] = baseSize * depthMultiplier;\n }\n } finally {\n // Release pooled color back to pool\n ThreeObjectPools.color.release(tempColor);\n }\n\n geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3));\n geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3));\n geometry.setAttribute('size', new THREE.BufferAttribute(sizes, 1));\n\n const material = new THREE.PointsMaterial({\n size: 0.05,\n vertexColors: true,\n transparent: true,\n opacity: 1.0,\n blending: THREE.AdditiveBlending,\n depthWrite: false,\n sizeAttenuation: true,\n });\n\n const points = new THREE.Points(geometry, material);\n points.position.set(...effect.position);\n\n // Store phi/theta for sphere expansion\n (geometry as THREE.BufferGeometry & { sphereData: Record<string, number | Float32Array> }).sphereData = { positions: positions.slice() };\n for (let i = 0; i < pulseCount; i++) {\n const phi = Math.acos(1 - 2 * (i + 0.5) / pulseCount);\n const theta = Math.PI * (1 + Math.sqrt(5)) * i;\n (geometry as THREE.BufferGeometry & { sphereData: Record<string, number | Float32Array> }).sphereData[`phi_${i}`] = phi;\n (geometry as THREE.BufferGeometry & { sphereData: Record<string, number | Float32Array> }).sphereData[`theta_${i}`] = theta;\n }\n\n return points;\n },\n [particleCounts]\n );\n\n // Create particle system for tissue ripples\n const createRippleParticles = useMemo(\n () => (effect: InternalDamageEffect) => {\n const { rippleCount } = particleCounts;\n const geometry = new THREE.BufferGeometry();\n const positions = new Float32Array(rippleCount * 3);\n const colors = new Float32Array(rippleCount * 3);\n const sizes = new Float32Array(rippleCount);\n\n // Pooled color for calculations - PERFORMANCE: Eliminates rippleCount Color allocations\n const tempColor = ThreeObjectPools.color.acquire();\n\n try {\n // Set color once from pool\n tempColor.set(INTERNAL_DAMAGE_CONSTANTS.RIPPLE_COLOR);\n\n // Create ring distribution\n for (let i = 0; i < rippleCount; i++) {\n const angle = (i / rippleCount) * Math.PI * 2;\n positions[i * 3] = 0;\n positions[i * 3 + 1] = 0;\n positions[i * 3 + 2] = 0;\n\n // Crimson color for ripples (reuse pooled color)\n colors[i * 3] = tempColor.r;\n colors[i * 3 + 1] = tempColor.g;\n colors[i * 3 + 2] = tempColor.b;\n\n sizes[i] = 0.02;\n\n // Store angle for ring expansion\n (geometry as THREE.BufferGeometry & { [key: string]: number })[`angle_${i}`] = angle;\n }\n } finally {\n // Release pooled color back to pool\n ThreeObjectPools.color.release(tempColor);\n }\n\n geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3));\n geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3));\n geometry.setAttribute('size', new THREE.BufferAttribute(sizes, 1));\n\n const material = new THREE.PointsMaterial({\n size: 0.03,\n vertexColors: true,\n transparent: true,\n opacity: 1.0,\n blending: THREE.NormalBlending,\n depthWrite: false,\n sizeAttenuation: true,\n });\n\n const points = new THREE.Points(geometry, material);\n points.position.set(...effect.position);\n\n return points;\n },\n [particleCounts]\n );\n\n // Update effect instances when effects prop changes\n useEffect(() => {\n if (!enabled) return;\n\n setEffectInstances((prev) => {\n const updated = new Map(prev);\n\n // Add new effects\n effects.forEach((effect) => {\n if (!updated.has(effect.id)) {\n const pulseParticles = createPulseParticles(effect);\n const rippleParticles = createRippleParticles(effect);\n updated.set(effect.id, {\n pulseParticles,\n rippleParticles,\n startTime: effect.startTime,\n effect,\n });\n }\n });\n\n // Remove completed effects\n const currentIds = new Set(effects.map((e) => e.id));\n Array.from(updated.keys()).forEach((id) => {\n if (!currentIds.has(id)) {\n const instance = updated.get(id);\n if (instance) {\n instance.pulseParticles.geometry.dispose();\n (instance.pulseParticles.material as THREE.Material).dispose();\n instance.rippleParticles.geometry.dispose();\n (instance.rippleParticles.material as THREE.Material).dispose();\n }\n updated.delete(id);\n }\n });\n\n return updated;\n });\n }, [effects, enabled, createPulseParticles, createRippleParticles]);\n\n // 자원 정리 | Resource cleanup - Dispose all particle systems on unmount\n // Using a ref to track instances to avoid stale closure issues\n const effectInstancesRef = useRef<Map<\n string,\n {\n pulseParticles: THREE.Points;\n rippleParticles: THREE.Points;\n startTime: number;\n effect: InternalDamageEffect;\n }\n >>(effectInstances);\n useEffect(() => {\n effectInstancesRef.current = effectInstances;\n }, [effectInstances]);\n\n useEffect(() => {\n return () => {\n effectInstancesRef.current.forEach((instance: {\n pulseParticles: THREE.Points;\n rippleParticles: THREE.Points;\n startTime: number;\n effect: InternalDamageEffect;\n }) => {\n instance.pulseParticles.geometry.dispose();\n (instance.pulseParticles.material as THREE.Material).dispose();\n instance.rippleParticles.geometry.dispose();\n (instance.rippleParticles.material as THREE.Material).dispose();\n });\n };\n }, []); // Empty deps - cleanup on unmount only\n\n // Animation loop\n useFrame(() => {\n if (!enabled || effectInstances.size === 0) return;\n\n const now = Date.now();\n const completedIds: string[] = [];\n\n effectInstances.forEach((instance, id) => {\n const elapsed = (now - instance.startTime) / 1000;\n const { effect } = instance;\n\n // Pulse animation\n const pulseProgress = Math.min(\n elapsed / INTERNAL_DAMAGE_CONSTANTS.PULSE_LIFETIME,\n 1.0\n );\n if (pulseProgress < 1.0) {\n const pulseGeometry = instance.pulseParticles.geometry;\n const pulsePositions = pulseGeometry.attributes.position\n .array as Float32Array;\n const maxRadius =\n INTERNAL_DAMAGE_CONSTANTS.MAX_RADIUS[effect.penetrationDepth];\n\n const { pulseCount } = particleCounts;\n const sphereData = (pulseGeometry as THREE.BufferGeometry & { sphereData: Record<string, number | Float32Array> }).sphereData;\n for (let i = 0; i < pulseCount; i++) {\n const phi = sphereData[`phi_${i}`] as number;\n const theta = sphereData[`theta_${i}`] as number;\n const radius = maxRadius * pulseProgress;\n\n pulsePositions[i * 3] = radius * Math.sin(phi) * Math.cos(theta);\n pulsePositions[i * 3 + 1] = radius * Math.sin(phi) * Math.sin(theta);\n pulsePositions[i * 3 + 2] = radius * Math.cos(phi);\n }\n\n pulseGeometry.attributes.position.needsUpdate = true;\n\n // Fade opacity\n const material = instance.pulseParticles.material as THREE.PointsMaterial;\n material.opacity = 1.0 - pulseProgress * 0.7;\n }\n\n // Ripple animation\n const rippleProgress = Math.min(\n elapsed / INTERNAL_DAMAGE_CONSTANTS.RIPPLE_LIFETIME,\n 1.0\n );\n if (rippleProgress < 1.0) {\n const rippleGeometry = instance.rippleParticles.geometry;\n const ripplePositions = rippleGeometry.attributes.position\n .array as Float32Array;\n\n const { rippleCount } = particleCounts;\n const rippleRadius = 0.6 * rippleProgress;\n for (let i = 0; i < rippleCount; i++) {\n const angle = (rippleGeometry as THREE.BufferGeometry & { [key: string]: number })[`angle_${i}`];\n ripplePositions[i * 3] = rippleRadius * Math.cos(angle);\n ripplePositions[i * 3 + 1] = 0;\n ripplePositions[i * 3 + 2] = rippleRadius * Math.sin(angle);\n }\n\n rippleGeometry.attributes.position.needsUpdate = true;\n\n // Fade opacity\n const material = instance.rippleParticles\n .material as THREE.PointsMaterial;\n material.opacity = 1.0 - rippleProgress;\n }\n\n // Check completion\n if (\n elapsed >= INTERNAL_DAMAGE_CONSTANTS.PULSE_LIFETIME &&\n elapsed >= INTERNAL_DAMAGE_CONSTANTS.RIPPLE_LIFETIME\n ) {\n completedIds.push(id);\n }\n });\n\n // Notify completed effects\n completedIds.forEach((id) => {\n onEffectComplete?.(id);\n });\n });\n\n // Render all active particle systems\n return (\n <>\n {Array.from(effectInstances.values()).map((instance) => (\n <React.Fragment key={instance.effect.id}>\n <primitive object={instance.pulseParticles} />\n <primitive object={instance.rippleParticles} />\n </React.Fragment>\n ))}\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,IAAM,4BAA4B;CAEhC,aAAa;CAGb,gBAAgB;CAChB,iBAAiB;CAGjB,YAAY;EACV,SAAS;EACT,SAAS;EACT,MAAM;EACN,UAAU;EACX;CAGD,WAAW;EACT,SAAS;EACT,SAAS;EACT,MAAM;EACN,UAAU;EACX;CAGD,iBAAiB;CACjB,kBAAkB;CAGlB,aAAa;CACb,cAAc;CAGd,oBAAoB;CACrB;;;;;;;;;;;AAYD,IAAa,oBAAqD,EAChE,SACA,UAAU,MACV,WAAW,OACX,uBACI;CAEJ,MAAM,CAAC,iBAAiB,sBAAsB,MAAM,yBAUlD,IAAI,KAAK,CAAC;CAGZ,MAAM,iBAAiB,cAAc;EAOnC,OAAO;GAAE,YANU,WACf,KAAK,MAAM,0BAA0B,kBAAkB,GAAI,GAC3D,0BAA0B;GAIT,aAHD,WAChB,KAAK,MAAM,0BAA0B,mBAAmB,GAAI,GAC5D,0BAA0B;GACI;IACjC,CAAC,SAAS,CAAC;CAGd,MAAM,uBAAuB,eACpB,WAAiC;EACtC,MAAM,EAAE,eAAe;EACvB,MAAM,WAAW,IAAI,MAAM,gBAAgB;EAC3C,MAAM,YAAY,IAAI,aAAa,aAAa,EAAE;EAClD,MAAM,SAAS,IAAI,aAAa,aAAa,EAAE;EAC/C,MAAM,QAAQ,IAAI,aAAa,WAAW;EAG1C,MAAM,YAAY,iBAAiB,MAAM,SAAS;EAElD,IAAI;GAEF,UAAU,IAAI,0BAA0B,YAAY;GAGpD,KAAK,IAAI,IAAI,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,CACE,oBAAC,aAAD,EAAW,QAAQ,SAAS,gBAAkB,CAAA,EAC9C,oBAAC,aAAD,EAAW,QAAQ,SAAS,iBAAmB,CAAA,CAChC,EAAA,EAHI,SAAS,OAAO,GAGpB,CACjB,EACD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"PainVignette.js","names":[],"sources":["../../../../../../src/components/screens/combat/components/effects/PainVignette.tsx"],"sourcesContent":["/**\n * PainVignette Component - Visual overlay for pain intensity\n *\n * Displays a red vignette effect around the screen edges that intensifies\n * as the player's pain level increases. Uses CSS box-shadow for performance.\n *\n * NOTE: This component is rendered OUTSIDE the Canvas as part of the HTML overlay.\n * It does NOT use Html from drei - it's a standard React component.\n *\n * @module components/combat/PainVignette\n * @category Combat UI\n * @korean 통증비네트\n */\n\nimport React, { useMemo } from \"react\";\nimport { KOREAN_COLORS } from \"../../../../../types/constants\";\n\nexport interface PainVignetteProps {\n /**\n * Current pain level (0-100)\n * @korean 통증수준\n */\n readonly pain: number;\n\n /**\n * Mobile responsive mode (subtle effects)\n * @korean 모바일여부\n */\n readonly isMobile: boolean;\n\n /**\n * Multiplier applied to the effect's maximum opacity (0.0-1.0).\n *\n * Use this to soften the fullscreen effect when the 3D arena is already\n * visually compressed (e.g. portrait mobile) so the vignette does not\n * further obscure the view. Default is `1.0` (no attenuation).\n *\n * @korean 효과강도배수\n */\n readonly intensityScale?: number;\n}\n\n/**\n * PainVignette - Red edge vignette overlay for pain visualization\n *\n * Renders a fullscreen overlay with red vignette effect that intensifies\n * as pain increases. Only visible when pain is 5 or higher. Optimized\n * for 60fps with CSS transitions.\n * \n * Accessibility:\n * - Purely visual, decorative-only overlay\n * - Hidden from assistive technologies via aria-hidden=\"true\"\n * - Does not announce pain levels; use a separate mechanism if announcements are required\n *\n * @example\n * ```tsx\n * <PainVignette pain={65} isMobile={false} />\n * // No render if pain < 5\n * <PainVignette pain={2} isMobile={false} />\n * ```\n */\nexport const PainVignette: React.FC<PainVignetteProps> = ({\n pain,\n isMobile,\n intensityScale = 1,\n}) => {\n const vignetteStyle = useMemo(() => {\n // Clamp pain to 0-100 range\n const clampedPain = Math.max(0, Math.min(100, pain));\n\n // Calculate intensity (0-1) with cubic easing for dramatic effect\n const normalizedPain = clampedPain / 100;\n const intensity = Math.pow(normalizedPain, 1.5);\n\n // Mobile uses smaller vignette size for subtlety\n const vignetteSize = isMobile ? \"80px\" : \"150px\";\n\n // Maximum opacity is lower on mobile, and can be further attenuated\n // by the caller via `intensityScale` (e.g. portrait mobile).\n const safeScale = Math.max(0, Math.min(1, intensityScale));\n const maxOpacity = (isMobile ? 0.5 : 0.7) * safeScale;\n const opacity = intensity * maxOpacity;\n\n // Use KOREAN_COLORS.PAIN_INDICATOR constant\n const rgb = KOREAN_COLORS.PAIN_INDICATOR;\n const painColor = `rgba(${(rgb >> 16) & 255}, ${(rgb >> 8) & 255}, ${\n rgb & 255\n }, ${opacity})`;\n\n return {\n position: \"fixed\" as const,\n inset: 0,\n pointerEvents: \"none\" as const,\n boxShadow: `inset 0 0 ${vignetteSize} ${painColor}`,\n transition: \"box-shadow 0.5s ease-out\",\n zIndex: 50, // Below UI controls but above game content\n };\n }, [pain, isMobile, intensityScale]);\n\n // Don't render if pain is very low (< 5%)\n if (pain < 5) {\n return null;\n }\n\n // Purely visual overlay - no ARIA roles or live regions; marked aria-hidden to stay decorative\n return (\n <div \n data-testid=\"pain-vignette\" \n style={vignetteStyle} \n aria-hidden=\"true\"\n />\n );\n};\n\nPainVignette.displayName = \"PainVignette\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,IAAa,gBAA6C,EACxD,MACA,UACA,iBAAiB,QACb;CACJ,MAAM,gBAAgB,cAAc;EAKlC,MAAM,iBAHc,KAAK,IAAI,GAAG,KAAK,IAAI,KAAK,KAAK,CAG5B,GAAc;EACrC,MAAM,YAAY,KAAK,IAAI,gBAAgB,IAAI;EAG/C,MAAM,eAAe,WAAW,SAAS;EAMzC,MAAM,UAAU,cADI,WAAW,KAAM,MADnB,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,eAAe,CACb;EAI5C,MAAM,MAAM,cAAc;AAK1B,SAAO;GACL,UAAU;GACV,OAAO;GACP,eAAe;GACf,WAAW,aAAa,aAAa,GAAG,QARf,OAAO,KAAM,IAAI,IAAK,OAAO,IAAK,IAAI,IAC/D,MAAM,IACP,IAAI,QAAQ;GAOX,YAAY;GACZ,QAAQ;GACT;IACA;EAAC;EAAM;EAAU;EAAe,CAAC;AAGpC,KAAI,OAAO,EACT,QAAO;AAIT,QACE,oBAAC,OAAD;EACE,eAAY;EACZ,OAAO;EACP,eAAY;EACZ,CAAA;;AAIN,aAAa,cAAc"}
1
+ {"version":3,"file":"PainVignette.js","names":[],"sources":["../../../../../../src/components/screens/combat/components/effects/PainVignette.tsx"],"sourcesContent":["/**\n * PainVignette Component - Visual overlay for pain intensity\n *\n * Displays a red vignette effect around the screen edges that intensifies\n * as the player's pain level increases. Uses CSS box-shadow for performance.\n *\n * NOTE: This component is rendered OUTSIDE the Canvas as part of the HTML overlay.\n * It does NOT use Html from drei - it's a standard React component.\n *\n * @module components/combat/PainVignette\n * @category Combat UI\n * @korean 통증비네트\n */\n\nimport React, { useMemo } from \"react\";\nimport { KOREAN_COLORS } from \"../../../../../types/constants\";\n\nexport interface PainVignetteProps {\n /**\n * Current pain level (0-100)\n * @korean 통증수준\n */\n readonly pain: number;\n\n /**\n * Mobile responsive mode (subtle effects)\n * @korean 모바일여부\n */\n readonly isMobile: boolean;\n\n /**\n * Multiplier applied to the effect's maximum opacity (0.0-1.0).\n *\n * Use this to soften the fullscreen effect when the 3D arena is already\n * visually compressed (e.g. portrait mobile) so the vignette does not\n * further obscure the view. Default is `1.0` (no attenuation).\n *\n * @korean 효과강도배수\n */\n readonly intensityScale?: number;\n}\n\n/**\n * PainVignette - Red edge vignette overlay for pain visualization\n *\n * Renders a fullscreen overlay with red vignette effect that intensifies\n * as pain increases. Only visible when pain is 5 or higher. Optimized\n * for 60fps with CSS transitions.\n * \n * Accessibility:\n * - Purely visual, decorative-only overlay\n * - Hidden from assistive technologies via aria-hidden=\"true\"\n * - Does not announce pain levels; use a separate mechanism if announcements are required\n *\n * @example\n * ```tsx\n * <PainVignette pain={65} isMobile={false} />\n * // No render if pain < 5\n * <PainVignette pain={2} isMobile={false} />\n * ```\n */\nexport const PainVignette: React.FC<PainVignetteProps> = ({\n pain,\n isMobile,\n intensityScale = 1,\n}) => {\n const vignetteStyle = useMemo(() => {\n // Clamp pain to 0-100 range\n const clampedPain = Math.max(0, Math.min(100, pain));\n\n // Calculate intensity (0-1) with cubic easing for dramatic effect\n const normalizedPain = clampedPain / 100;\n const intensity = Math.pow(normalizedPain, 1.5);\n\n // Mobile uses smaller vignette size for subtlety\n const vignetteSize = isMobile ? \"80px\" : \"150px\";\n\n // Maximum opacity is lower on mobile, and can be further attenuated\n // by the caller via `intensityScale` (e.g. portrait mobile).\n const safeScale = Math.max(0, Math.min(1, intensityScale));\n const maxOpacity = (isMobile ? 0.5 : 0.7) * safeScale;\n const opacity = intensity * maxOpacity;\n\n // Use KOREAN_COLORS.PAIN_INDICATOR constant\n const rgb = KOREAN_COLORS.PAIN_INDICATOR;\n const painColor = `rgba(${(rgb >> 16) & 255}, ${(rgb >> 8) & 255}, ${\n rgb & 255\n }, ${opacity})`;\n\n return {\n position: \"fixed\" as const,\n inset: 0,\n pointerEvents: \"none\" as const,\n boxShadow: `inset 0 0 ${vignetteSize} ${painColor}`,\n transition: \"box-shadow 0.5s ease-out\",\n zIndex: 50, // Below UI controls but above game content\n };\n }, [pain, isMobile, intensityScale]);\n\n // Don't render if pain is very low (< 5%)\n if (pain < 5) {\n return null;\n }\n\n // Purely visual overlay - no ARIA roles or live regions; marked aria-hidden to stay decorative\n return (\n <div \n data-testid=\"pain-vignette\" \n style={vignetteStyle} \n aria-hidden=\"true\"\n />\n );\n};\n\nPainVignette.displayName = \"PainVignette\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,IAAa,gBAA6C,EACxD,MACA,UACA,iBAAiB,QACb;CACJ,MAAM,gBAAgB,cAAc;EAKlC,MAAM,iBAHc,KAAK,IAAI,GAAG,KAAK,IAAI,KAAK,KAAK,CAG5B,GAAc;EACrC,MAAM,YAAY,KAAK,IAAI,gBAAgB,IAAI;EAG/C,MAAM,eAAe,WAAW,SAAS;EAMzC,MAAM,UAAU,cADI,WAAW,KAAM,MADnB,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,eAAe,CACb;EAI5C,MAAM,MAAM,cAAc;EAK1B,OAAO;GACL,UAAU;GACV,OAAO;GACP,eAAe;GACf,WAAW,aAAa,aAAa,GAAG,QARf,OAAO,KAAM,IAAI,IAAK,OAAO,IAAK,IAAI,IAC/D,MAAM,IACP,IAAI,QAAQ;GAOX,YAAY;GACZ,QAAQ;GACT;IACA;EAAC;EAAM;EAAU;EAAe,CAAC;CAGpC,IAAI,OAAO,GACT,OAAO;CAIT,OACE,oBAAC,OAAD;EACE,eAAY;EACZ,OAAO;EACP,eAAY;EACZ,CAAA;;AAIN,aAAa,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"ParticleAudio3D.js","names":[],"sources":["../../../../../../src/components/screens/combat/components/effects/ParticleAudio3D.tsx"],"sourcesContent":["/* eslint-disable react-refresh/only-export-components */\n/**\n * ParticleAudio3D - Audio integration for particle effects\n *\n * Priority #6: Combat Audio Integration\n * - Maps particle effects to appropriate sounds\n * - Uses existing sound assets only\n * - Synchronizes with particle lifecycles\n * - Debounces rapid triggers\n *\n * Sound mappings (existing assets):\n * - Arterial spray → ki_release variants (electric energy release)\n * - Bone fractures → block_break variants (bone crack sounds)\n * - Nerve strikes → energy_pulse variants (electric pulse)\n * - Organ damage → hit_flesh + body_realistic_sound (layered impact)\n * - Blood viscosity → hit_flesh variants (lighter flesh impacts)\n */\n\nimport { useEffect, useRef } from \"react\";\nimport { useAudio } from \"../../../../../audio/AudioProvider\";\n\n/**\n * Particle effect types for audio mapping\n */\nexport type ParticleEffectType =\n | \"arterial\"\n | \"bone\"\n | \"nerve\"\n | \"organ\"\n | \"viscosity\";\n\n/**\n * Audio trigger for particle effect\n */\nexport interface ParticleAudioTrigger {\n readonly effectType: ParticleEffectType;\n readonly intensity: number; // 0.0-1.0, affects volume\n readonly timestamp: number; // Used for deduplication\n}\n\n/**\n * Props for ParticleAudio3D component\n */\nexport interface ParticleAudio3DProps {\n readonly triggers: readonly ParticleAudioTrigger[];\n readonly enabled?: boolean;\n readonly onTriggerProcessed?: (timestamp: number) => void;\n}\n\n// Debounce timing (ms) - prevents audio spam\nconst DEBOUNCE_TIME = 100;\n\n// Sound IDs for each effect type (using existing assets)\nconst SOUND_MAPPINGS: Record<ParticleEffectType, string[]> = {\n arterial: [\n \"ki_release\",\n \"ki_release_1\",\n \"ki_release_2\",\n \"ki_release_3\",\n \"ki_release_4\",\n ],\n bone: [\n \"block_break\",\n \"block_break_1\",\n \"block_break_2\",\n \"block_break_3\",\n \"block_break_4\",\n ],\n nerve: [\n \"energy_pulse\",\n \"energy_pulse_1\",\n \"energy_pulse_2\",\n \"energy_pulse_3\",\n \"energy_pulse_4\",\n ],\n organ: [\"hit_flesh\", \"hit_flesh_1\", \"hit_flesh_2\", \"body_realistic_sound\"],\n viscosity: [\"hit_flesh_3\", \"hit_flesh_4\"],\n};\n\n/**\n * ParticleAudio3D - Lightweight audio coordination for particle effects\n *\n * Features:\n * - Debounced audio triggers (max 1 per 100ms per type)\n * - Intensity-based volume scaling\n * - Random sound variant selection\n * - Uses existing audio assets only\n * - No Three.js rendering (pure coordination logic)\n */\nexport const ParticleAudio3D: React.FC<ParticleAudio3DProps> = ({\n triggers,\n enabled = true,\n onTriggerProcessed,\n}) => {\n const audio = useAudio();\n\n // Track last trigger time per effect type for debouncing\n const lastTriggerTime = useRef<Record<ParticleEffectType, number>>({\n arterial: 0,\n bone: 0,\n nerve: 0,\n organ: 0,\n viscosity: 0,\n });\n\n // Track processed trigger timestamps\n const processedTimestamps = useRef<Set<number>>(new Set());\n\n // Process audio triggers\n useEffect(() => {\n if (!enabled || !audio.isInitialized) return;\n\n const now = Date.now();\n\n triggers.forEach((trigger) => {\n // Skip if already processed\n if (processedTimestamps.current.has(trigger.timestamp)) {\n return;\n }\n\n // Check debounce\n const lastTime = lastTriggerTime.current[trigger.effectType];\n if (now - lastTime < DEBOUNCE_TIME) {\n return;\n }\n\n // Get random sound variant for this effect type\n const soundIds = SOUND_MAPPINGS[trigger.effectType];\n const soundId = soundIds[Math.floor(Math.random() * soundIds.length)];\n\n // Play sound (volume based on intensity: 0.3 to 0.9 range)\n try {\n audio.playSFX(soundId);\n } catch (error) {\n console.warn(`Failed to play particle audio: ${soundId}`, error);\n }\n\n // Update tracking\n lastTriggerTime.current[trigger.effectType] = now;\n processedTimestamps.current.add(trigger.timestamp);\n\n // Notify processed\n onTriggerProcessed?.(trigger.timestamp);\n });\n\n // Clean up old processed timestamps (keep last 1000)\n if (processedTimestamps.current.size > 1000) {\n const timestamps = Array.from(processedTimestamps.current).sort(\n (a, b) => b - a,\n );\n processedTimestamps.current = new Set(timestamps.slice(0, 500));\n }\n }, [triggers, enabled, audio, onTriggerProcessed]);\n\n // No visual rendering - pure audio coordination\n return null;\n};\n\n/**\n * Helper function to create audio triggers from particle effects\n */\nexport function createAudioTrigger(\n effectType: ParticleEffectType,\n intensity: number,\n): ParticleAudioTrigger {\n return {\n effectType,\n intensity: Math.max(0, Math.min(1, intensity)),\n timestamp: Date.now(),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkDA,IAAM,gBAAgB;AAGtB,IAAM,iBAAuD;CAC3D,UAAU;EACR;EACA;EACA;EACA;EACA;EACD;CACD,MAAM;EACJ;EACA;EACA;EACA;EACA;EACD;CACD,OAAO;EACL;EACA;EACA;EACA;EACA;EACD;CACD,OAAO;EAAC;EAAa;EAAe;EAAe;EAAuB;CAC1E,WAAW,CAAC,eAAe,cAAc;CAC1C;;;;;;;;;;;AAYD,IAAa,mBAAmD,EAC9D,UACA,UAAU,MACV,yBACI;CACJ,MAAM,QAAQ,UAAU;CAGxB,MAAM,kBAAkB,OAA2C;EACjE,UAAU;EACV,MAAM;EACN,OAAO;EACP,OAAO;EACP,WAAW;EACZ,CAAC;CAGF,MAAM,sBAAsB,uBAAoB,IAAI,KAAK,CAAC;AAG1D,iBAAgB;AACd,MAAI,CAAC,WAAW,CAAC,MAAM,cAAe;EAEtC,MAAM,MAAM,KAAK,KAAK;AAEtB,WAAS,SAAS,YAAY;AAE5B,OAAI,oBAAoB,QAAQ,IAAI,QAAQ,UAAU,CACpD;AAKF,OAAI,MADa,gBAAgB,QAAQ,QAAQ,cAC5B,cACnB;GAIF,MAAM,WAAW,eAAe,QAAQ;GACxC,MAAM,UAAU,SAAS,KAAK,MAAM,KAAK,QAAQ,GAAG,SAAS,OAAO;AAGpE,OAAI;AACF,UAAM,QAAQ,QAAQ;YACf,OAAO;AACd,YAAQ,KAAK,kCAAkC,WAAW,MAAM;;AAIlE,mBAAgB,QAAQ,QAAQ,cAAc;AAC9C,uBAAoB,QAAQ,IAAI,QAAQ,UAAU;AAGlD,wBAAqB,QAAQ,UAAU;IACvC;AAGF,MAAI,oBAAoB,QAAQ,OAAO,KAAM;GAC3C,MAAM,aAAa,MAAM,KAAK,oBAAoB,QAAQ,CAAC,MACxD,GAAG,MAAM,IAAI,EACf;AACD,uBAAoB,UAAU,IAAI,IAAI,WAAW,MAAM,GAAG,IAAI,CAAC;;IAEhE;EAAC;EAAU;EAAS;EAAO;EAAmB,CAAC;AAGlD,QAAO"}
1
+ {"version":3,"file":"ParticleAudio3D.js","names":[],"sources":["../../../../../../src/components/screens/combat/components/effects/ParticleAudio3D.tsx"],"sourcesContent":["/* eslint-disable react-refresh/only-export-components */\n/**\n * ParticleAudio3D - Audio integration for particle effects\n *\n * Priority #6: Combat Audio Integration\n * - Maps particle effects to appropriate sounds\n * - Uses existing sound assets only\n * - Synchronizes with particle lifecycles\n * - Debounces rapid triggers\n *\n * Sound mappings (existing assets):\n * - Arterial spray → ki_release variants (electric energy release)\n * - Bone fractures → block_break variants (bone crack sounds)\n * - Nerve strikes → energy_pulse variants (electric pulse)\n * - Organ damage → hit_flesh + body_realistic_sound (layered impact)\n * - Blood viscosity → hit_flesh variants (lighter flesh impacts)\n */\n\nimport { useEffect, useRef } from \"react\";\nimport { useAudio } from \"../../../../../audio/AudioProvider\";\n\n/**\n * Particle effect types for audio mapping\n */\nexport type ParticleEffectType =\n | \"arterial\"\n | \"bone\"\n | \"nerve\"\n | \"organ\"\n | \"viscosity\";\n\n/**\n * Audio trigger for particle effect\n */\nexport interface ParticleAudioTrigger {\n readonly effectType: ParticleEffectType;\n readonly intensity: number; // 0.0-1.0, affects volume\n readonly timestamp: number; // Used for deduplication\n}\n\n/**\n * Props for ParticleAudio3D component\n */\nexport interface ParticleAudio3DProps {\n readonly triggers: readonly ParticleAudioTrigger[];\n readonly enabled?: boolean;\n readonly onTriggerProcessed?: (timestamp: number) => void;\n}\n\n// Debounce timing (ms) - prevents audio spam\nconst DEBOUNCE_TIME = 100;\n\n// Sound IDs for each effect type (using existing assets)\nconst SOUND_MAPPINGS: Record<ParticleEffectType, string[]> = {\n arterial: [\n \"ki_release\",\n \"ki_release_1\",\n \"ki_release_2\",\n \"ki_release_3\",\n \"ki_release_4\",\n ],\n bone: [\n \"block_break\",\n \"block_break_1\",\n \"block_break_2\",\n \"block_break_3\",\n \"block_break_4\",\n ],\n nerve: [\n \"energy_pulse\",\n \"energy_pulse_1\",\n \"energy_pulse_2\",\n \"energy_pulse_3\",\n \"energy_pulse_4\",\n ],\n organ: [\"hit_flesh\", \"hit_flesh_1\", \"hit_flesh_2\", \"body_realistic_sound\"],\n viscosity: [\"hit_flesh_3\", \"hit_flesh_4\"],\n};\n\n/**\n * ParticleAudio3D - Lightweight audio coordination for particle effects\n *\n * Features:\n * - Debounced audio triggers (max 1 per 100ms per type)\n * - Intensity-based volume scaling\n * - Random sound variant selection\n * - Uses existing audio assets only\n * - No Three.js rendering (pure coordination logic)\n */\nexport const ParticleAudio3D: React.FC<ParticleAudio3DProps> = ({\n triggers,\n enabled = true,\n onTriggerProcessed,\n}) => {\n const audio = useAudio();\n\n // Track last trigger time per effect type for debouncing\n const lastTriggerTime = useRef<Record<ParticleEffectType, number>>({\n arterial: 0,\n bone: 0,\n nerve: 0,\n organ: 0,\n viscosity: 0,\n });\n\n // Track processed trigger timestamps\n const processedTimestamps = useRef<Set<number>>(new Set());\n\n // Process audio triggers\n useEffect(() => {\n if (!enabled || !audio.isInitialized) return;\n\n const now = Date.now();\n\n triggers.forEach((trigger) => {\n // Skip if already processed\n if (processedTimestamps.current.has(trigger.timestamp)) {\n return;\n }\n\n // Check debounce\n const lastTime = lastTriggerTime.current[trigger.effectType];\n if (now - lastTime < DEBOUNCE_TIME) {\n return;\n }\n\n // Get random sound variant for this effect type\n const soundIds = SOUND_MAPPINGS[trigger.effectType];\n const soundId = soundIds[Math.floor(Math.random() * soundIds.length)];\n\n // Play sound (volume based on intensity: 0.3 to 0.9 range)\n try {\n audio.playSFX(soundId);\n } catch (error) {\n console.warn(`Failed to play particle audio: ${soundId}`, error);\n }\n\n // Update tracking\n lastTriggerTime.current[trigger.effectType] = now;\n processedTimestamps.current.add(trigger.timestamp);\n\n // Notify processed\n onTriggerProcessed?.(trigger.timestamp);\n });\n\n // Clean up old processed timestamps (keep last 1000)\n if (processedTimestamps.current.size > 1000) {\n const timestamps = Array.from(processedTimestamps.current).sort(\n (a, b) => b - a,\n );\n processedTimestamps.current = new Set(timestamps.slice(0, 500));\n }\n }, [triggers, enabled, audio, onTriggerProcessed]);\n\n // No visual rendering - pure audio coordination\n return null;\n};\n\n/**\n * Helper function to create audio triggers from particle effects\n */\nexport function createAudioTrigger(\n effectType: ParticleEffectType,\n intensity: number,\n): ParticleAudioTrigger {\n return {\n effectType,\n intensity: Math.max(0, Math.min(1, intensity)),\n timestamp: Date.now(),\n };\n}\n"],"mappings":";;;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EAAmB,CAAC;CAGlD,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"TraumaOverlay3D.js","names":[],"sources":["../../../../../../src/components/screens/combat/components/effects/TraumaOverlay3D.tsx"],"sourcesContent":["/**\n * TraumaOverlay3D - Bruising and injury visualization system\n *\n * Renders progressive bruising, cuts, and bone fracture indicators on 3D character models\n * using shader-based texture overlays with color blending. Bruises darken with repeated\n * hits to the same body region and persist across combat rounds.\n *\n * Features:\n * - Progressive bruising (purple/black gradients)\n * - Cut/laceration marks for sharp strikes\n * - Bone fracture indicators at <30% health\n * - Injury persistence across rounds\n * - Korean-themed injury visualization\n *\n * @module components/combat/TraumaOverlay3D\n * @category Combat Effects\n * @korean 외상오버레이3D\n */\n\nimport { Html } from \"@react-three/drei\";\nimport React, { useMemo } from \"react\";\nimport * as THREE from \"three\";\nimport { KOREAN_COLORS, FONT_FAMILY } from \"../../../../../types/constants\";\nimport { hexToRgbaString } from \"../../../../../utils/colorUtils\";\nimport { InjuryType, Injury } from \"../../../../../types/injury\";\n\n/**\n * Props for TraumaOverlay3D component\n */\nexport interface TraumaOverlay3DProps {\n /** Character ID for injury tracking */\n readonly playerId: string;\n /** Current health (0-100) */\n readonly health: number;\n /** Active injuries to visualize */\n readonly injuries: readonly Injury[];\n /** Character position in world space */\n readonly characterPosition: [number, number, number];\n /** Whether character is mobile (simplified visualization) */\n readonly isMobile?: boolean;\n /** Whether to show fracture indicators */\n readonly showFractures?: boolean;\n}\n\n// Re-export for backward compatibility\nexport { InjuryType };\nexport type { Injury };\n\n/**\n * Color constants for injury visualization\n */\nconst INJURY_COLORS = {\n BRUISE_FRESH: 0x8B0000, // Dark red (fresh bruise)\n BRUISE_OLD: 0x4B0082, // Indigo (aging bruise)\n BRUISE_SEVERE: 0x000000, // Black (severe bruising)\n CUT_COLOR: 0xFF0000, // Bright red (cut)\n FRACTURE_INDICATOR: KOREAN_COLORS.ACCENT_GOLD, // Gold (bone fracture)\n} as const;\n\n/**\n * Get bruise color based on severity and hit count\n */\nconst getBruiseColor = (severity: number, hitCount: number): number => {\n if (hitCount >= 3 || severity > 0.8) {\n return INJURY_COLORS.BRUISE_SEVERE; // Black for severe/repeated trauma\n } else if (hitCount >= 2 || severity > 0.5) {\n return INJURY_COLORS.BRUISE_OLD; // Indigo for moderate bruising\n } else {\n return INJURY_COLORS.BRUISE_FRESH; // Dark red for fresh bruise\n }\n};\n\n/**\n * Get injury size based on severity\n */\nconst getInjurySize = (severity: number): number => {\n return 0.1 + severity * 0.3; // 0.1 to 0.4 units\n};\n\n/**\n * InjuryMarker - Individual injury visualization\n */\nconst InjuryMarker: React.FC<{\n injury: Injury;\n characterPosition: [number, number, number];\n isMobile: boolean;\n}> = ({ injury, characterPosition, isMobile }) => {\n // Calculate world position relative to character\n const worldPosition: [number, number, number] = useMemo(() => {\n return [\n characterPosition[0] + injury.position[0],\n characterPosition[1] + injury.position[1],\n characterPosition[2] + injury.position[2],\n ];\n }, [characterPosition, injury.position]);\n\n const size = useMemo(() => getInjurySize(injury.severity), [injury.severity]);\n\n // Render based on injury type\n switch (injury.type) {\n case InjuryType.BRUISE: {\n const color = getBruiseColor(injury.severity, injury.hitCount);\n const opacity = Math.min(0.8, 0.3 + injury.severity * 0.5);\n\n return (\n <mesh position={worldPosition} data-testid={`injury-${injury.id}`}>\n <sphereGeometry args={[size, isMobile ? 8 : 16, isMobile ? 8 : 16]} />\n <meshBasicMaterial\n color={color}\n transparent\n opacity={opacity}\n depthTest={true}\n />\n </mesh>\n );\n }\n\n case InjuryType.CUT:\n case InjuryType.LACERATION: {\n const cutLength = injury.type === InjuryType.LACERATION ? size * 3 : size * 2;\n return (\n <group position={worldPosition} data-testid={`injury-${injury.id}`}>\n {/* Cut mark - thin red line */}\n <mesh>\n <boxGeometry args={[cutLength, 0.02, 0.02]} />\n <meshBasicMaterial\n color={INJURY_COLORS.CUT_COLOR}\n transparent\n opacity={0.9}\n />\n </mesh>\n {/* Blood trail for lacerations */}\n {injury.type === InjuryType.LACERATION && (\n <mesh position={[0, -size * 0.5, 0]}>\n <boxGeometry args={[0.02, size, 0.02]} />\n <meshBasicMaterial\n color={KOREAN_COLORS.BLOODLOSS_INDICATOR}\n transparent\n opacity={0.7}\n />\n </mesh>\n )}\n </group>\n );\n }\n\n case InjuryType.FRACTURE: {\n return (\n <group position={worldPosition} data-testid={`injury-${injury.id}`}>\n {/* Fracture indicator - pulsing gold ring */}\n <mesh rotation={[-Math.PI / 2, 0, 0]}>\n <ringGeometry args={[size * 0.8, size, 16]} />\n <meshBasicMaterial\n color={INJURY_COLORS.FRACTURE_INDICATOR}\n transparent\n opacity={0.6}\n side={THREE.DoubleSide}\n />\n </mesh>\n {/* Cross indicator */}\n <mesh>\n <boxGeometry args={[size * 2, 0.02, 0.02]} />\n <meshBasicMaterial\n color={INJURY_COLORS.FRACTURE_INDICATOR}\n transparent\n opacity={0.8}\n />\n </mesh>\n <mesh rotation={[0, 0, Math.PI / 2]}>\n <boxGeometry args={[size * 2, 0.02, 0.02]} />\n <meshBasicMaterial\n color={INJURY_COLORS.FRACTURE_INDICATOR}\n transparent\n opacity={0.8}\n />\n </mesh>\n </group>\n );\n }\n\n default:\n return null;\n }\n};\n\n/**\n * FractureWarning - Html overlay warning for critical bone damage\n * \n * Rendered as a styled Html overlay with Korean/English text and alert semantics.\n */\nconst FractureWarning: React.FC<{\n health: number;\n isMobile: boolean;\n}> = ({ health, isMobile }) => {\n // Calculate opacity before early return to avoid conditional hook call\n const warningOpacity = useMemo(() => {\n // Pulse more intensely as health drops\n const rawOpacity = 0.5 + (30 - health) / 60; // 0.5 at 30% health, 1.0 at 0% health\n // Clamp to valid CSS opacity range [0, 1] in case health falls outside [0, 30]\n return Math.min(1, Math.max(0, rawOpacity));\n }, [health]);\n\n if (health >= 30) return null;\n\n return (\n <Html center position={[0, 2.5, 0]}>\n <div\n style={{\n padding: isMobile ? \"8px 12px\" : \"10px 16px\",\n backgroundColor: hexToRgbaString(INJURY_COLORS.FRACTURE_INDICATOR, warningOpacity * 0.3),\n border: `2px solid ${hexToRgbaString(INJURY_COLORS.FRACTURE_INDICATOR, 1)}`,\n borderRadius: \"6px\",\n fontSize: isMobile ? \"12px\" : \"14px\",\n color: hexToRgbaString(INJURY_COLORS.FRACTURE_INDICATOR, 1),\n fontWeight: \"bold\",\n textShadow: \"0 0 4px rgba(0,0,0,0.8)\",\n animation: \"fracturePulse 1s ease-in-out infinite\",\n fontFamily: FONT_FAMILY.KOREAN,\n }}\n data-testid=\"fracture-warning\"\n role=\"alert\"\n aria-live=\"assertive\"\n >\n ⚠️ 골절위험 | Bone Fracture Risk\n </div>\n <style>\n {`\n @keyframes fracturePulse {\n 0%, 100% { opacity: 0.7; transform: scale(1); }\n 50% { opacity: 1; transform: scale(1.05); }\n }\n `}\n </style>\n </Html>\n );\n};\n\n/**\n * TraumaOverlay3D Component\n *\n * Visualizes progressive combat trauma including bruising, cuts, and bone damage\n * on 3D character models. Injuries persist across rounds and darken with repeated\n * hits to the same body region.\n *\n * @example\n * ```tsx\n * const [injuries, setInjuries] = useState<Injury[]>([]);\n *\n * // On hit event\n * const handleHit = (region: BodyRegion, position: [number, number, number], type: InjuryType) => {\n * const existingInjury = injuries.find(i => \n * i.region === region && \n * distance(i.position, position) < 0.2\n * );\n *\n * if (existingInjury) {\n * // Progressive bruising - increase hit count\n * setInjuries(prev => prev.map(i => \n * i.id === existingInjury.id \n * ? { ...i, hitCount: i.hitCount + 1, severity: Math.min(1.0, i.severity + 0.2) }\n * : i\n * ));\n * } else {\n * // New injury\n * setInjuries([...injuries, {\n * id: generateId(),\n * region,\n * type,\n * position,\n * severity: 0.5,\n * hitCount: 1,\n * timestamp: Date.now(),\n * }]);\n * }\n * };\n *\n * <TraumaOverlay3D\n * playerId={playerId}\n * health={playerHealth}\n * injuries={injuries}\n * characterPosition={characterPosition}\n * isMobile={isMobile}\n * showFractures={true}\n * />\n * ```\n */\nexport const TraumaOverlay3D: React.FC<TraumaOverlay3DProps> = ({\n playerId,\n health,\n injuries,\n characterPosition,\n isMobile = false,\n showFractures = true,\n}) => {\n // Filter injuries for this player\n const playerInjuries = useMemo(() => {\n // In multi-player scenarios, filter by player when available\n if (playerId === null || playerId === undefined) {\n // Single-player or unspecified player: show all injuries\n return injuries;\n }\n\n // Backward-compatible filtering:\n // - If an injury has a playerId, it must match the current playerId.\n // - If an injury has no playerId, include it (legacy/global injuries).\n return injuries.filter((injury) => {\n if (injury.playerId === null || injury.playerId === undefined) {\n return true;\n }\n return injury.playerId === playerId;\n });\n }, [injuries, playerId]);\n\n // Separate fractures from other injuries\n const { fractures, otherInjuries } = useMemo(() => {\n const frac = playerInjuries.filter((i) => i.type === InjuryType.FRACTURE);\n const other = playerInjuries.filter((i) => i.type !== InjuryType.FRACTURE);\n return { fractures: frac, otherInjuries: other };\n }, [playerInjuries]);\n\n return (\n <group data-testid={`trauma-overlay-${playerId}`}>\n {/* Render non-fracture injuries */}\n {otherInjuries.map((injury) => (\n <InjuryMarker\n key={injury.id}\n injury={injury}\n characterPosition={characterPosition}\n isMobile={isMobile}\n />\n ))}\n\n {/* Render fractures if enabled and health is critical */}\n {showFractures &&\n health < 30 &&\n fractures.map((injury) => (\n <InjuryMarker\n key={injury.id}\n injury={injury}\n characterPosition={characterPosition}\n isMobile={isMobile}\n />\n ))}\n\n {/* Fracture warning overlay */}\n {showFractures && health < 30 && fractures.length > 0 && (\n <FractureWarning health={health} isMobile={isMobile} />\n )}\n </group>\n );\n};\n\nexport default TraumaOverlay3D;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAM,gBAAgB;CACpB,cAAc;CACd,YAAY;CACZ,eAAe;CACf,WAAW;CACX,oBAAoB,cAAc;CACnC;;;;AAKD,IAAM,kBAAkB,UAAkB,aAA6B;AACrE,KAAI,YAAY,KAAK,WAAW,GAC9B,QAAO,cAAc;UACZ,YAAY,KAAK,WAAW,GACrC,QAAO,cAAc;KAErB,QAAO,cAAc;;;;;AAOzB,IAAM,iBAAiB,a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D"}
1
+ {"version":3,"file":"TraumaOverlay3D.js","names":[],"sources":["../../../../../../src/components/screens/combat/components/effects/TraumaOverlay3D.tsx"],"sourcesContent":["/**\n * TraumaOverlay3D - Bruising and injury visualization system\n *\n * Renders progressive bruising, cuts, and bone fracture indicators on 3D character models\n * using shader-based texture overlays with color blending. Bruises darken with repeated\n * hits to the same body region and persist across combat rounds.\n *\n * Features:\n * - Progressive bruising (purple/black gradients)\n * - Cut/laceration marks for sharp strikes\n * - Bone fracture indicators at <30% health\n * - Injury persistence across rounds\n * - Korean-themed injury visualization\n *\n * @module components/combat/TraumaOverlay3D\n * @category Combat Effects\n * @korean 외상오버레이3D\n */\n\nimport { Html } from \"@react-three/drei\";\nimport React, { useMemo } from \"react\";\nimport * as THREE from \"three\";\nimport { KOREAN_COLORS, FONT_FAMILY } from \"../../../../../types/constants\";\nimport { hexToRgbaString } from \"../../../../../utils/colorUtils\";\nimport { InjuryType, Injury } from \"../../../../../types/injury\";\n\n/**\n * Props for TraumaOverlay3D component\n */\nexport interface TraumaOverlay3DProps {\n /** Character ID for injury tracking */\n readonly playerId: string;\n /** Current health (0-100) */\n readonly health: number;\n /** Active injuries to visualize */\n readonly injuries: readonly Injury[];\n /** Character position in world space */\n readonly characterPosition: [number, number, number];\n /** Whether character is mobile (simplified visualization) */\n readonly isMobile?: boolean;\n /** Whether to show fracture indicators */\n readonly showFractures?: boolean;\n}\n\n// Re-export for backward compatibility\nexport { InjuryType };\nexport type { Injury };\n\n/**\n * Color constants for injury visualization\n */\nconst INJURY_COLORS = {\n BRUISE_FRESH: 0x8B0000, // Dark red (fresh bruise)\n BRUISE_OLD: 0x4B0082, // Indigo (aging bruise)\n BRUISE_SEVERE: 0x000000, // Black (severe bruising)\n CUT_COLOR: 0xFF0000, // Bright red (cut)\n FRACTURE_INDICATOR: KOREAN_COLORS.ACCENT_GOLD, // Gold (bone fracture)\n} as const;\n\n/**\n * Get bruise color based on severity and hit count\n */\nconst getBruiseColor = (severity: number, hitCount: number): number => {\n if (hitCount >= 3 || severity > 0.8) {\n return INJURY_COLORS.BRUISE_SEVERE; // Black for severe/repeated trauma\n } else if (hitCount >= 2 || severity > 0.5) {\n return INJURY_COLORS.BRUISE_OLD; // Indigo for moderate bruising\n } else {\n return INJURY_COLORS.BRUISE_FRESH; // Dark red for fresh bruise\n }\n};\n\n/**\n * Get injury size based on severity\n */\nconst getInjurySize = (severity: number): number => {\n return 0.1 + severity * 0.3; // 0.1 to 0.4 units\n};\n\n/**\n * InjuryMarker - Individual injury visualization\n */\nconst InjuryMarker: React.FC<{\n injury: Injury;\n characterPosition: [number, number, number];\n isMobile: boolean;\n}> = ({ injury, characterPosition, isMobile }) => {\n // Calculate world position relative to character\n const worldPosition: [number, number, number] = useMemo(() => {\n return [\n characterPosition[0] + injury.position[0],\n characterPosition[1] + injury.position[1],\n characterPosition[2] + injury.position[2],\n ];\n }, [characterPosition, injury.position]);\n\n const size = useMemo(() => getInjurySize(injury.severity), [injury.severity]);\n\n // Render based on injury type\n switch (injury.type) {\n case InjuryType.BRUISE: {\n const color = getBruiseColor(injury.severity, injury.hitCount);\n const opacity = Math.min(0.8, 0.3 + injury.severity * 0.5);\n\n return (\n <mesh position={worldPosition} data-testid={`injury-${injury.id}`}>\n <sphereGeometry args={[size, isMobile ? 8 : 16, isMobile ? 8 : 16]} />\n <meshBasicMaterial\n color={color}\n transparent\n opacity={opacity}\n depthTest={true}\n />\n </mesh>\n );\n }\n\n case InjuryType.CUT:\n case InjuryType.LACERATION: {\n const cutLength = injury.type === InjuryType.LACERATION ? size * 3 : size * 2;\n return (\n <group position={worldPosition} data-testid={`injury-${injury.id}`}>\n {/* Cut mark - thin red line */}\n <mesh>\n <boxGeometry args={[cutLength, 0.02, 0.02]} />\n <meshBasicMaterial\n color={INJURY_COLORS.CUT_COLOR}\n transparent\n opacity={0.9}\n />\n </mesh>\n {/* Blood trail for lacerations */}\n {injury.type === InjuryType.LACERATION && (\n <mesh position={[0, -size * 0.5, 0]}>\n <boxGeometry args={[0.02, size, 0.02]} />\n <meshBasicMaterial\n color={KOREAN_COLORS.BLOODLOSS_INDICATOR}\n transparent\n opacity={0.7}\n />\n </mesh>\n )}\n </group>\n );\n }\n\n case InjuryType.FRACTURE: {\n return (\n <group position={worldPosition} data-testid={`injury-${injury.id}`}>\n {/* Fracture indicator - pulsing gold ring */}\n <mesh rotation={[-Math.PI / 2, 0, 0]}>\n <ringGeometry args={[size * 0.8, size, 16]} />\n <meshBasicMaterial\n color={INJURY_COLORS.FRACTURE_INDICATOR}\n transparent\n opacity={0.6}\n side={THREE.DoubleSide}\n />\n </mesh>\n {/* Cross indicator */}\n <mesh>\n <boxGeometry args={[size * 2, 0.02, 0.02]} />\n <meshBasicMaterial\n color={INJURY_COLORS.FRACTURE_INDICATOR}\n transparent\n opacity={0.8}\n />\n </mesh>\n <mesh rotation={[0, 0, Math.PI / 2]}>\n <boxGeometry args={[size * 2, 0.02, 0.02]} />\n <meshBasicMaterial\n color={INJURY_COLORS.FRACTURE_INDICATOR}\n transparent\n opacity={0.8}\n />\n </mesh>\n </group>\n );\n }\n\n default:\n return null;\n }\n};\n\n/**\n * FractureWarning - Html overlay warning for critical bone damage\n * \n * Rendered as a styled Html overlay with Korean/English text and alert semantics.\n */\nconst FractureWarning: React.FC<{\n health: number;\n isMobile: boolean;\n}> = ({ health, isMobile }) => {\n // Calculate opacity before early return to avoid conditional hook call\n const warningOpacity = useMemo(() => {\n // Pulse more intensely as health drops\n const rawOpacity = 0.5 + (30 - health) / 60; // 0.5 at 30% health, 1.0 at 0% health\n // Clamp to valid CSS opacity range [0, 1] in case health falls outside [0, 30]\n return Math.min(1, Math.max(0, rawOpacity));\n }, [health]);\n\n if (health >= 30) return null;\n\n return (\n <Html center position={[0, 2.5, 0]}>\n <div\n style={{\n padding: isMobile ? \"8px 12px\" : \"10px 16px\",\n backgroundColor: hexToRgbaString(INJURY_COLORS.FRACTURE_INDICATOR, warningOpacity * 0.3),\n border: `2px solid ${hexToRgbaString(INJURY_COLORS.FRACTURE_INDICATOR, 1)}`,\n borderRadius: \"6px\",\n fontSize: isMobile ? \"12px\" : \"14px\",\n color: hexToRgbaString(INJURY_COLORS.FRACTURE_INDICATOR, 1),\n fontWeight: \"bold\",\n textShadow: \"0 0 4px rgba(0,0,0,0.8)\",\n animation: \"fracturePulse 1s ease-in-out infinite\",\n fontFamily: FONT_FAMILY.KOREAN,\n }}\n data-testid=\"fracture-warning\"\n role=\"alert\"\n aria-live=\"assertive\"\n >\n ⚠️ 골절위험 | Bone Fracture Risk\n </div>\n <style>\n {`\n @keyframes fracturePulse {\n 0%, 100% { opacity: 0.7; transform: scale(1); }\n 50% { opacity: 1; transform: scale(1.05); }\n }\n `}\n </style>\n </Html>\n );\n};\n\n/**\n * TraumaOverlay3D Component\n *\n * Visualizes progressive combat trauma including bruising, cuts, and bone damage\n * on 3D character models. Injuries persist across rounds and darken with repeated\n * hits to the same body region.\n *\n * @example\n * ```tsx\n * const [injuries, setInjuries] = useState<Injury[]>([]);\n *\n * // On hit event\n * const handleHit = (region: BodyRegion, position: [number, number, number], type: InjuryType) => {\n * const existingInjury = injuries.find(i => \n * i.region === region && \n * distance(i.position, position) < 0.2\n * );\n *\n * if (existingInjury) {\n * // Progressive bruising - increase hit count\n * setInjuries(prev => prev.map(i => \n * i.id === existingInjury.id \n * ? { ...i, hitCount: i.hitCount + 1, severity: Math.min(1.0, i.severity + 0.2) }\n * : i\n * ));\n * } else {\n * // New injury\n * setInjuries([...injuries, {\n * id: generateId(),\n * region,\n * type,\n * position,\n * severity: 0.5,\n * hitCount: 1,\n * timestamp: Date.now(),\n * }]);\n * }\n * };\n *\n * <TraumaOverlay3D\n * playerId={playerId}\n * health={playerHealth}\n * injuries={injuries}\n * characterPosition={characterPosition}\n * isMobile={isMobile}\n * showFractures={true}\n * />\n * ```\n */\nexport const TraumaOverlay3D: React.FC<TraumaOverlay3DProps> = ({\n playerId,\n health,\n injuries,\n characterPosition,\n isMobile = false,\n showFractures = true,\n}) => {\n // Filter injuries for this player\n const playerInjuries = useMemo(() => {\n // In multi-player scenarios, filter by player when available\n if (playerId === null || playerId === undefined) {\n // Single-player or unspecified player: show all injuries\n return injuries;\n }\n\n // Backward-compatible filtering:\n // - If an injury has a playerId, it must match the current playerId.\n // - If an injury has no playerId, include it (legacy/global injuries).\n return injuries.filter((injury) => {\n if (injury.playerId === null || injury.playerId === undefined) {\n return true;\n }\n return injury.playerId === playerId;\n });\n }, [injuries, playerId]);\n\n // Separate fractures from other injuries\n const { fractures, otherInjuries } = useMemo(() => {\n const frac = playerInjuries.filter((i) => i.type === InjuryType.FRACTURE);\n const other = playerInjuries.filter((i) => i.type !== InjuryType.FRACTURE);\n return { fractures: frac, otherInjuries: other };\n }, [playerInjuries]);\n\n return (\n <group data-testid={`trauma-overlay-${playerId}`}>\n {/* Render non-fracture injuries */}\n {otherInjuries.map((injury) => (\n <InjuryMarker\n key={injury.id}\n injury={injury}\n characterPosition={characterPosition}\n isMobile={isMobile}\n />\n ))}\n\n {/* Render fractures if enabled and health is critical */}\n {showFractures &&\n health < 30 &&\n fractures.map((injury) => (\n <InjuryMarker\n key={injury.id}\n injury={injury}\n characterPosition={characterPosition}\n isMobile={isMobile}\n />\n ))}\n\n {/* Fracture warning overlay */}\n {showFractures && health < 30 && fractures.length > 0 && (\n <FractureWarning health={health} isMobile={isMobile} />\n )}\n </group>\n );\n};\n\nexport default TraumaOverlay3D;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAM,gBAAgB;CACpB,cAAc;CACd,YAAY;CACZ,eAAe;CACf,WAAW;CACX,oBAAoB,cAAc;CACnC;;;;AAKD,IAAM,kBAAkB,UAAkB,aAA6B;CACrE,IAAI,YAAY,KAAK,WAAW,IAC9B,OAAO,cAAc;MAChB,IAAI,YAAY,KAAK,WAAW,IACrC,OAAO,cAAc;MAErB,OAAO,cAAc;;;;;AAOzB,IAAM,iBAAiB,aAA6B;CAClD,OAAO,KAAM,WAAW;;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file":"MatchCountdown.js","names":[],"sources":["../../../../../../src/components/screens/combat/components/feedback/MatchCountdown.tsx"],"sourcesContent":["/**\n * MatchCountdown Component - Displays match start countdown sequence\n *\n * Korean: 매치 시작 카운트다운 (Match Start Countdown)\n *\n * Shows \"Ready?\" → \"3... 2... 1...\" → \"Fight!\" sequence with animations.\n * Implements Korean cyberpunk aesthetic with bilingual text support.\n * Plays audio cues for countdown and fight announcement.\n *\n * Refactored to use useKoreanTheme for consistent styling.\n *\n * @module components/combat/MatchCountdown\n * @category Combat UI\n */\n\nimport React, { useEffect, useMemo, useRef } from \"react\";\nimport { useAudio } from \"../../../../../audio/AudioProvider\";\nimport {\n MatchCountdownState,\n useMatchCountdown,\n} from \"../../../../../hooks/useMatchCountdown\";\nimport { useKoreanTheme } from \"../../../../shared/base/useKoreanTheme\";\nimport { hexColorToCSS } from \"../../../../../utils/colorUtils\";\n\n/**\n * Props for the MatchCountdown component\n */\nexport interface MatchCountdownProps {\n /** Callback when countdown completes */\n readonly onComplete: () => void;\n /** Whether layout should adapt for mobile screens */\n readonly isMobile: boolean;\n /** Optional callback for skip button */\n readonly onSkip?: () => void;\n /** Whether skip button should be shown */\n readonly showSkip?: boolean;\n}\n\n/**\n * Get display text for current countdown state\n */\nfunction getDisplayText(\n state: MatchCountdownState,\n currentNumber: number\n): {\n ko: string;\n en: string;\n} | null {\n switch (state) {\n case \"ready\":\n return { ko: \"준비?\", en: \"Ready?\" };\n case \"counting\":\n return { ko: String(currentNumber), en: String(currentNumber) };\n case \"fight\":\n return { ko: \"전투!\", en: \"Fight!\" };\n default:\n return null;\n }\n}\n\n/**\n * MatchCountdown Component\n *\n * Displays match start countdown with:\n * - \"Ready?\" announcement (1 second)\n * - Countdown from 3 to 1 (1 second intervals)\n * - \"Fight!\" announcement (1 second)\n * - Pulse/scale animations for emphasis\n * - Bilingual Korean-English text\n * - Audio cues for countdown and fight\n * - Optional skip button\n * - Responsive sizing for mobile/tablet/desktop\n *\n * Korean: 매치 시작 카운트다운 컴포넌트\n */\n// Static config outside component to prevent re-creation on each render\nconst COUNTDOWN_CONFIG = {\n readyDuration: 1,\n countdownInterval: 1,\n fightDuration: 1,\n startNumber: 3,\n} as const;\n\nexport const MatchCountdown: React.FC<MatchCountdownProps> = ({\n onComplete,\n isMobile,\n onSkip,\n showSkip = false,\n}) => {\n const audio = useAudio();\n const theme = useKoreanTheme({ variant: \"primary\", size: \"xlarge\", isMobile });\n\n // Use match countdown hook with stable config reference\n const { state, currentNumber, startCountdown, skipCountdown, isActive } =\n useMatchCountdown(COUNTDOWN_CONFIG, onComplete);\n\n // Track if we've started to avoid double-start in Strict Mode\n const hasStartedRef = useRef(false);\n\n // Auto-start countdown on mount (only once)\n useEffect(() => {\n if (!hasStartedRef.current) {\n hasStartedRef.current = true;\n startCountdown();\n }\n }, [startCountdown]);\n\n // Play audio cues based on state transitions\n useEffect(() => {\n if (!audio.isAudioReady) return;\n\n if (state === \"counting\" && currentNumber > 0) {\n // Play beep for each countdown number\n audio.playSFX(\"attack_light\"); // Using placeholder - will be countdown_beep\n } else if (state === \"fight\") {\n // Play fight announcement\n audio.playSFX(\"attack_heavy\"); // Using placeholder - will be fight_start\n }\n }, [state, currentNumber, audio]);\n\n // Handle skip\n const handleSkip = () => {\n skipCountdown();\n onSkip?.();\n };\n\n // Get display text\n const displayText = getDisplayText(state, currentNumber);\n\n // Calculate responsive font sizes - extracted to avoid nested ternaries\n const getMainFontSize = (): string => {\n if (isMobile) {\n return state === \"fight\" ? \"72px\" : \"64px\";\n }\n return state === \"fight\" ? \"120px\" : \"96px\";\n };\n\n const getSubFontSize = (): string => {\n if (isMobile) {\n return state === \"fight\" ? \"48px\" : \"40px\";\n }\n return state === \"fight\" ? \"72px\" : \"56px\";\n };\n\n const mainFontSize = getMainFontSize();\n const subFontSize = getSubFontSize();\n\n // Memoize colors for performance using theme\n const goldColor = useMemo(() => hexColorToCSS(theme.colors.ACCENT_GOLD), [theme.colors.ACCENT_GOLD]);\n const cyanColor = useMemo(\n () => hexColorToCSS(theme.colors.PRIMARY_CYAN),\n [theme.colors.PRIMARY_CYAN]\n );\n const darkBg = useMemo(\n () => hexColorToCSS(theme.colors.UI_BACKGROUND_DARK),\n [theme.colors.UI_BACKGROUND_DARK]\n );\n\n // Don't render if countdown not active or complete\n if (!isActive || !displayText) {\n return null;\n }\n\n return (\n <>\n <div\n data-testid=\"match-countdown\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Match countdown in progress\"\n aria-live=\"assertive\"\n style={{\n position: \"fixed\",\n top: 0,\n left: 0,\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: state === \"fight\" ? `${darkBg}cc` : `${darkBg}ee`,\n zIndex: 1000,\n animation: state === \"ready\" ? \"fadeIn 0.3s ease-in\" : \"none\",\n }}\n >\n <div\n style={{\n fontSize: mainFontSize,\n fontWeight: \"bold\",\n color: state === \"fight\" ? goldColor : cyanColor,\n fontFamily: theme.fontFamily.KOREAN,\n textShadow: `0 0 ${state === \"fight\" ? \"40px\" : \"30px\"} ${\n state === \"fight\" ? goldColor : cyanColor\n }`,\n animation:\n state === \"ready\"\n ? \"pulse 0.8s ease-out\"\n : state === \"counting\"\n ? \"countdownPulse 0.8s ease-out\"\n : state === \"fight\"\n ? \"flash 0.3s ease-out\"\n : \"none\",\n textAlign: \"center\",\n userSelect: \"none\",\n }}\n data-testid=\"countdown-text\"\n >\n {displayText.ko}\n <br />\n <span\n style={{\n fontSize: subFontSize,\n }}\n >\n {displayText.en}\n </span>\n </div>\n\n {/* Optional Skip Button */}\n {showSkip && state !== \"fight\" && (\n <button\n onClick={handleSkip}\n data-testid=\"skip-countdown-button\"\n aria-label=\"Skip countdown\"\n style={{\n position: \"absolute\",\n bottom: isMobile ? \"40px\" : \"60px\",\n padding: isMobile ? \"10px 24px\" : \"12px 32px\",\n fontSize: isMobile ? \"14px\" : \"16px\",\n backgroundColor: cyanColor,\n color: darkBg,\n border: \"none\",\n borderRadius: \"6px\",\n fontFamily: theme.fontFamily.KOREAN,\n fontWeight: \"bold\",\n cursor: \"pointer\",\n transition: \"all 0.2s ease\",\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.transform = \"scale(1.05)\";\n e.currentTarget.style.boxShadow = `0 0 20px ${cyanColor}`;\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.transform = \"scale(1)\";\n e.currentTarget.style.boxShadow = \"none\";\n }}\n onFocus={(e) => {\n e.currentTarget.style.transform = \"scale(1.05)\";\n e.currentTarget.style.boxShadow = `0 0 20px ${cyanColor}`;\n e.currentTarget.style.outline = `2px solid ${cyanColor}`;\n }}\n onBlur={(e) => {\n e.currentTarget.style.transform = \"scale(1)\";\n e.currentTarget.style.boxShadow = \"none\";\n e.currentTarget.style.outline = \"none\";\n }}\n >\n 건너뛰기 | Skip\n </button>\n )}\n </div>\n\n {/* CSS Animations */}\n <style>\n {`\n @keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n\n @keyframes pulse {\n 0% {\n opacity: 0;\n transform: scale(0.9);\n }\n 50% {\n opacity: 1;\n transform: scale(1.05);\n }\n 100% {\n opacity: 1;\n transform: scale(1);\n }\n }\n\n @keyframes countdownPulse {\n 0% {\n opacity: 0;\n transform: scale(1.2);\n }\n 50% {\n opacity: 1;\n transform: scale(1.1);\n }\n 100% {\n opacity: 1;\n transform: scale(1);\n }\n }\n\n @keyframes flash {\n 0% {\n opacity: 0;\n transform: scale(1.5);\n }\n 30% {\n opacity: 1;\n transform: scale(1.3);\n }\n 100% {\n opacity: 1;\n transform: scale(1);\n }\n }\n `}\n </style>\n </>\n );\n};\n\nexport default MatchCountdown;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAS,eACP,OACA,eAIO;AACP,SAAQ,OAAR;EACE,KAAK,QACH,QAAO;GAAE,IAAI;GAAO,IAAI;GAAU;EACpC,KAAK,WACH,QAAO;GAAE,IAAI,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AEhD,eAAe,MAAM;AACnB,MAAE,cAAc,MAAM,YAAY;AAClC,MAAE,cAAc,MAAM,YAAY;;GAEpC,UAAU,MAAM;AACd,MAAE,cAAc,MAAM,YAAY;AAClC,MAAE,cAAc,MAAM,YAAY,YAAY;AAC9C,MAAE,cAAc,MAAM,UAAU,aAAa;;GAE/C,SAAS,MAAM;AACb,MAAE,cAAc,MAAM,YAAY;AAClC,MAAE,cAAc,MAAM,YAAY;AAClC,MAAE,cAAc,MAAM,UAAU;;aAEnC;GAEQ,CAAA,CAEP;KAGN,oBAAC,SAAD,EAAA,UACG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAuDK,CAAA,CACP,EAAA,CAAA"}
1
+ {"version":3,"file":"MatchCountdown.js","names":[],"sources":["../../../../../../src/components/screens/combat/components/feedback/MatchCountdown.tsx"],"sourcesContent":["/**\n * MatchCountdown Component - Displays match start countdown sequence\n *\n * Korean: 매치 시작 카운트다운 (Match Start Countdown)\n *\n * Shows \"Ready?\" → \"3... 2... 1...\" → \"Fight!\" sequence with animations.\n * Implements Korean cyberpunk aesthetic with bilingual text support.\n * Plays audio cues for countdown and fight announcement.\n *\n * Refactored to use useKoreanTheme for consistent styling.\n *\n * @module components/combat/MatchCountdown\n * @category Combat UI\n */\n\nimport React, { useEffect, useMemo, useRef } from \"react\";\nimport { useAudio } from \"../../../../../audio/AudioProvider\";\nimport {\n MatchCountdownState,\n useMatchCountdown,\n} from \"../../../../../hooks/useMatchCountdown\";\nimport { useKoreanTheme } from \"../../../../shared/base/useKoreanTheme\";\nimport { hexColorToCSS } from \"../../../../../utils/colorUtils\";\n\n/**\n * Props for the MatchCountdown component\n */\nexport interface MatchCountdownProps {\n /** Callback when countdown completes */\n readonly onComplete: () => void;\n /** Whether layout should adapt for mobile screens */\n readonly isMobile: boolean;\n /** Optional callback for skip button */\n readonly onSkip?: () => void;\n /** Whether skip button should be shown */\n readonly showSkip?: boolean;\n}\n\n/**\n * Get display text for current countdown state\n */\nfunction getDisplayText(\n state: MatchCountdownState,\n currentNumber: number\n): {\n ko: string;\n en: string;\n} | null {\n switch (state) {\n case \"ready\":\n return { ko: \"준비?\", en: \"Ready?\" };\n case \"counting\":\n return { ko: String(currentNumber), en: String(currentNumber) };\n case \"fight\":\n return { ko: \"전투!\", en: \"Fight!\" };\n default:\n return null;\n }\n}\n\n/**\n * MatchCountdown Component\n *\n * Displays match start countdown with:\n * - \"Ready?\" announcement (1 second)\n * - Countdown from 3 to 1 (1 second intervals)\n * - \"Fight!\" announcement (1 second)\n * - Pulse/scale animations for emphasis\n * - Bilingual Korean-English text\n * - Audio cues for countdown and fight\n * - Optional skip button\n * - Responsive sizing for mobile/tablet/desktop\n *\n * Korean: 매치 시작 카운트다운 컴포넌트\n */\n// Static config outside component to prevent re-creation on each render\nconst COUNTDOWN_CONFIG = {\n readyDuration: 1,\n countdownInterval: 1,\n fightDuration: 1,\n startNumber: 3,\n} as const;\n\nexport const MatchCountdown: React.FC<MatchCountdownProps> = ({\n onComplete,\n isMobile,\n onSkip,\n showSkip = false,\n}) => {\n const audio = useAudio();\n const theme = useKoreanTheme({ variant: \"primary\", size: \"xlarge\", isMobile });\n\n // Use match countdown hook with stable config reference\n const { state, currentNumber, startCountdown, skipCountdown, isActive } =\n useMatchCountdown(COUNTDOWN_CONFIG, onComplete);\n\n // Track if we've started to avoid double-start in Strict Mode\n const hasStartedRef = useRef(false);\n\n // Auto-start countdown on mount (only once)\n useEffect(() => {\n if (!hasStartedRef.current) {\n hasStartedRef.current = true;\n startCountdown();\n }\n }, [startCountdown]);\n\n // Play audio cues based on state transitions\n useEffect(() => {\n if (!audio.isAudioReady) return;\n\n if (state === \"counting\" && currentNumber > 0) {\n // Play beep for each countdown number\n audio.playSFX(\"attack_light\"); // Using placeholder - will be countdown_beep\n } else if (state === \"fight\") {\n // Play fight announcement\n audio.playSFX(\"attack_heavy\"); // Using placeholder - will be fight_start\n }\n }, [state, currentNumber, audio]);\n\n // Handle skip\n const handleSkip = () => {\n skipCountdown();\n onSkip?.();\n };\n\n // Get display text\n const displayText = getDisplayText(state, currentNumber);\n\n // Calculate responsive font sizes - extracted to avoid nested ternaries\n const getMainFontSize = (): string => {\n if (isMobile) {\n return state === \"fight\" ? \"72px\" : \"64px\";\n }\n return state === \"fight\" ? \"120px\" : \"96px\";\n };\n\n const getSubFontSize = (): string => {\n if (isMobile) {\n return state === \"fight\" ? \"48px\" : \"40px\";\n }\n return state === \"fight\" ? \"72px\" : \"56px\";\n };\n\n const mainFontSize = getMainFontSize();\n const subFontSize = getSubFontSize();\n\n // Memoize colors for performance using theme\n const goldColor = useMemo(() => hexColorToCSS(theme.colors.ACCENT_GOLD), [theme.colors.ACCENT_GOLD]);\n const cyanColor = useMemo(\n () => hexColorToCSS(theme.colors.PRIMARY_CYAN),\n [theme.colors.PRIMARY_CYAN]\n );\n const darkBg = useMemo(\n () => hexColorToCSS(theme.colors.UI_BACKGROUND_DARK),\n [theme.colors.UI_BACKGROUND_DARK]\n );\n\n // Don't render if countdown not active or complete\n if (!isActive || !displayText) {\n return null;\n }\n\n return (\n <>\n <div\n data-testid=\"match-countdown\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Match countdown in progress\"\n aria-live=\"assertive\"\n style={{\n position: \"fixed\",\n top: 0,\n left: 0,\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: state === \"fight\" ? `${darkBg}cc` : `${darkBg}ee`,\n zIndex: 1000,\n animation: state === \"ready\" ? \"fadeIn 0.3s ease-in\" : \"none\",\n }}\n >\n <div\n style={{\n fontSize: mainFontSize,\n fontWeight: \"bold\",\n color: state === \"fight\" ? goldColor : cyanColor,\n fontFamily: theme.fontFamily.KOREAN,\n textShadow: `0 0 ${state === \"fight\" ? \"40px\" : \"30px\"} ${\n state === \"fight\" ? goldColor : cyanColor\n }`,\n animation:\n state === \"ready\"\n ? \"pulse 0.8s ease-out\"\n : state === \"counting\"\n ? \"countdownPulse 0.8s ease-out\"\n : state === \"fight\"\n ? \"flash 0.3s ease-out\"\n : \"none\",\n textAlign: \"center\",\n userSelect: \"none\",\n }}\n data-testid=\"countdown-text\"\n >\n {displayText.ko}\n <br />\n <span\n style={{\n fontSize: subFontSize,\n }}\n >\n {displayText.en}\n </span>\n </div>\n\n {/* Optional Skip Button */}\n {showSkip && state !== \"fight\" && (\n <button\n onClick={handleSkip}\n data-testid=\"skip-countdown-button\"\n aria-label=\"Skip countdown\"\n style={{\n position: \"absolute\",\n bottom: isMobile ? \"40px\" : \"60px\",\n padding: isMobile ? \"10px 24px\" : \"12px 32px\",\n fontSize: isMobile ? \"14px\" : \"16px\",\n backgroundColor: cyanColor,\n color: darkBg,\n border: \"none\",\n borderRadius: \"6px\",\n fontFamily: theme.fontFamily.KOREAN,\n fontWeight: \"bold\",\n cursor: \"pointer\",\n transition: \"all 0.2s ease\",\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.transform = \"scale(1.05)\";\n e.currentTarget.style.boxShadow = `0 0 20px ${cyanColor}`;\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.transform = \"scale(1)\";\n e.currentTarget.style.boxShadow = \"none\";\n }}\n onFocus={(e) => {\n e.currentTarget.style.transform = \"scale(1.05)\";\n e.currentTarget.style.boxShadow = `0 0 20px ${cyanColor}`;\n e.currentTarget.style.outline = `2px solid ${cyanColor}`;\n }}\n onBlur={(e) => {\n e.currentTarget.style.transform = \"scale(1)\";\n e.currentTarget.style.boxShadow = \"none\";\n e.currentTarget.style.outline = \"none\";\n }}\n >\n 건너뛰기 | Skip\n </button>\n )}\n </div>\n\n {/* CSS Animations */}\n <style>\n {`\n @keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n\n @keyframes pulse {\n 0% {\n opacity: 0;\n transform: scale(0.9);\n }\n 50% {\n opacity: 1;\n transform: scale(1.05);\n }\n 100% {\n opacity: 1;\n transform: scale(1);\n }\n }\n\n @keyframes countdownPulse {\n 0% {\n opacity: 0;\n transform: scale(1.2);\n }\n 50% {\n opacity: 1;\n transform: scale(1.1);\n }\n 100% {\n opacity: 1;\n transform: scale(1);\n }\n }\n\n @keyframes flash {\n 0% {\n opacity: 0;\n transform: scale(1.5);\n }\n 30% {\n opacity: 1;\n transform: scale(1.3);\n }\n 100% {\n opacity: 1;\n transform: scale(1);\n }\n }\n `}\n </style>\n </>\n );\n};\n\nexport default MatchCountdown;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAS,eACP,OACA,eAIO;CACP,QAAQ,OAAR;EACE,KAAK,SACH,OAAO;GAAE,IAAI;GAAO,IAAI;GAAU;EACpC,KAAK,YACH,OAAO;GAAE,IAAI,OAAO,cAAc;GAAE,IAAI,OAAO,cAAc;GAAE;EACjE,KAAK,SACH,OAAO;GAAE,IAAI;GAAO,IAAI;GAAU;EACpC,SACE,OAAO;;;;;;;;;;;;;;;;;;AAoBb,IAAM,mBAAmB;CACvB,eAAe;CACf,mBAAmB;CACnB,eAAe;CACf,aAAa;CACd;AAED,IAAa,kBAAiD,EAC5D,YACA,UACA,QACA,WAAW,YACP;CACJ,MAAM,QAAQ,UAAU;CACxB,MAAM,QAAQ,eAAe;EAAE,SAAS;EAAW,MAAM;EAAU;EAAU,CAAC;CAG9E,MAAM,EAAE,OAAO,eAAe,gBAAgB,eAAe,aAC3D,kBAAkB,kBAAkB,WAAW;CAGjD,MAAM,gBAAgB,OAAO,MAAM;CAGnC,gBAAgB;EACd,IAAI,CAAC,cAAc,SAAS;GAC1B,cAAc,UAAU;GACxB,gBAAgB;;IAEjB,CAAC,eAAe,CAAC;CAGpB,gBAAgB;EACd,IAAI,CAAC,MAAM,cAAc;EAEzB,IAAI,UAAU,cAAc,gBAAgB,GAE1C,MAAM,QAAQ,eAAe;OACxB,IAAI,UAAU,SAEnB,MAAM,QAAQ,eAAe;IAE9B;EAAC;EAAO;EAAe;EAAM,CAAC;CA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