All files / types technique.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

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                                                                                                                                                                                                                                                                                                                                                                                                     
/**
 * Technique system type definitions for Korean martial arts combat.
 *
 * **Korean**: 기술 시스템 (Technique System)
 *
 * Defines combat techniques available to each player archetype, including
 * resource costs, damage outputs, cooldowns, and special effects.
 *
 * @module types/technique
 * @category Combat System
 * @korean 기술
 */
 
import { DamageType, KoreanText, TrigramStance } from "./common";
 
/**
 * Keyboard shortcut keys for technique selection.
 *
 * Mapped to top row keys (Q-P) for quick access during combat.
 * Supports up to 10 techniques with keyboard shortcuts.
 *
 * @public
 * @category Combat System
 */
export type TechniqueKey =
  | "Q"
  | "W"
  | "E"
  | "R"
  | "T"
  | "Y"
  | "U"
  | "I"
  | "O"
  | "P";
 
/**
 * Combat technique definition.
 *
 * **Korean**: 전투 기술 (Combat Technique)
 *
 * Represents a special combat move that can be executed by a player.
 * Each technique has resource costs, damage potential, cooldown periods,
 * and may apply special effects or require specific stances.
 *
 * @example
 * ```typescript
 * const thunderStrike: Technique = {
 *   id: "musa_thunder_strike",
 *   name: {
 *     korean: "천둥벽력",
 *     english: "Thunder Strike"
 *   },
 *   description: {
 *     korean: "강력한 하늘의 힘으로 적을 강타합니다",
 *     english: "Strike the enemy with the power of heaven"
 *   },
 *   staminaCost: 30,
 *   kiCost: 20,
 *   damage: { min: 25, max: 35 },
 *   damageType: DamageType.BLUNT,
 *   cooldown: 5000,
 *   requiredStance: TrigramStance.GEON,
 *   keyboardShortcut: "Q"
 * };
 * ```
 *
 * @public
 * @category Combat System
 * @korean 기술
 */
export interface Technique {
  /** Unique technique identifier */
  readonly id: string;
 
  /** Bilingual technique name */
  readonly name: KoreanText;
 
  /** Bilingual technique description */
  readonly description: KoreanText;
 
  /** Stamina cost to execute (0-100) */
  readonly staminaCost: number;
 
  /** Ki (氣) cost to execute (0-100) */
  readonly kiCost: number;
 
  /** Base damage range */
  readonly damage: {
    readonly min: number;
    readonly max: number;
  };
 
  /** Type of damage dealt */
  readonly damageType: DamageType;
 
  /** Cooldown duration in milliseconds */
  readonly cooldown: number;
 
  /** Required stance to execute (optional) */
  readonly requiredStance?: TrigramStance;
 
  /** Keyboard shortcut key */
  readonly keyboardShortcut: TechniqueKey;
 
  /** Whether technique targets vital points */
  readonly targetsVitalPoint?: boolean;
 
  /** Critical hit chance modifier (0.0-1.0) */
  readonly criticalChance?: number;
 
  /** Animation duration in milliseconds */
  readonly animationDuration?: number;
 
  /** Special effect type (stun, bleed, etc.) */
  readonly specialEffect?: string;
 
  /**
   * Icon identifier for UI display.
   * Can be an emoji character (e.g., "⚔️"), icon font class name, or icon identifier.
   * Defaults to "⚔️" if not specified in the UI.
   */
  readonly icon?: string;
}
 
/**
 * Technique cooldown state tracking.
 *
 * @public
 * @category Combat System
 */
export interface TechniqueCooldown {
  /** Technique ID */
  readonly techniqueId: string;
 
  /** Timestamp when cooldown started */
  readonly startTime: number;
 
  /** Cooldown duration in milliseconds */
  readonly duration: number;
 
  /** Remaining cooldown time in milliseconds */
  readonly remaining: number;
}
 
/**
 * Technique selection state for a player.
 *
 * Tracks available techniques, cooldowns, and current selection.
 *
 * @public
 * @category Combat System
 */
export interface TechniqueSelection {
  /** Available techniques for current archetype */
  readonly availableTechniques: readonly Technique[];
 
  /** Currently selected technique index */
  readonly selectedIndex: number;
 
  /** Active cooldowns */
  readonly activeCooldowns: readonly TechniqueCooldown[];
 
  /** Whether technique selection is locked (during execution) */
  readonly isLocked: boolean;
}
 
/**
 * Result of technique execution validation.
 *
 * @public
 * @category Combat System
 */
export interface TechniqueValidation {
  /** Whether technique can be executed */
  readonly canExecute: boolean;
 
  /** Reason for failure if cannot execute */
  readonly reason?: string;
 
  /** Insufficient stamina */
  readonly insufficientStamina?: boolean;
 
  /** Insufficient Ki */
  readonly insufficientKi?: boolean;
 
  /** Technique on cooldown */
  readonly onCooldown?: boolean;
 
  /** Wrong stance */
  readonly wrongStance?: boolean;
}
 
export default {};