From 77a791d29b114d8222fc7ead501d225fdfd1dda8 Mon Sep 17 00:00:00 2001 From: kwaroran Date: Wed, 9 Aug 2023 04:32:23 +0900 Subject: [PATCH] [feat] support roll d+number --- src/ts/parser.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ts/parser.ts b/src/ts/parser.ts index 41c8cdf1..9e41e37c 100644 --- a/src/ts/parser.ts +++ b/src/ts/parser.ts @@ -601,7 +601,13 @@ const matcher = (p1:string,matcherArg:matcherArg) => { } if(p1.startsWith('roll')){ const arr = p1.split(' ', 2) - const maxRoll = parseInt(p1[1]) + let ina = arr[1] + + if(ina.startsWith('d')){ + ina = ina.substring(1) + } + + const maxRoll = parseInt(ina) if(isNaN(maxRoll)){ return 'NaN' }