Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

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.

Registrymanifold:damage-formula
Filesdata/damage_formulas/*.ron, *.update.ron, *.final.ron
Sidesboth: the server and every client load it, and the handshake’s data hash covers it
Readsmanifold:predicate
ContractGameplay framework, data stage

Entry

A record, written DamageFormula(..); the name before the parentheses is optional.

FieldTypeRequiredDefaultDescription
idstringyesThe formula’s key, <mod-id>:<name>.
kindFormulaKindyesThe 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.

VariantWrittenDescription
BasicBasic(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.
ExpressionExpression(gather: .., crit: .., mitigate: ..)The formula as numbers in the damage context.

Basic fields:

FieldTypeRequiredDefaultDescription
armor_statstring or Nonenono armourThe victim’s armour stat (manifold:stat key).
armor_constantf32no100The armour constant k.
resist_capf32no0.75The largest fraction a resistance removes.
critCrit or NonenononeA critical roll.

Expression fields:

FieldTypeRequiredDefaultDescription
gathernumberyesThe 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.
critCrit or NonenononeA critical roll between the two parts.
mitigatenumberyesThe 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 (..).

FieldTypeRequiredDefaultDescription
chancenumberyesThe chance, 0 to 1.
multipliernumberyesThe multiplier.

Value forms used here: number.