Interesting. Assuming there's no valid hidden thing that might allow a d20 to yield something outside the range of 1..20, the programmer in me wonders how that could happen.
1. Display issue. But the math adds up, so probably not.
2. So many modifiers, maybe that overwhelms some max array length, and a garbage location is used. I'd do 100 or 256 or some ridiculous, but still tiny by modern computers, size. Check if there's a hard coded max, and is this at it? Watch for 1-off issues.
3. Bug in the karmic dice roll. It dinged you but too much, forgetting to clamp it to 1 minimum. (Maybe a reroll got another 1 and subtracted more karma?)
Having said that, their internal dice roll API is probably off the shelf, or modeled on one, and probably has an API like:
int roll_dice(int diceSize, int offset)
where size = 20, say, and offset, usually 0, then adds or subtracts that amount from the result. I would also look into all uses of this API at the second parameter. I would expect it to be unused, and, say, the - 1 of d20 - 1, would be handled outside that beyond early code drafts. But maybe some legacy thing crept in, or some supplied param that should always be 0 in the data load that got overlooked.
Yes, I mixed underscores and camel notation!
Last edited by Shadowbart; 01/08/25 07:00 PM.