All files / systems/animation EnhancedElbowKneeAnimations.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 0/0
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141                                                  31x                                                                 31x                                                   31x                                                   31x                                                 31x          
/**
 * Enhanced Elbow and Knee Animations with Recovery Phases
 * 
 * Applies RecoveryPhaseEnhancer to close-range combat animations following
 * Korean martial arts principles of 복귀 (Bokgwi - recovery/return).
 * 
 * Close-range techniques require faster recovery due to proximity to opponent.
 * 
 * @module systems/animation/EnhancedElbowKneeAnimations
 * @category Animation System
 * @korean 향상된팔꿈치무릎애니메이션
 */
 
import { 
  ELBOW_STRIKE_ANIMATION,
  ELBOW_UPPERCUT_ANIMATION,
  KNEE_STRIKE_ANIMATION,
} from "./ElbowKneeAnimations";
import { addRecoveryPhase } from "./RecoveryPhaseEnhancer";
import type { SkeletalAnimation } from "../../types/skeletal";
 
/**
 * Close-range recovery tension values
 * Optimized for rapid repositioning after elbow/knee techniques
 */
const CLOSE_RANGE_TENSION = {
  ELBOW_STRIKE: {
    intermediateReturn: 0.7,
    intermediate: 0.35,
    final: 0.08,
  },
  ELBOW_UPPERCUT: {
    intermediateReturn: 0.75,
    intermediate: 0.38,
    final: 0.09,
  },
  KNEE_STRIKE: {
    intermediateReturn: 0.85,
    intermediate: 0.42,
    final: 0.12,
  },
} as const;
 
/**
 * Enhanced elbow strike animation with proper recovery phase
 * 
 * **Korean**: 복귀 단계가 포함된 팔꿈치치기
 * 
 * Original duration: 350ms
 * Enhanced duration: 510ms (350ms technique + 160ms recovery)
 * 
 * Recovery characteristics:
 * - Very fast 160ms recovery (close-range requires quick repositioning)
 * - 70% intermediate return (rapid return to guard)
 * - Moderate tension (0.08) for immediate follow-up
 * 
 * @korean 향상된팔꿈치치기애니메이션
 */
export const ELBOW_STRIKE_ANIMATION_ENHANCED: SkeletalAnimation = addRecoveryPhase(
  ELBOW_STRIKE_ANIMATION,
  {
    duration: 0.16, // Very fast recovery for close-range
    intermediateReturnPercent: CLOSE_RANGE_TENSION.ELBOW_STRIKE.intermediateReturn,
    peakMuscleTension: 1.0, // Full power strike
    intermediateMuscleTension: CLOSE_RANGE_TENSION.ELBOW_STRIKE.intermediate,
    finalMuscleTension: CLOSE_RANGE_TENSION.ELBOW_STRIKE.final,
  }
);
 
/**
 * Enhanced elbow uppercut animation with proper recovery phase
 * 
 * **Korean**: 복귀 단계가 포함된 팔꿈치올려치기
 * 
 * Original duration: 350ms
 * Enhanced duration: 520ms (350ms technique + 170ms recovery)
 * 
 * Recovery characteristics:
 * - Fast 170ms recovery (close-range)
 * - 75% intermediate return (controlled return from vertical strike)
 * - Moderate tension for guard restoration
 * 
 * @korean 향상된팔꿈치올려치기애니메이션
 */
export const ELBOW_UPPERCUT_ANIMATION_ENHANCED: SkeletalAnimation = addRecoveryPhase(
  ELBOW_UPPERCUT_ANIMATION,
  {
    duration: 0.17, // Fast recovery
    intermediateReturnPercent: CLOSE_RANGE_TENSION.ELBOW_UPPERCUT.intermediateReturn,
    peakMuscleTension: 1.0, // Explosive vertical power
    intermediateMuscleTension: CLOSE_RANGE_TENSION.ELBOW_UPPERCUT.intermediate,
    finalMuscleTension: CLOSE_RANGE_TENSION.ELBOW_UPPERCUT.final,
  }
);
 
/**
 * Enhanced knee strike animation with proper recovery phase
 * 
 * **Korean**: 복귀 단계가 포함된 무릎차기
 * 
 * Original duration: 400ms
 * Enhanced duration: 590ms (400ms technique + 190ms recovery)
 * 
 * Recovery characteristics:
 * - Moderate 190ms recovery (balance restoration from single-leg position)
 * - 85% intermediate return (complete balance restoration needed)
 * - Higher final tension (0.12) for stable grounded position
 * 
 * @korean 향상된무릎차기애니메이션
 */
export const KNEE_STRIKE_ANIMATION_ENHANCED: SkeletalAnimation = addRecoveryPhase(
  KNEE_STRIKE_ANIMATION,
  {
    duration: 0.19, // Moderate recovery for balance
    intermediateReturnPercent: CLOSE_RANGE_TENSION.KNEE_STRIKE.intermediateReturn,
    peakMuscleTension: 1.0, // Maximum driving power
    intermediateMuscleTension: CLOSE_RANGE_TENSION.KNEE_STRIKE.intermediate,
    finalMuscleTension: CLOSE_RANGE_TENSION.KNEE_STRIKE.final,
  }
);
 
/**
 * Map of enhanced elbow/knee animations for easy lookup
 * 
 * **Korean**: 향상된 팔꿈치/무릎 애니메이션 맵
 * 
 * @example
 * ```typescript
 * import { ENHANCED_ELBOW_KNEE_ANIMATIONS } from './EnhancedElbowKneeAnimations';
 * 
 * const elbowStrike = ENHANCED_ELBOW_KNEE_ANIMATIONS.elbow_strike;
 * ```
 * 
 * @korean 향상된팔꿈치무릎애니메이션맵
 */
export const ENHANCED_ELBOW_KNEE_ANIMATIONS = {
  elbow_strike: ELBOW_STRIKE_ANIMATION_ENHANCED,
  elbow_uppercut: ELBOW_UPPERCUT_ANIMATION_ENHANCED,
  knee_strike: KNEE_STRIKE_ANIMATION_ENHANCED,
} as const;