only permit 3-digit modifiers

This commit is contained in:
jesopo 2019-09-26 14:31:38 +01:00
parent 0c211528ef
commit ab51bbaefa

View file

@ -4,7 +4,7 @@ import random, re
from src import ModuleManager, utils from src import ModuleManager, utils
ERROR_FORMAT = "Incorrect format! Format must be [number]d[number], e.g. 1d20" ERROR_FORMAT = "Incorrect format! Format must be [number]d[number], e.g. 1d20"
RE_DICE = re.compile("([1-9]\d*)d([1-9]\d*)((?:[-+][1-9]\d*)*)", re.I) RE_DICE = re.compile("^([1-9]\d*)d([1-9]\d*)((?:[-+][1-9]\d{,2})*)$", re.I)
RE_MODIFIERS = re.compile("([-+]\d+)") RE_MODIFIERS = re.compile("([-+]\d+)")
MAX_DICE = 6 MAX_DICE = 6