From 0c211528ef74422fc950dd63d85276b2a0934e6f Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 26 Sep 2019 14:22:56 +0100 Subject: also show "total" when there's modifiers --- modules/dice.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/dice.py b/modules/dice.py index e6764142..38ce3441 100644 --- a/modules/dice.py +++ b/modules/dice.py @@ -4,7 +4,7 @@ import random, re from src import ModuleManager, utils ERROR_FORMAT = "Incorrect format! Format must be [number]d[number], e.g. 1d20" -RE_DICE = re.compile("([1-9]\d*)d([1-9]\d*)((?:[-+]\d+)*)", re.I) +RE_DICE = re.compile("([1-9]\d*)d([1-9]\d*)((?:[-+][1-9]\d*)*)", re.I) RE_MODIFIERS = re.compile("([-+]\d+)") MAX_DICE = 6 @@ -39,7 +39,7 @@ class Module(ModuleManager.BaseModule): total_n -= int(modifier[1:]) total = "" - if len(results) > 1: + if len(results) > 1 or modifiers: total = " (total: %d)" % total_n results_str = ", ".join(str(r) for r in results) -- cgit v1.3.1-10-gc9f91