combat-mechanics

Documents deterministic combat resolution formulas and CombatPosture assessment logic in the RPG engine.

Updated Feb 8, 2026
One-click install
npx skills add https://github.com/ttnhan18062000/rpg-based-simulation --skill combat-mechanics-ttnhan18062000
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: combat-mechanics
Source: https://github.com/ttnhan18062000/rpg-based-simulation/tree/main/.agents/skills/combat-mechanics
Command: npx skills add https://github.com/ttnhan18062000/rpg-based-simulation --skill combat-mechanics-ttnhan18062000

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working on combat code in this repository requires knowing the exact damage formula, tactical modifier values, and the boundary between pre-combat assessment and authoritative resolution. This Skill consolidates those laws so changes to src/domains/combat_engagement/ stay consistent with the Mechanics Bible and the authoritative pipeline. ## Core Features & Use Cases - Deterministic Damage Formula: Fractional Armor Mitigation (Atk * (Atk / (Atk + Def * 2.0 + 1.0))) with a minimum damage of 1, plus exact tactical modifier values for High Ground, Flanking, Cover, Shatter, and more. - CombatPosture Pipeline: Explains the 10 posture values and the 4 stateless sub-services (OpponentPerceptionService, SelfCombatEstimateService, EngagementRiskEvaluator, CombatPostureSelector) orchestrated by CombatEngagementDecisionService. - Pipeline Phase Mapping: Maps combat logic to phases 12, 13, 15, and 31 of the 39-phase AuthoritativeApplyPipeline, including the Sliding State rule for same-tick kill ordering. - Use Case: When debugging why an actor did not receive a kill reward, use this Skill to learn that actors processed later in the same tick see the target as already dead — intentional order-dependent behavior, not a bug. ## Quick Start Explain how the deterministic damage formula and tactical modifiers work in this repo's combat system.

Frequently Asked Questions about combat-mechanics

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How does the deterministic damage formula work in this RPG engine?

Damage uses Fractional Armor Mitigation: Damage = Atk * (Atk / (Atk + Def * 2.0 + 1.0)), cast to int after calculation. Every successful hit deals a minimum of 1 damage regardless of Defense, and tactical modifiers are applied to base Atk/Def before the calculation.

What is the difference between CombatPosture assessment and combat resolution?

CombatEngagementDecisionService only decides whether and how an actor wants to engage, returning a CombatEngagementDecisionResult without mutating state. Actual damage and outcomes are resolved later by the authoritative pipeline, so the assessment layer never applies effects directly.

Why did an actor not receive a kill reward for a target it attacked?

This is the Sliding State rule on the action_routing phase: if another actor killed the target earlier in the same tick's queue, later actors see it as already dead and cannot receive kill credit. This order-dependent behavior is intentional, not a bug.

What tactical modifiers affect attack and defense values?

Modifiers include High Ground (+0.20 Atk), Flanking (+0.15 Atk), Surrounded (+0.25 Atk), Cover (+0.30 Def), Shatter (x1.50 Atk vs Frozen targets), Exhaustion (x0.80 Atk when Sleep Debt > 80), and Bond Synergy (+0.10 Atk with adjacent familiar allies).

How does the Hero's Journey rebirth and permadeath system work?

Heroes of Generation 1-3 are reborn on defeat with their Generation incremented. Generation 4 heroes suffer permadeath and are permanently removed. Kill rewards differ by target type: monsters give LVL*10 XP and LVL*5 gold, heroes give LVL*20 XP and LVL*50 gold.

What are the domain isolation constraints for combat_engagement code?

The combat_engagement domain must not import from other domain packages and must not call the Kernel or other pipeline phases directly. All sub-services are stateless and deterministic, and learning outputs are passed to the pipeline for application rather than applied directly.