data/damage_formulas/
A damage formula: how a hit’s base amount becomes the damage dealt, from the attacker’s and victim’s stats. The world’s default_formula (the gameplay config) applies unless a damage type names its own. Basic is armour and per-element resistance with an optional critical roll; Expression writes the attacker’s and the victim’s parts as numbers. The engine declares manifold:basic.
| Registry | manifold:damage-formula |
| Files | data/damage_formulas/*.ron, *.update.ron, *.final.ron |
| Sides | both: the server and every client load it, and the handshake’s data hash covers it |
| Reads | manifold:predicate |
| Contract | Gameplay framework, data stage |
Entry
A record, written DamageFormula(..); the name before the parentheses is optional.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | yes | The formula’s key, <mod-id>:<name>. | |
kind | FormulaKind | yes | The formula. |
Example
From game/flagship-game/data/damage_formulas/skyblock.ron:
DamageFormula(
id: "flagship-game:skyblock",
kind: Expression(
gather: "(5 + q.stat('attacker', 'flagship-game:weapon_damage'))
* (1 + q.stat('attacker', 'flagship-game:strength') / 100)
* (1 + q.stat('attacker', 'flagship-game:damage_additive') / 100)",
crit: Some((chance: "q.stat('attacker', 'flagship-game:crit_chance') / 100",
multiplier: "1 + q.stat('attacker', 'flagship-game:crit_damage') / 100")),
mitigate: "v.damage_amount * 100 / (100 + q.stat('this', 'flagship-game:armor'))",
),
)
Types
FormulaKind
A damage formula’s kind.
| Variant | Written | Description |
|---|---|---|
Basic | Basic(armor_stat: .., armor_constant: .., resist_cap: .., crit: ..) | The amount is the base, then a critical roll, then armour (k / (k + armor)) and each element’s resistance. |
Expression | Expression(gather: .., crit: .., mitigate: ..) | The formula as numbers in the damage context. |
Basic fields:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
armor_stat | string or None | no | no armour | The victim’s armour stat (manifold:stat key). |
armor_constant | f32 | no | 100 | The armour constant k. |
resist_cap | f32 | no | 0.75 | The largest fraction a resistance removes. |
crit | Crit or None | no | none | A critical roll. |
Expression fields:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
gather | number | yes | The attacker’s part, run once on the hit’s total, with v.damage_amount the base; the result is shared between the elements in proportion to their bases. | |
crit | Crit or None | no | none | A critical roll between the two parts. |
mitigate | number | yes | The victim’s part, run per element, with v.damage_amount the gathered amount. |
Crit
A critical roll: when a draw is below chance, the amount is multiplied by multiplier and the hit carries manifold:hit.critical.
A record: Crit(..) or (..).
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
chance | number | yes | The chance, 0 to 1. | |
multiplier | number | yes | The multiplier. |
Value forms used here: number.