Skip to main content

When

This effect allows you to specify branches in your overall formula, enabling you to return different things depending on the conditions you specify and the state of the character / resource.

In contrast with the WhenEffect, the When formula needs at least one branch to evaluate to true, as it always should return a value. It is recommended to always include a clause like this at the end of the clause list to ensure that one always matches:

{
"condition": {
"type": "constant",
"value": true,
"value_type": "bool"
},
"components": {
/* Default value to be returned here */
}
}

JSON Format

{
"type": "when",
"clauses": ...
}

Fields

FieldTypeRequiredDescription
clausesList<WhenClause>A list of conditions and associated components that should be evaluated and whose value should be returned as a value from this formula if the given condition is satisfied. Only the first clause whose condition is true will have its components evaluated and its value returned. The rest will be ignored, so the order matters. You can specify as many clauses as you want.