mirror of
https://github.com/raeleus/Hashtag-DnD.git
synced 2025-07-05 21:20:27 -04:00
Fixed double punctuation in attack. Resolves #2
This commit is contained in:
parent
87b3485069
commit
99bbd4fe5a
2 changed files with 5 additions and 1 deletions
2
Input.js
2
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")
|
||||
|
|
|
@ -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, "")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue