Skip to main content

ComputedStat

A computed stat is used to define stats whose value is derived from other stats (either base or calculated). Please be wary of circular dependencies between stats.

Computed stats values can still be overridden by the user or by a mechanic. A computed stat with a modifier override (such as with the addToStat effect) will still calculate the value of the computed stat, and then add the appropriate modifier to it. If a value override (such as the one created as a result of the setStat effect) is used instead, the computed stat will not be calculated, using that overridden value + any overridden modifiers in lieu of it.

<details> <summary>Example computed stat</summary>

{
"id": "passive_perception",
"name": "Passive perception",
"abbreviation": "PP",
"type": "calculated",
"value_type": "integer",
"components": {
"type": "add",
"components": {
"type": "list",
"components": [
{
"type": "constant",
"value": 10,
"value_type": "integer"
},
{
"type": "stat",
"stat": "perception"
}
]
}
}
},
{
"id": "perception",
"name": "Perception",
"type": "calculated",
"value_type": "integer",
"components": {
"type": "add",
"components": {
"type": "list",
"components": [
{
"type": "stat",
"stat": "wisdom_modifier"
},
{
"type": "stat",
"stat": "proficiency_bonus"
}
]
}
}
},
{
"id": "wisdom_modifier",
"name": "Wisdom",
"abbreviation": "WIS",
"type": "calculated",
"value_type": "integer",
"components": {
"type": "divide",
"rounding_method": "down",
"components": {
"type": "list",
"components": [
{
"type": "add",
"components": {
"type": "list",
"components": [
{
"type": "stat",
"stat": "wisdom_score"
},
{
"type": "constant",
"value": -10,
"value_type": "integer"
}
]
}
},
{
"type": "constant",
"value": 2,
"value_type": "integer"
}
]
}
}
},
{
"id": "wisdom_score",
"name": "Wisdom",
"abbreviation": "WIS",
"type": "base",
"value_type": "integer",
"default_value": 8
}

</details>

JSON Format​

{
"type": "ComputedStat",
"id": ...,
"name": ...,
"plural": ...,
"abbreviation": ...,
"type": ...,
"value_type": ...,
"sub_value_type": ...,
"default_value": ...,
"components": ...,
"party_visible": ...
}

Fields​

FieldTypeRequiredDescription
idString✓The id for this type instance. This should be unique.
nameString✓The name for this type instance.
pluralStringOptional. The plural form of the name for this type instance (e.g: "Items" if the name is "Item").
abbreviationStringOptional. Abbreviation of the name for this type instance (e.g: "STR" for Strength).
typeStatType✓The type of the stat (base or calculated)
value_typeValueType✓The value type for this stat
sub_value_typeValueTypeOptional field. Set only for array valueTypes. Represents type of the array (e.g: for an array of strings, we should set value_type as array and sub_value_type as string)
default_valuedynamic✓The default value for the stat. Has to conform to the given value_type. Using null is highly discouraged
componentsStatFormulaComponent✓The stat formula components to compute the value for this stat.
party_visiblebool✓