All files / data techniqueMappings.ts

33.33% Statements 2/6
0% Branches 0/2
0% Functions 0/2
33.33% Lines 2/6

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                                                          2x                                                                   2x                                                                                                                                                      
/**
 * Technique to Animation Type mappings
 *
 * **Korean**: 기술-애니메이션 매핑
 *
 * Maps each technique to its corresponding AnimationType for attack movement physics.
 * This provides a type-safe, comprehensive mapping that replaces string-based
 * substring matching.
 *
 * @module data/techniqueMappings
 * @category Combat System
 * @korean 기술매핑
 */
 
import { TechniqueId } from "../types/techniqueId";
import { AnimationType } from "../systems/animation/builders/MartialArtsConstants";
import { AttackAnimationType } from "../types/skeletal";
 
/**
 * Maps AttackAnimationType (from technique definitions) to AnimationType (for movement physics)
 *
 * AttackAnimationType is the skeletal animation type (PUNCH_HIGH, KICK_FRONT, etc.)
 * AnimationType is the martial arts movement type for physics calculations
 *
 * @korean 공격애니메이션타입-애니메이션타입매핑
 */
export const ATTACK_ANIMATION_TO_MOVEMENT_TYPE: Record<
  AttackAnimationType,
  AnimationType
> = {
  // Punches → Punch types
  [AttackAnimationType.PUNCH_HIGH]: AnimationType.CROSS,
  [AttackAnimationType.PUNCH_MID]: AnimationType.JAB,
  [AttackAnimationType.PUNCH_LOW]: AnimationType.JAB,
 
  // Kicks → Kick types
  [AttackAnimationType.KICK_FRONT]: AnimationType.FRONT_KICK,
  [AttackAnimationType.KICK_SIDE]: AnimationType.SIDE_KICK,
  [AttackAnimationType.KICK_ROUNDHOUSE]: AnimationType.ROUNDHOUSE_KICK,
 
  // Elbows → Elbow types
  [AttackAnimationType.ELBOW_STRIKE]: AnimationType.ELBOW_STRIKE,
  [AttackAnimationType.ELBOW_UPPERCUT]: AnimationType.ELBOW_UPPERCUT,
 
  // Knees → Knee types
  [AttackAnimationType.KNEE_STRIKE]: AnimationType.KNEE_STRIKE,
  [AttackAnimationType.KNEE_CLINCH]: AnimationType.CLINCH_KNEE,
 
  // Pressure points → Specialized strikes
  [AttackAnimationType.PRESSURE_POINT]: AnimationType.PRESSURE_POINT_STRIKE,
  [AttackAnimationType.PRESSURE_POINT_RAPID]: AnimationType.RAPID_BARRAGE,
};
 
/**
 * Maps TechniqueId to AnimationType for movement physics
 *
 * This is the primary lookup table used by CombatScreen3D to determine
 * the correct movement animation for each technique.
 *
 * Derived from technique definitions but cached here for performance.
 *
 * @korean 기술ID-애니메이션타입매핑
 */
export const TECHNIQUE_TO_ANIMATION_TYPE: Record<TechniqueId, AnimationType> = {
  // 무사 (Musa) - Traditional Warrior
  [TechniqueId.MUSA_THUNDER_STRIKE]: AnimationType.HEAVEN_STRIKE, // PUNCH_HIGH → powerful descending
  [TechniqueId.MUSA_IRON_DEFENSE]: AnimationType.JAB, // PUNCH_MID → defensive
  [TechniqueId.MUSA_DRAGON_FIST]: AnimationType.JAB, // PUNCH_MID → piercing
  [TechniqueId.MUSA_MOUNTAIN_BREAKER]: AnimationType.CROSS, // PUNCH_HIGH → crushing
 
  // 암살자 (Amsalja) - Shadow Assassin
  [TechniqueId.AMSALJA_SHADOW_STRIKE]: AnimationType.PRESSURE_POINT_STRIKE, // PRESSURE_POINT
  [TechniqueId.AMSALJA_NERVE_STRIKE]: AnimationType.NERVE_STRIKE, // PRESSURE_POINT → precise
  [TechniqueId.AMSALJA_DEADLY_PRECISION]: AnimationType.PRESSURE_POINT_STRIKE, // PRESSURE_POINT
  [TechniqueId.AMSALJA_SILENT_DEATH]: AnimationType.PRESSURE_POINT_STRIKE, // PRESSURE_POINT → lethal
 
  // 해커 (Hacker) - Cyber Warrior
  [TechniqueId.HACKER_ELECTRIC_SHOCK]: AnimationType.LIGHTNING_STRIKE, // PUNCH_MID → electric
  [TechniqueId.HACKER_DATA_STRIKE]: AnimationType.PRESSURE_POINT_STRIKE, // PRESSURE_POINT
  [TechniqueId.HACKER_CYBER_OVERDRIVE]: AnimationType.RAPID_BARRAGE, // PRESSURE_POINT_RAPID
  [TechniqueId.HACKER_SYSTEM_CRASH]: AnimationType.NERVE_STRIKE, // PRESSURE_POINT → system
 
  // 정보요원 (Jeongbo) - Intelligence Operative
  [TechniqueId.JEONGBO_TACTICAL_STRIKE]: AnimationType.PRESSURE_POINT_STRIKE, // PRESSURE_POINT
  [TechniqueId.JEONGBO_COUNTER_INTELLIGENCE]: AnimationType.JAB, // PUNCH_MID → counter
  [TechniqueId.JEONGBO_PSYCHOLOGICAL_WARFARE]: AnimationType.NERVE_STRIKE, // PRESSURE_POINT
  [TechniqueId.JEONGBO_PRECISION_TAKEDOWN]: AnimationType.PRESSURE_POINT_STRIKE, // PRESSURE_POINT
  [TechniqueId.JEONGBO_INTELLIGENCE_STRIKE]: AnimationType.PRESSURE_POINT_STRIKE, // PRESSURE_POINT
 
  // 조직폭력배 (Jojik) - Organized Crime
  [TechniqueId.JOJIK_STREET_BRAWL]: AnimationType.HOOK, // PUNCH_MID → brawling
  [TechniqueId.JOJIK_IMPROVISED_WEAPON]: AnimationType.HAMMER_FIST, // ELBOW_STRIKE variant
  [TechniqueId.JOJIK_RUTHLESS_ASSAULT]: AnimationType.CROSS, // PUNCH_HIGH → brutal
  [TechniqueId.JOJIK_BRUTAL_TAKEDOWN]: AnimationType.ELBOW_STRIKE, // ELBOW_STRIKE → takedown
};
 
/**
 * Get AnimationType for a given technique ID
 *
 * Looks up the AnimationType from the TECHNIQUE_TO_ANIMATION_TYPE mapping.
 * Currently only supports archetype techniques (TechniqueId enum).
 * Returns undefined for unknown techniques or trigram techniques.
 *
 * @param techniqueId - The technique ID
 * @returns The AnimationType for movement physics, or undefined if not found
 * @korean 기술ID로애니메이션타입가져오기
 */
export function getAnimationTypeForTechnique(
  techniqueId: string | undefined
): AnimationType | undefined {
  if (!techniqueId) {
    return undefined;
  }
  
  // Check if techniqueId is in our mapping
  // Note: Only archetype techniques (TechniqueId enum) are currently mapped
  return TECHNIQUE_TO_ANIMATION_TYPE[techniqueId as TechniqueId];
}
 
/**
 * Get AnimationType from AttackAnimationType
 *
 * @param attackAnimationType - The attack animation type from technique definition
 * @returns The AnimationType for movement physics
 * @korean 공격애니메이션타입에서애니메이션타입가져오기
 */
export function getAnimationTypeFromAttackAnimation(
  attackAnimationType: AttackAnimationType
): AnimationType {
  return ATTACK_ANIMATION_TO_MOVEMENT_TYPE[attackAnimationType];
}
 
export default {
  TECHNIQUE_TO_ANIMATION_TYPE,
  ATTACK_ANIMATION_TO_MOVEMENT_TYPE,
  getAnimationTypeForTechnique,
  getAnimationTypeFromAttackAnimation,
};