Black Trigram (흑괘) - Korean Martial Arts Combat Simulator API - v0.5.30
    Preparing search index...

    Class CombatStateSystem

    Combat State System managing readiness state transitions.

    Evaluates player condition and determines current combat readiness state. States degrade based on:

    • Cumulative damage (health loss)
    • Pain overload
    • Consciousness reduction
    • Balance disruption
    const combatStateSystem = new CombatStateSystem();

    // Determine current state
    const state = combatStateSystem.determineState(player);

    // Get capability modifiers
    const capability = combatStateSystem.getCapability(state);
    console.log(`Capability: ${capability.capability}%`);

    // Apply modifiers to damage calculation
    const modifiedDamage = baseDamage * capability.accuracyModifier;

    전투상태시스템

    Index

    Constructors

    Methods

    • Applies combat state modifiers to a player state.

      Creates a modified player state with capability reductions based on current combat readiness.

      Parameters

      Returns PlayerState

      Modified player state with applied modifiers

      const state = combatStateSystem.determineState(player);
      const modifiedPlayer = combatStateSystem.applyStateModifiers(
      player,
      state
      );

      상태적용

    • Checks if player can recover from HELPLESS state.

      Recovery occurs after 5 seconds with no additional hits.

      Parameters

      • player: PlayerState

        Current player state

      • currentTime: number

        Current timestamp

      Returns boolean

      True if recovery is possible

      회복가능확인

    • Private

      Checks if any body part has lost more than the specified percentage of health.

      Parameters

      • player: PlayerState

        Current player state

      • lossThreshold: number

        Health loss threshold (0.0 to 1.0)

      Returns boolean

      True if any body part has lost more than the threshold

      신체부위손상확인

    • Private

      Counts recent hits within a time window.

      Parameters

      • player: PlayerState

        Current player state

      • currentTime: number | undefined

        Current timestamp (milliseconds)

      • timeWindow: number

        Time window to check in milliseconds

      Returns number

      Number of hits within the time window

      최근타격횟수

    • Determines the current combat readiness state based on player condition.

      Evaluates health, pain, consciousness, balance, and recent hits to determine the most appropriate combat state. State transitions follow acceptance criteria:

      • READY → SHAKEN: After taking 2-3 hits or significant vital point strike
      • SHAKEN → VULNERABLE: After additional 2 hits or loss of 30% body part health
      • VULNERABLE → HELPLESS: After head trauma, pain >80, or knock-down
      • Recovery: HELPLESS → READY over 5 seconds if no additional hits

      Parameters

      • player: PlayerState

        Current player state

      • OptionalcurrentTime: number

        Current timestamp in milliseconds

      Returns CombatReadinessState

      Current combat readiness state

      const state = combatStateSystem.determineState(player, Date.now());
      if (state === CombatReadinessState.HELPLESS) {
      console.log("Player is near incapacitation!");
      }

      상태결정

    • Gets the capability modifiers for a specific combat state.

      Returns all modifiers that should be applied to player actions based on their current combat readiness.

      Parameters

      Returns StateCapability

      Capability modifiers for the state

      const capability = combatStateSystem.getCapability(
      CombatReadinessState.SHAKEN
      );

      // Apply to damage calculation
      const finalDamage = baseDamage * capability.accuracyModifier;

      // Check if can block
      if (!capability.canBlock) {
      console.log("Cannot block in this state!");
      }

      능력조회

    • Records a hit on the player and updates recent hit tracking.

      Should be called by combat system when player takes a hit. Maintains a rolling window of the last 10 hit timestamps.

      Parameters

      • player: PlayerState

        Current player state

      • currentTime: number

        Timestamp of the hit

      Returns PlayerState

      Updated player state with recorded hit

      타격기록

    Properties

    stateCapabilities: Record<CombatReadinessState, StateCapability> = ...

    State capability definitions with modifiers per state.

    Based on acceptance criteria:

    • READY: 100% capability (baseline)
    • SHAKEN: -15% accuracy, -10% damage
    • VULNERABLE: -30% accuracy, -25% damage, +50% damage taken
    • HELPLESS: Cannot attack, cannot block, +100% damage taken