-
Notifications
You must be signed in to change notification settings - Fork 0
Die Roll Token
A die roll token represents a single rolling of a single die. Its structure is pretty simple:
{
rolls: [],
keptValue: 2,
kept: true
}
While the structure is simple, the logic is potentially complex.
kept tells us whether this die result ultimately matters. If it was discarded for some reason, this will be set to false. There are multiple reasons it could be discarded, but the actual reason isn't currently documented anywhere. Hopefully it's obvious.
rolls is an array of entries representing actual dice being thrown. This will only contain a single element in most cases, and only gets populated with more if you give the dice rolling a reroll condition, such as 2d20ro<10. Each element is simple and has only two properties, result, which is the number on the die face, and kept, which tells us if that die was the one that was ultimately kept. The result for the kept dice in this array should match the keptValue for the roll token.
keptValue is a somewhat misleading name. This is the value of the die, not necessarily a kept value since if kept is false, it wasn't kept at all. This is mostly a way to not have to look at the rolls array in most cases.