Math
Math expressions facilitate numerical calculations involving Properties and integers.
Syntax
Math expressions begin with the math
keyword and consist of a left operand, an operator and a right operand, in that order.
Alternatively, Math expressions can also have the operands and operator enclosed within the (
and )
symbols.
Operand
Operands on the left and right side of the operator can be an integer, a Property or another Math expression, thereby allowing nested calculations.
Operator
The operator in a Math expression must be one of the following:
Symbol | Description |
---|---|
+ | Addition |
- | Subtraction |
* | Multiplication |
/ | Round-Down Division (i.e. Fractional results are rounded down to the nearest integer) |
// | Round-Up Division (i.e. Fractional results are rounded up to the nearest integer) |
min | Evaluates to the smaller of the left and right operands |
max | Evaluates to the larger of the left and right operands |
Examples
Melee Attack Bonus + 2
math character.attack.melee + 2
or
(character.attack.melee + 2)
Difference between Swim and Land Speed
(character.speed.land - character.speed.swim)
One-Quarter BAB (Rounded Down)
(character.bab / 4)
Three-Quarters Character Level
((3 * character.level) / 4)
Max of Solarian Level and Mystic Level
(character.solarian.level max character.mystic.level)