PrivateanalyzeAnalyze counter-attack opportunity from opponent's limb exposure.
Korean: 반격 기회 분석 (Counter Opportunity Analysis)
Detects when the opponent has exposed limbs during technique execution, enabling defensive counter-attacks and breaking techniques.
This integrates the LimbExposureSystem with AI decision-making by:
Combat context with opponent technique data
Enhanced context with counter opportunity analysis, or undefined if no opportunity
PrivateapplyApply Intelligence Operative (Jeongbo Yowon) vulnerability exploitation
Enhances decision weights to exploit opponent's defenseless states with precision:
Multiplier Stacking Behavior: When multiple vulnerabilities are present, multipliers stack multiplicatively:
Jeongbo Philosophy (정보요원 전략):
This function provides 3x higher vulnerability exploitation rate than Musa, 2x higher psychological warfare usage than Amsalja, and 5x higher takedown success rate when opponent is HELPLESS.
Base action weight multipliers
Vulnerability assessment context
AI personality archetype
Modified action weights for Jeongbo exploitation
PrivateapplyApply kill mode modifiers to action weights for finishing behavior
Kill Mode Behavior (결정타 행동): Each archetype has unique finishing behavior based on combat philosophy:
Base action weight multipliers
AI personality archetype
Whether kill mode is active
Modified action weights for kill mode
PrivatebuildBuild psychological pressure through intimidation tactics
Intelligence Operative uses feints, circling, and approach/retreat patterns to build cumulative psychological pressure on opponent. When pressure reaches 50+ and opponent is VULNERABLE, triggers decisive strike.
Psychological Tactics (심리전 전술):
Type of action taken (FEINT, CIRCLE, APPROACH, etc.)
Current timestamp for decay calculation
PrivatecalculateCalculate approach position
Physics-First: All calculations in METERS.
PrivatecalculateCalculate circle position
Physics-First: All calculations in METERS.
PrivatecalculateCalculate direct approach position (straight line to opponent) Used primarily by Musa archetype for charging attacks
Kill Mode Enhancement (결정타 돌격):
Physics-First: All calculations in METERS.
Combat context
Whether kill mode is active
PrivatecalculateCalculate flanking approach position (diagonal/side approach) Used primarily by Amsalja archetype for stealth positioning
Kill Mode Enhancement (결정타 측면 공격):
Physics-First: All calculations in METERS.
Combat context
Whether kill mode is active
PrivatecalculateCalculate retreat position
Physics-First: All calculations in METERS.
PrivateclampClamp position to arena boundaries with proper margins Centralizes boundary validation logic for all movement calculations
Physics-First: Works entirely in METERS using worldWidthMeters/worldDepthMeters. Arena is centered at origin (0,0), so bounds are -halfWidth to +halfWidth.
Position to clamp (in meters)
Combat context with arena dimensions in meters
PrivatedecidePrivateevaluateEvaluate approach tactics with archetype-specific behavior
Korean Philosophy (접근 전략):
Kill Mode Enhancement (결정타 접근): All archetypes enhance movement speed in kill mode based on combat philosophy:
Combat context
AI personality
Whether kill mode is active
PrivateevaluateEvaluate close range tactics with vital point targeting
Korean Philosophy (급소 공격): At close range, AI targets specific vital points based on difficulty level. Higher difficulty = more precise targeting of critical points.
Kill Mode Enhancement (결정타): When kill mode is active, AI prioritizes finishing techniques with boosted priority.
Combat context
AI personality
Whether kill mode is active (opponent <30% health or vulnerable)
PrivateevaluateEvaluate combo initiation (fix for issue #2529467014)
PrivateevaluateEvaluate counter-attack opportunity
Kill Mode Enhancement (결정타 반격): All archetypes enhance counter behavior during kill mode based on philosophy:
Combat context
AI personality
Whether kill mode is active
PrivateevaluateEvaluate defensive tactics
PrivateevaluatePrivateevaluateEvaluate counter-attack opportunity from limb exposure.
Korean: 사지 노출 반격 평가 (Limb Exposure Counter Evaluation)
Analyzes opportunities to exploit opponent's exposed limbs during technique execution. This is higher priority than standard counters because it targets specific anatomical vulnerabilities.
Defensive Archetype Priority: Defensive archetypes (high defensiveness) strongly favor counter-attacks:
Breaking Techniques: When allowsBreaking is true, AI can execute joint locks and limb breaks for severe damage and mobility reduction.
Combat context with positioning
AI personality with archetype and defensiveness
Detected limb exposure opportunity
Opponent's vulnerability multiplier
Counter-attack decision with priority based on archetype
PrivateevaluateEvaluate mid-range tactics with distance awareness
Korean Philosophy (중거리 전술):
PrivateevaluateEvaluate stance change using TrigramSystem and distance-based selection
Korean Philosophy (자세 전환): Uses I Ching-based trigram system to find optimal stance transitions. Considers resource costs, counter-stance effectiveness, archetype preferences, and distance-based tactical positioning.
Dynamic Stance Rotation (Issue #dynamic-ai-stance-rotation):
PrivateevaluateEvaluate survival tactics when critically low health
Korean Philosophy (생존 전략):
PrivategetGet close range threshold for an archetype (punching/elbow distance). Based on arm length from physical attributes.
Uses the shared punch reach calculation helper for consistency.
TODO: Extract to shared utility function with PhysicalReachCalculator.ts to maintain consistency between AI range calculations and actual hit detection. Consider handling elbow techniques separately with different body pivot values.
Player archetype
Close range threshold in meters
PrivategetCalculate maximum combat reach for an archetype based on physical attributes.
Physics-First: Returns reach in METERS based on leg length. Kicks have the longest reach (~1.0-1.3m with body pivot contribution).
Note: This is a heuristic approximation. Actual reach also depends on stance modifiers and animation timing not included in AI range calculations.
Player archetype to calculate reach for
Maximum combat reach in meters
PrivategetGet medium range threshold for an archetype (kicking distance). Based on leg length from physical attributes.
Includes realistic kick reach calculation:
Player archetype
Medium range threshold in meters
PrivategetGet archetype-specific movement bias multipliers
Applies movement pattern modifiers based on archetype behavior profiles:
PrivategetCalculate kick reach for an archetype based on physical attributes.
Physics-First: Returns reach in METERS based on leg length. Includes realistic kick reach calculation:
Formula: (legLength/100 + BODY_PIVOT_METERS.KICK) × TECHNIQUE_EXTENSION.KICK
Player archetype to calculate reach for
Kick reach in meters
PrivategetGet optimal combat range based on AI personality archetype
Uses archetype behavior profiles to determine preferred combat distance. Physics-First: Returns distance in METERS directly.
AI personality with archetype behavior
Optional_context: CombatContextCombat context (unused, kept for API compatibility)
Optimal range in meters
PrivategetCalculate punch reach for an archetype based on physical attributes.
Physics-First: Returns reach in METERS based on arm length. Includes realistic punch reach calculation:
Formula: (armLength/100 + shoulderOffset + torsoRotation) × TECHNIQUE_EXTENSION.PUNCH
Player archetype to calculate reach for
Punch reach in meters
PrivategetCalculate stance fatigue modifier for increased switching probability
Applies time-based modifiers to encourage dynamic stance rotation:
This ensures AI doesn't stay locked in one stance for extended periods, promoting the use of all 8 trigram stances throughout combat.
Korean Philosophy (자세 피로도): Remaining in one stance too long reduces tactical flexibility and makes the fighter predictable. The Eight Trigram system requires constant adaptation and flow between stances.
Time in current stance in milliseconds
Stance switch frequency multiplier (1.0 = no change, >1.0 = increased probability)
PrivateisCheck if kill mode should be activated based on archetype behavior
Kill mode activates when:
Korean Philosophy (결정타 모드): Each archetype activates kill mode differently based on combat philosophy:
Current combat context
AI personality archetype
True if kill mode should be active
Make strategic decision based on combat context
Applies difficulty-based reaction time delays if difficulty parameters are set
Reset decision state
PrivateselectSelect stance based on distance to opponent
Chooses optimal stance for current combat range, prioritizing:
Distance Categories:
Distance to opponent in meters
Archetype's preferred stances
Current stance (to avoid redundant switches)
Optimal stance for distance, or undefined if no valid options
PrivateselectSelect vital point to target based on difficulty and stance
Korean Philosophy (급소 선택):
Set AI difficulty level for vital point targeting accuracy
0.0 (beginner) to 1.0 (master)
Set difficulty parameters for AI behavior Affects reaction time, accuracy, decision quality, etc.
Calculates a randomized reaction delay (within parameter range) once when parameters change. This provides varied AI timing while maintaining consistent behavior throughout the current parameter set.
Difficulty parameters to apply
PrivateshouldCheck if psychological pressure should trigger decisive strike
Jeongbo executes decisive technique when:
Vulnerability assessment context
True if pressure warrants decisive strike
PrivatetranslateTranslate exposed limb type to Korean.
Korean: 노출 사지 번역 (Exposed Limb Translation)
English limb type identifier
Korean translation
PrivateconsecutivePrivatecurrentPrivatedecisionPrivatedifficultyPrivate OptionaldifficultyPrivatelastPrivatelastPrivatelastPrivatepsychologicalPrivate ReadonlystancePrivatetrigramPrivate Static ReadonlyFATIGUE_Scaling factor for fatigue override probability calculation. Used to convert fatigue modifier to override chance in non-linear manner. Value of 0.5 provides gradual scaling: 1.2x fatigue → ~10% override, 1.5x → ~25%.
AI Decision Tree System
Korean Combat Philosophy (한국 무술 철학): This system embodies traditional Korean martial arts principles: