Skip to content

Lua sections need revision: This page contains removed v5 APIs or old runtime examples. Do not use its Lua examples for current development. Start with Platform v1.

Combat & Damage Manual

This manual details the combat mechanics, multi-type damage calculations, armor coverage checks, and mitigation algorithms in Cataclysm: Cleanwater Bomb (CCB).


1. Damage Types System

Damage Type ID Name Physical Behavior & Characteristics
"bash" Blunt Impact Shockwave damage. Bypasses flexible fabrics to cause fractures and internal bleeding.
"cut" Edge Slicing Blocked by hard plates. Severe bleeding upon flesh penetration.
"pierce" Puncture Concentrated force that bypasses armor joints.
"bullet" Ballistic Kinetic impact from high-velocity projectiles. Mitigated by ballistic inserts.
"acid" Corrosive Chemical breakdown that degrades gear durability.
"electric" Conductive Causes muscle spasms, weapon drops, and stuns. Amplified by metals.
"heat" Thermal Ignites flammable gear and causes burn injuries.

2. Armor Resolution Pipeline

flowchart TD
    Attack[💥 Incoming Attack Damage & Type] --> RollCoverage{🎲 Roll against Armor Coverage %}
    RollCoverage -- Armor Hit --> ArmorAbsorption[🛡️ Armor Absorption: Mitigate Cut/Bash/Bullet]
    RollCoverage -- Missed Armor Joint --> RawFlesh[🩸 Strike Unprotected Flesh]
    ArmorAbsorption --> ResidualDamage[Compute Residual Damage]
    ResidualDamage --> BodyDamage[💥 Deduct Body Part HP & Apply Bleed/Fracture]
    RawFlesh --> BodyDamage
  1. Coverage Roll: Random roll $(1 \sim 100)$ against armor coverage percentage.
  2. Layer Stacking: Damage passes sequentially from outer tactical carriers to inner undergarments.
  3. Armor Wear: High-impact strikes wear down structural durability.

3. Intercepting Damage with Lua Hooks

game.hooks.on("on_damage_calculate", function(context)
    local defender = context.defender
    local damage_instance = context.damage

    if defender:has_effect("energy_barrier") then
        damage_instance:mult_damage("bullet", 0.5)
        damage_instance:mult_damage("cut", 0.5)
        game.add_msg("info", "The energy shield flashes, deflecting incoming kinetic energy!")
    end

    return true
end)