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": ...
}
Fields
| Field | Type | Required | Description |
|---|---|---|---|
components | StatFormulaComponent | ✓ | The stat formula components to compute the value for this stat. |