Resolve issues with casted spells being repeated twice.

This commit is contained in:
raeleus 2024-09-17 18:26:12 -07:00 committed by GitHub
parent c15f5c9dd4
commit f7a29c57b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1481,11 +1481,15 @@ function doCastSpell(command) {
if (!/^((at)|(on))\s+.*/.test(target)) target = "at " + target
}
} else {
var remainder = getArgumentRemainder(command, spellIndex)
spell = remainder.replace(/\s+((at)|(on)).*/i, "").trim()
if (/.*\s((at)|(on))\s.*/i.test(spell)) {
var remainder = getArgumentRemainder(command, spellIndex)
spell = remainder.replace(/\s+((at)|(on)).*/i, "").trim()
target = remainder.replace(/^.*\s+(?=(at)|(on))/i, "").trim()
} else {
spell = getArgumentRemainder(command, spellIndex).trim()
}
found = character.spells.find(x => x.toLowerCase() == spell.toLowerCase())
target = remainder.replace(/^.*\s+(?=(at)|(on))/i, "").trim()
}
if (found == null) {
@ -1622,4 +1626,4 @@ function doHelp(command) {
return " "
}
modifier(text)
modifier(text)