diff --git a/Input.js b/Input.js index 71b3947..b37e119 100644 --- a/Input.js +++ b/Input.js @@ -1031,7 +1031,7 @@ function doAttack(command) { var targetText = getArgumentRemainder(command, textIndex) var toMatches = targetText.match(/^to\s+/gi) if (toMatches != null) targetText = targetText.substring(toMatches[0].length) - if (!/^.*(\.|!|\?)$/gi.test(targetText)) targetText += "." + targetText = stripPunctuation(targetText) var die1 = calculateRoll("1d20") var die2 = calculateRoll("1d20") diff --git a/Library.js b/Library.js index 50377a5..be289fb 100644 --- a/Library.js +++ b/Library.js @@ -400,4 +400,8 @@ function toTitleCase(str) { /\w\S*/g, text => text.charAt(0).toUpperCase() + text.substring(1).toLowerCase() ); +} + +function stripPunctuation(str) { + return str.replaceAll(/((\.)|(!))\s*$/g, "") } \ No newline at end of file