All files / blacktrigram/src/systems/trigram types.ts

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

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 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474              1x   1x                                                                                                                                                                                                                                                                                                                                                           1x 1x 1x 1x 1x 1x 1x 1x 1x 1x   1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x                                                            
// filepath: /workspaces/blacktrigram/src/systems/trigram/types.ts
/**
 * Type definitions for trigram types
 * Auto-generated by type migration script
 */
 
// Trigram system imports from shared types
import { TrigramStance } from "../../types/common";
 
import {
  KOREAN_COLORS,
  type KoreanText,
  type PlayerArchetype,
} from "../../types";
import { EffectType } from "../effects";
import { PlayerState } from "../player";
import { KoreanTechnique } from "../vitalpoint";
 
export interface TrigramTransitionCost {
  readonly ki: number;
  readonly stamina: number;
  readonly timeMilliseconds: number;
}
 
export interface TrigramTransitionRule {
  readonly from: TrigramStance;
  readonly to: TrigramStance;
  readonly cost: TrigramTransitionCost;
  readonly effectiveness: number;
  readonly conditions?: ReadonlyArray<{
    type: "player_stat" | "archetype" | "active_effect";
    stat?: "health" | "ki" | "stamina";
    archetype?: PlayerArchetype;
    effectType?: EffectType;
    threshold?: number;
    value?: boolean | string;
  }>;
  readonly description: KoreanText;
}
 
export interface TransitionMetrics {
  readonly cost: TrigramTransitionCost;
  readonly effectiveness: number;
  readonly risk: number;
  readonly stamina: number;
  readonly timeMilliseconds: number;
}
 
export interface TransitionPath {
  readonly path: readonly TrigramStance[];
  readonly totalCost: TrigramTransitionCost;
  readonly effectiveness: number;
  readonly name: string;
  readonly description: KoreanText;
}
 
export interface TrigramTheme {
  readonly primary: number;
  readonly secondary: number;
  readonly active: number;
  readonly hover: number;
  readonly text: number;
}
 
export interface TrigramData {
  readonly id: TrigramStance;
  readonly korean: string;
  readonly english: string;
  readonly symbol: string;
  readonly element: string;
  readonly nature: "yin" | "yang";
  readonly philosophy: KoreanText;
  readonly combat: KoreanText;
  readonly theme: TrigramTheme;
  readonly name: KoreanText;
  readonly defensiveBonus: number;
  readonly kiFlowModifier: number;
  readonly techniques: {
    readonly primary: {
      readonly korean: string;
      readonly english: string;
      readonly damage: number;
      readonly kiCost: number;
      readonly staminaCost: number;
      readonly hitChance: number;
      readonly criticalChance: number;
      readonly description: KoreanText;
      readonly targetAreas: readonly string[];
      readonly effects: readonly string[];
    };
  };
}
 
export interface StanceTransition {
  readonly from: TrigramStance;
  readonly to: TrigramStance;
  readonly difficulty: number;
  readonly time: number;
  readonly kiCost: number;
  readonly requirements?: string[];
}
 
export interface TrigramPhilosophy {
  readonly trigram: TrigramStance;
  readonly principle: KoreanText;
  readonly application: KoreanText;
  readonly strengthsAgainst: readonly TrigramStance[];
  readonly weaknessesAgainst: readonly TrigramStance[];
}
 
export interface TrigramCombatStyle {
  readonly trigram: TrigramStance;
  readonly combatApproach: string;
  readonly preferredRange: "close" | "medium" | "long";
  readonly focusArea: "offense" | "defense" | "balance";
  readonly keyCharacteristics: readonly string[];
}
 
export interface TrigramSystemInterface {
  getTechniqueForStance: (
    stance: TrigramStance,
    archetype?: PlayerArchetype
  ) => KoreanTechnique | undefined;
  calculateStanceEffectiveness: (
    attackerStance: TrigramStance,
    defenderStance: TrigramStance,
    technique?: KoreanTechnique
  ) => number;
  isValidTransition: (from: TrigramStance, to: TrigramStance) => boolean;
  getTransitionCost: (
    from: TrigramStance,
    to: TrigramStance,
    player?: PlayerState
  ) => { ki: number; stamina: number; timeMs: number };
  recommendStance: (
    player: PlayerState,
    opponent?: PlayerState
  ) => TrigramStance;
}
 
export interface TrigramSystem {
  readonly getCurrentStance: (playerId: string) => TrigramStance;
  readonly changeStance: (playerId: string, stance: TrigramStance) => boolean;
  readonly getStanceEffectiveness: (
    attacker: TrigramStance,
    defender: TrigramStance
  ) => number;
}
 
// Ki flow factors with all required properties
export interface KiFlowFactors {
  readonly playerLevelModifier: number;
  readonly stanceAffinity: number;
  readonly distance: number; // Added missing property
  readonly elementalHarmony: number; // Added missing property
}
 
// Trigram effectiveness matrix
export interface TrigramEffectivenessMatrix {
  readonly [attacker: string]: {
    readonly [defender: string]: number;
  };
}
 
// Trigram stance transition
export interface TrigramTransition {
  readonly from: TrigramStance;
  readonly to: TrigramStance;
  readonly difficulty: number;
  readonly kiCost: number;
  readonly staminaCost: number;
  readonly transitionTime: number;
}
 
// Archetype-trigram affinity
export interface ArchetypeTrigramAffinity {
  readonly archetype: PlayerArchetype;
  readonly preferredTrigrams: readonly TrigramStance[];
  readonly bonusEffectiveness: Record<TrigramStance, number>;
  readonly penaltyTrigrams: readonly TrigramStance[];
}
 
// Order of Trigrams for UI elements like wheels or selection lists
export const TRIGRAM_STANCES_ORDER: readonly TrigramStance[] = [
  "geon" as TrigramStance,
  "tae" as TrigramStance,
  "li" as TrigramStance,
  "jin" as TrigramStance,
  "son" as TrigramStance,
  "gam" as TrigramStance,
  "gan" as TrigramStance,
  "gon" as TrigramStance,
] as const;
 
export const TRIGRAM_DATA: Record<TrigramStance, TrigramStanceData> = {
  [TrigramStance.GEON]: {
    name: { korean: "건", english: "Heaven" },
    symbol: "☰",
    element: "metal",
    nature: "yang",
    philosophy: { korean: "하늘", english: "Heaven" },
    combat: { korean: "직접 공격", english: "Direct attack" },
    theme: {
      primary: KOREAN_COLORS.TRIGRAM_GEON_PRIMARY,
      secondary: KOREAN_COLORS.WHITE_SOLID,
    },
    defensiveBonus: 1.0,
    kiFlowModifier: 1.0,
    techniques: {
      primary: {
        korean: "천둥벽력",
        english: "Thunder Strike",
        damage: 15,
        kiCost: 8,
        staminaCost: 12,
        hitChance: 0.85,
        criticalChance: 0.12,
        description: {
          korean: "하늘의 힘으로 적을 타격한다",
          english: "Strike the enemy with heavenly force",
        },
        targetAreas: ["torso", "head"],
        effects: ["stun"],
      },
    },
  },
  [TrigramStance.TAE]: {
    name: { korean: "태", english: "Lake" },
    symbol: "☱",
    element: "metal",
    nature: "yin",
    philosophy: { korean: "호수", english: "Lake" },
    combat: { korean: "유동적 적응", english: "Fluid adaptation" },
    theme: {
      primary: KOREAN_COLORS.TRIGRAM_TAE_PRIMARY,
      secondary: KOREAN_COLORS.UI_STEEL_GRAY,
    },
    defensiveBonus: 1.1,
    kiFlowModifier: 1.2,
    techniques: {
      primary: {
        korean: "유수연타",
        english: "Flowing Strikes",
        damage: 10,
        kiCost: 5,
        staminaCost: 8,
        hitChance: 0.9,
        criticalChance: 0.1,
        description: {
          korean: "물의 흐름처럼 연속적인 타격",
          english: "Continuous strikes like flowing water",
        },
        targetAreas: ["torso", "arms"],
        effects: ["knockback"],
      },
    },
  },
  [TrigramStance.LI]: {
    name: { korean: "리", english: "Fire" },
    symbol: "☲",
    element: "metal",
    nature: "yang",
    philosophy: { korean: "불", english: "Fire" },
    combat: { korean: "접근 공격", english: "Close attack" },
    theme: {
      primary: KOREAN_COLORS.TRIGRAM_LI_PRIMARY,
      secondary: KOREAN_COLORS.ACCENT_RED,
    },
    defensiveBonus: 0.9,
    kiFlowModifier: 1.1,
    techniques: {
      primary: {
        korean: "화염베기",
        english: "Flame Slash",
        damage: 18,
        kiCost: 9,
        staminaCost: 11,
        hitChance: 0.8,
        criticalChance: 0.15,
        description: {
          korean: "불의 형상을 한 날카로운 베기",
          english: "A sharp slash in the form of fire",
        },
        targetAreas: ["torso", "legs"],
        effects: ["burn"],
      },
    },
  },
  [TrigramStance.JIN]: {
    name: { korean: "진", english: "Thunder" },
    symbol: "☳",
    element: "metal",
    nature: "yang",
    philosophy: { korean: "천둥", english: "Thunder" },
    combat: { korean: "돌진 공격", english: "Charge attack" },
    theme: {
      primary: KOREAN_COLORS.TRIGRAM_JIN_PRIMARY,
      secondary: KOREAN_COLORS.SECONDARY_YELLOW,
    },
    defensiveBonus: 0.8,
    kiFlowModifier: 1.3,
    techniques: {
      primary: {
        korean: "천둥의 박치기",
        english: "Thunder Clap",
        damage: 20,
        kiCost: 10,
        staminaCost: 15,
        hitChance: 0.82,
        criticalChance: 0.18,
        description: {
          korean: "천둥의 힘으로 적을 가격",
          english: "Strike the enemy with the force of thunder",
        },
        targetAreas: ["head", "torso"],
        effects: ["stun", "knockback"],
      },
    },
  },
  [TrigramStance.SON]: {
    name: { korean: "손", english: "Wind" },
    symbol: "☴",
    element: "metal",
    nature: "yin",
    philosophy: { korean: "바람", english: "Wind" },
    combat: { korean: "회피 공격", english: "Evasive attack" },
    theme: {
      primary: KOREAN_COLORS.TRIGRAM_SON_PRIMARY,
      secondary: KOREAN_COLORS.POSITIVE_GREEN_DARK,
    },
    defensiveBonus: 1.2,
    kiFlowModifier: 0.9,
    techniques: {
      primary: {
        korean: "바람베기",
        english: "Wind Cut",
        damage: 12,
        kiCost: 6,
        staminaCost: 10,
        hitChance: 0.88,
        criticalChance: 0.14,
        description: {
          korean: "바람의 힘으로 적을 베어내다",
          english: "Cut through the enemy with the power of wind",
        },
        targetAreas: ["torso", "arms"],
        effects: ["bleed"],
      },
    },
  },
  [TrigramStance.GAM]: {
    name: { korean: "감", english: "Water" },
    symbol: "☵",
    element: "metal",
    nature: "yin",
    philosophy: { korean: "물", english: "Water" },
    combat: { korean: "유동 공격", english: "Flowing attack" },
    theme: {
      primary: KOREAN_COLORS.TRIGRAM_GAM_PRIMARY,
      secondary: KOREAN_COLORS.PRIMARY_BLUE_DARK,
    },
    defensiveBonus: 1.3,
    kiFlowModifier: 1.1,
    techniques: {
      primary: {
        korean: "수륙재해",
        english: "Water Whip",
        damage: 14,
        kiCost: 7,
        staminaCost: 9,
        hitChance: 0.84,
        criticalChance: 0.13,
        description: {
          korean: "물의 힘으로 적을 휘감아 타격",
          english: "Strike the enemy by wrapping them with the power of water",
        },
        targetAreas: ["torso", "legs"],
        effects: ["drown"],
      },
    },
  },
  [TrigramStance.GAN]: {
    name: { korean: "간", english: "Mountain" },
    symbol: "☶",
    element: "metal",
    nature: "yin",
    philosophy: { korean: "산", english: "Mountain" },
    combat: { korean: "방어 자세", english: "Defensive stance" },
    theme: {
      primary: KOREAN_COLORS.TRIGRAM_GAN_PRIMARY,
      secondary: KOREAN_COLORS.UI_STEEL_GRAY_DARK,
    },
    defensiveBonus: 1.4,
    kiFlowModifier: 0.8,
    techniques: {
      primary: {
        korean: "산의 수호",
        english: "Mountain Guard",
        damage: 0,
        kiCost: 10,
        staminaCost: 15,
        hitChance: 1.0,
        criticalChance: 0.0,
        description: {
          korean: "산처럼 견고한 방어 자세",
          english: "A defensive stance as solid as a mountain",
        },
        targetAreas: ["torso"],
        effects: ["block"],
      },
    },
  },
  [TrigramStance.GON]: {
    name: { korean: "곤", english: "Earth" },
    symbol: "☷",
    element: "metal",
    nature: "yang",
    philosophy: { korean: "지구", english: "Earth" },
    combat: { korean: "포용 공격", english: "Embracing attack" },
    theme: {
      primary: KOREAN_COLORS.TRIGRAM_GON_PRIMARY,
      secondary: KOREAN_COLORS.SECONDARY_BROWN_DARK,
    },
    defensiveBonus: 1.1,
    kiFlowModifier: 1.2,
    techniques: {
      primary: {
        korean: "지구의 방패",
        english: "Earth Shield",
        damage: 0,
        kiCost: 12,
        staminaCost: 16,
        hitChance: 1.0,
        criticalChance: 0.0,
        description: {
          korean: "지구의 힘으로 적의 공격을 막다",
          english: "Block the enemy's attack with the power of earth",
        },
        targetAreas: ["torso"],
        effects: ["block"],
      },
    },
  },
} as const;
 
export interface TrigramStanceData {
  readonly name: { korean: string; english: string };
  readonly symbol: string;
  readonly element: string;
  readonly nature: "yin" | "yang";
  readonly philosophy: { korean: string; english: string };
  readonly combat: { korean: string; english: string };
  readonly theme: {
    primary: number;
    secondary: number;
  };
  readonly defensiveBonus: number;
  readonly kiFlowModifier: number;
  readonly techniques: {
    primary: {
      korean: string;
      english: string;
      damage: number;
      kiCost: number;
      staminaCost: number;
      hitChance: number;
      criticalChance: number;
      description: { korean: string; english: string };
      targetAreas: string[];
      effects: string[];
    };
  };
}