Sources:
data/lua/README.md
data/lua/manifest.schema.json
data/lua/types/ccb_api_v5.d.lua
data/lua/reference/ccb_public_api_v5.json
data/lua/reference/ccb_public_api_v5_coverage.json
tools/lua_api/README.md
commit d32b9cc880a8
api-contract
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
- Coverage Roll: Random roll $(1 \sim 100)$ against armor
coveragepercentage. - Layer Stacking: Damage passes sequentially from outer tactical carriers to inner undergarments.
- 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)