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 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | 22x 22x 22x 22x 22x 22x 22x 22x 22x 22x 22x | /**
* Body Part Health System Types
*
* **Korean**: 신체부위 체력 시스템 타입
*
* This module defines types for the body part-specific health tracking system,
* which replaces the single health bar with independent health tracking for
* each major body region. This enables realistic localized damage and combat
* trauma simulation.
*
* ## Body Part Health Philosophy
*
* Traditional Korean martial arts emphasize targeting specific body regions
* to achieve maximum combat effectiveness. This system reflects that by
* tracking damage to:
* - **HEAD** (두부): Consciousness and awareness
* - **NECK** (경부): Vascular and respiratory function
* - **TORSO_UPPER** (상부 몸통): Heart, lungs, vital organs
* - **TORSO_LOWER** (하부 몸통): Stamina and core strength
* - **ARM_LEFT/RIGHT** (좌/우팔): Attack capability
* - **LEG_LEFT/RIGHT** (좌/우다리): Mobility and balance
*
* @module systems/bodypart/types
* @category Body Part System
* @korean 신체부위타입
*/
import { KoreanText } from "@/types";
/**
* Body part identifiers for health tracking.
*
* **Korean**: 신체 부위 (Body Parts)
*
* Each body part tracks independent health from 0-100 HP. Damage to specific
* parts affects different combat capabilities based on anatomical function.
*
* @example
* ```typescript
* const bodyPart: BodyPart = BodyPart.HEAD;
* const health = player.bodyPartHealth[bodyPart]; // 0-100
* ```
*
* @public
* @category Body Part System
* @korean 신체부위
*/
export enum BodyPart {
/** Head region - affects consciousness and awareness */
HEAD = "head",
/** Neck region - affects breathing and blood flow */
NECK = "neck",
/** Upper torso - affects heart, lungs, stamina recovery */
TORSO_UPPER = "torsoUpper",
/** Lower torso - affects core strength and balance */
TORSO_LOWER = "torsoLower",
/** Left arm - affects attack capability on left side */
ARM_LEFT = "armLeft",
/** Right arm - affects attack capability on right side */
ARM_RIGHT = "armRight",
/** Left leg - affects movement and balance */
LEG_LEFT = "legLeft",
/** Right leg - affects movement and balance */
LEG_RIGHT = "legRight",
}
/**
* Health values for each body part (0-100 HP per part).
*
* **Korean**: 신체 부위별 체력
*
* Tracks independent health pools for each major body region. When a body part
* reaches 0 HP, it becomes non-functional and applies severe combat penalties.
*
* ## Default Health Values
*
* All body parts start at 100 HP. Different archetypes may have variations:
* - **무사 (Musa)**: Balanced health across all parts
* - **암살자 (Amsalja)**: Lower torso health, higher arm precision
* - **해커 (Hacker)**: Enhanced head/neck (cyber augmentation)
* - **정보요원 (Jeongbo)**: Balanced with slight defensive boost
* - **조직폭력배 (Jojik)**: Higher torso/leg health (street hardened)
*
* @example
* ```typescript
* const bodyHealth: BodyPartHealth = {
* head: 100,
* neck: 100,
* torsoUpper: 100,
* torsoLower: 100,
* armLeft: 100,
* armRight: 100,
* legLeft: 100,
* legRight: 100,
* };
* ```
*
* @public
* @category Body Part System
* @korean 신체부위체력
*/
export interface BodyPartHealth {
/** Head health (0-100 HP) - affects consciousness */
readonly head: number;
/** Neck health (0-100 HP) - affects breathing and circulation */
readonly neck: number;
/** Upper torso health (0-100 HP) - affects stamina recovery */
readonly torsoUpper: number;
/** Lower torso health (0-100 HP) - affects balance and core strength */
readonly torsoLower: number;
/** Left arm health (0-100 HP) - affects left-side attacks */
readonly armLeft: number;
/** Right arm health (0-100 HP) - affects right-side attacks */
readonly armRight: number;
/** Left leg health (0-100 HP) - affects movement and stance */
readonly legLeft: number;
/** Right leg health (0-100 HP) - affects movement and stance */
readonly legRight: number;
}
/**
* Maximum health values for each body part.
*
* **Korean**: 최대 신체 부위 체력
*
* Defines the maximum HP capacity for each body part. Can be modified by
* archetype, equipment, or training bonuses.
*
* @public
* @category Body Part System
* @korean 최대신체부위체력
*/
export interface BodyPartMaxHealth {
/** Maximum head health */
readonly head: number;
/** Maximum neck health */
readonly neck: number;
/** Maximum upper torso health */
readonly torsoUpper: number;
/** Maximum lower torso health */
readonly torsoLower: number;
/** Maximum left arm health */
readonly armLeft: number;
/** Maximum right arm health */
readonly armRight: number;
/** Maximum left leg health */
readonly legLeft: number;
/** Maximum right leg health */
readonly legRight: number;
}
/**
* Combat capability effects from body part damage.
*
* **Korean**: 신체 부위 손상 효과
*
* Defines how damage to specific body parts affects combat performance.
* Effects are applied as multipliers to base stats (0.0 = disabled, 1.0 = normal).
*
* ## Effect Thresholds
*
* - **100-75% HP**: No penalties (1.0x)
* - **75-50% HP**: Minor penalties (0.9-0.8x)
* - **50-25% HP**: Major penalties (0.7-0.5x)
* - **25-0% HP**: Severe penalties (0.3-0.1x)
* - **0% HP**: Non-functional (0.0x)
*
* @example
* ```typescript
* const effects: BodyPartEffects = {
* consciousnessModifier: 0.75, // Head at 50% HP
* staminaRegenModifier: 0.5, // Torso damaged
* attackDamageModifier: 0.7, // Arm injured
* movementSpeedModifier: 0.6, // Leg damaged
* };
* ```
*
* @public
* @category Body Part System
* @korean 신체부위효과
*/
export interface BodyPartEffects {
/** Consciousness and awareness multiplier (0.0-1.0) - from head/neck damage */
readonly consciousnessModifier: number;
/** Stamina regeneration multiplier (0.0-1.0) - from torso damage */
readonly staminaRegenModifier: number;
/** Attack damage multiplier (0.0-1.0) - from arm damage */
readonly attackDamageModifier: number;
/** Movement speed multiplier (0.0-1.0) - from leg damage */
readonly movementSpeedModifier: number;
/** Balance modifier (0.0-1.0) - from lower torso and leg damage */
readonly balanceModifier: number;
/** Technique accuracy multiplier (0.0-1.0) - from head/arm damage */
readonly techniqueAccuracyModifier: number;
}
/**
* Damage distribution configuration for body parts.
*
* **Korean**: 신체 부위 피해 분배
*
* Defines how damage from attacks is distributed across body parts based on
* the hit location and attack type. Not all damage goes to a single part;
* impact can affect adjacent regions.
*
* @example
* ```typescript
* // Strike to head distributes damage
* const distribution: BodyPartDamageDistribution = {
* primary: { part: BodyPart.HEAD, percentage: 0.8 },
* secondary: [
* { part: BodyPart.NECK, percentage: 0.2 }
* ]
* };
* ```
*
* @public
* @category Body Part System
* @korean 신체부위피해분배
*/
export interface BodyPartDamageDistribution {
/** Primary body part receiving most damage */
readonly primary: {
readonly part: BodyPart;
readonly percentage: number; // 0.0-1.0
};
/** Secondary body parts receiving splash damage */
readonly secondary: readonly {
readonly part: BodyPart;
readonly percentage: number; // 0.0-1.0
}[];
}
/**
* Body part status information for UI display.
*
* **Korean**: 신체 부위 상태 정보
*
* Provides UI-friendly data about body part health status including
* color coding, status text, and icon information.
*
* @public
* @category Body Part System
* @korean 신체부위상태
*/
export interface BodyPartStatus {
/** Body part identifier */
readonly part: BodyPart;
/** Current health (0-100) */
readonly health: number;
/** Maximum health */
readonly maxHealth: number;
/** Health percentage (0.0-1.0) */
readonly percentage: number;
/** Status description */
readonly status: KoreanText;
/** Color code for UI (hex number) */
readonly color: number;
/** Whether this part is critically damaged */
readonly critical: boolean;
/** Whether this part is non-functional */
readonly disabled: boolean;
}
/**
* Configuration for body part health system.
*
* **Korean**: 신체 부위 시스템 설정
*
* Defines thresholds, multipliers, and constants used by the body part
* health system for damage calculation and effect application.
*
* @public
* @category Body Part System
* @korean 신체부위설정
*/
export interface BodyPartHealthConfig {
/** Default max health for all body parts */
readonly defaultMaxHealth: number;
/** Health threshold for minor penalties (percentage) */
readonly minorPenaltyThreshold: number;
/** Health threshold for major penalties (percentage) */
readonly majorPenaltyThreshold: number;
/** Health threshold for severe penalties (percentage) */
readonly severePenaltyThreshold: number;
/** Health threshold for critical status (percentage) */
readonly criticalThreshold: number;
/** Effect multipliers for each threshold tier */
readonly effectMultipliers: {
readonly minor: number;
readonly major: number;
readonly severe: number;
readonly critical: number;
};
}
/**
* Default configuration values for body part health system.
*
* @public
* @category Body Part System
*/
export const DEFAULT_BODY_PART_CONFIG: BodyPartHealthConfig = {
defaultMaxHealth: 100,
minorPenaltyThreshold: 0.75, // 75% HP
majorPenaltyThreshold: 0.50, // 50% HP
severePenaltyThreshold: 0.25, // 25% HP
criticalThreshold: 0.10, // 10% HP
effectMultipliers: {
minor: 0.90, // 10% penalty
major: 0.70, // 30% penalty
severe: 0.40, // 60% penalty
critical: 0.10, // 90% penalty
},
} as const;
/**
* Body part health effect constants matching acceptance criteria.
*
* **Korean**: 신체 부위 효과 상수
*
* Defines specific combat penalties as per requirements:
* - Head <50%: Consciousness penalties
* - Torso <50%: Stamina regen -50%
* - Arms <50%: Attack damage -30%
* - Legs <50%: Movement speed -40%
*
* @public
* @category Body Part System
*/
export const BODY_PART_EFFECT_CONSTANTS = {
/** Head damage effects */
HEAD: {
CONSCIOUSNESS_PENALTY_AT_50: 0.75, // 25% consciousness reduction
CRITICAL_THRESHOLD: 0.50,
},
/** Torso damage effects */
TORSO: {
STAMINA_REGEN_PENALTY_AT_50: 0.50, // 50% stamina regen reduction
CRITICAL_THRESHOLD: 0.50,
},
/** Arm damage effects */
ARMS: {
ATTACK_DAMAGE_PENALTY_AT_50: 0.70, // 30% attack damage reduction
CRITICAL_THRESHOLD: 0.50,
},
/** Leg damage effects */
LEGS: {
MOVEMENT_SPEED_PENALTY_AT_50: 0.60, // 40% movement speed reduction
CRITICAL_THRESHOLD: 0.50,
},
} as const;
|