Mods from active effects (take-highest stacking)
Mods from feature items (additive stacking)
Distribute an effective damage amount across vitals without modifying state. Shared by calculateDamage and applyDamage.
Post-resistance (and post-block) damage to distribute
Starting layer
Resolve incoming damage through the resistance/piercing ladder and per-keyword modifiers. Returns the floored effective damage after all incoming multipliers and bonuses are applied, but before distribution across vitals. Does not modify state or trigger hooks.
The raw damage amount
The damage type
Optionaloptions: {Optionalattacker?: objectAttacker document (used for outgoingResistancePiercing)
OptionalextraPiercing?: numberAdditional piercing from callee context
OptionalignoreResistances?: booleanSkip resistance ladder entirely
Optionalkeywords?: string[]Damage keywords for per-keyword incoming mods
The floored remaining damage after all modifiers
Calculate how damage would be distributed, applying resistance but not modifying state or firing hooks. Use this for damage previews (rollDamage outcome). For actual application, use applyDamage.
The raw damage amount
The damage type
Optionallayer: string = "tempHp"
Starting layer
Optionaloptions: {Optionalattacker?: objectAttacker document for piercing calculation
OptionalextraPiercing?: numberAdditional piercing stages
OptionalignoreResistances?: booleanSkip resistance ladder
Optionalkeywords?: string[]Damage keywords for per-keyword incoming mods
Construct the roll data object for use in Foundry Roll() formulas.
This method supports @-prefixed flat addressing used by Foundry's Roll engine
(distinct from the system's own parseFormula/resolveActorVars which use
single-brace {fth} and dotted system.attributes.* syntax).
Return shape (for use in new Roll(formula, actor.getRollData())):
@str.value, @str.total, @str.bonus — for each attribute key in CONFIG.BODY_MIND_SOUL.calculator.mapping
@vitals.health.value, @vitals.health.max, @vitals.health.label — likewise for shields, tempHp, sanity, effectiveHp
@resources.
Note: Addresses like @vitals.health.value and @vitals.effectiveHp.value use a different
convention than the system's parseFormula option actor, which resolves {health} and
{fth} through a separate mechanism. See parseFormula docs for roll-data vs. formula vars.
Flattened roll data with attribute/vital/resource/vector values
Convert the schema to a plain object.
The built in toObject() method will ignore derived data when using Data Models.
This additional method will instead use the spread operator to return a simplified
version of the data.
Plain object either via deepClone or the spread operator.
StaticdefineStaticmigrate
Apply modifications to this actor's derived data. appliedMods (active effects) use best-buff / worst-debuff take-highest stacking. localMods (feature items on the sheet) stack additively with each other. Both pools combine at application: localSum + bestBuff + worstDebuff. setStage overrides all addStages; last setStage in the list wins.