Functions
Built-in functions can be used to manipulate numeric results within your formula.
`floor(expression)` - Rounds the result of the expression down to the nearest whole number.
Example: `floor(1d10 / 2)` -> If 1d10 is 7, `floor(3.5)` -> Result `3`.`ceil(expression)` - Rounds the result of the expression up to the nearest whole number.
Example: `ceil(1d10 / 2)` -> If 1d10 is 7, `ceil(3.5)` -> Result `4`.`round(expression)` - Rounds the result of the expression to the nearest whole number (0.5 rounds up).
Example: `round(1d10 / 2)` -> If 1d10 is 7, `round(3.5)` -> Result `4`. If 1d10 is 6, `round(3.0)` -> Result `3`.`abs(expression)` - Returns the absolute (non-negative) value of the expression's result.
Example: `abs(d6 - d6)` -> If rolls are [2, 5], `abs(2 - 5) = abs(-3)` -> Result `3`.`min(a, b)` - Returns the smaller of two numbers.
Example: `min(1d8, 1d10)` -> If the rolls are 5 and 7, the result is `5`.`max(a, b)` - Returns the larger of two numbers.
Example: `max(1d8, 1d10)` -> If the rolls are 5 and 7, the result is `7`.`if(condition, then_expr, else_expr)` - Evaluates the `condition`. If the condition's result is non-zero (true), it evaluates and returns `then_expr`. Otherwise (if the condition is zero/false), it evaluates and returns `else_expr`.
Example: `if(d20>10, d8, d4)` -> If d20 rolls 15 (`15>10` is true), the formula evaluates `d8`. If d20 rolls 5 (`5>10` is false), the formula evaluates `d4`.