Fix roll options
All checks were successful
Release Creation / build (release) Successful in 1m8s

This commit is contained in:
2025-08-26 22:14:45 +02:00
parent 188501423a
commit d80e3e4658
13 changed files with 60 additions and 34 deletions

View File

@@ -93,6 +93,7 @@ export default class FTLNomadRoll extends Roll {
break
case "damage":
options.weapon = foundry.utils.duplicate(options.rollItem)
formula = options.weapon.system.damage
break
case "weapon":
options.weapon = foundry.utils.duplicate(options.rollItem)
@@ -212,11 +213,30 @@ export default class FTLNomadRoll extends Roll {
options.numericModifier = Number(rollData.numericModifier) || 0
options.skillModifier = Number(rollData.skillModifier) || 0
options.rangeModifier = Number(rollData.rangeModifier) || 0
options.finalModifier = options.numericModifier + options.skillModifier + options.rangeModifier
let mod = options.rollItem?.value || 0
// Build the dice formula
let diceFormula = `${2 + Math.abs(options.skillModifier)}D6`
if (options.skillModifier > 0) {
let diceFormula = "2d6"
if (options.rollType === "damage") {
let damageFormula = options.weapon.system.damage.toUpperCase().replace(/D/g, "d")
// Extract the mod (if present), like in 3d6+1
let match = damageFormula.match(/([+-]\d+)$/)
if (match) {
mod += Number(match[1])
damageFormula = damageFormula.replace(match[1], "")
}
// Replace the D6 by the correct number of D6
damageFormula = damageFormula.replace(/(\d*)d6/gi, (match, p1) => {
let numDice = Number(p1) || 1
numDice += Math.abs(options.skillModifier)
return `${numDice}d6`
})
diceFormula = damageFormula
} else {
diceFormula = `${2 + Math.abs(options.finalModifier)}D6`
}
if (options.finalModifier > 0) {
diceFormula += `kh2 + ${mod}`
} else {
diceFormula += `kl2 + ${mod}`

View File

@@ -1 +1 @@
MANIFEST-000046
MANIFEST-000051

View File

@@ -1,11 +1,7 @@
2025/08/25-21:48:36.909732 7f99c9ffb6c0 Delete type=3 #1
2025/08/25-21:56:45.440471 7f99c8ff96c0 Level-0 table #49: started
2025/08/25-21:56:45.440527 7f99c8ff96c0 Level-0 table #49: 0 bytes OK
2025/08/25-21:56:45.504826 7f99c8ff96c0 Delete type=0 #47
2025/08/25-21:56:45.558056 7f99c8ff96c0 Manual compaction at level-0 from '!folders!AuBtSOj1mJmh88qx' @ 72057594037927935 : 1 .. '!items!zv9dwgL3p7ThQn7j' @ 0 : 0; will stop at '!items!zv9dwgL3p7ThQn7j' @ 385 : 1
2025/08/25-21:56:45.558080 7f99c8ff96c0 Compacting 1@0 + 0@1 files
2025/08/25-21:56:45.590210 7f99c8ff96c0 Generated table #50@0: 285 keys, 111653 bytes
2025/08/25-21:56:45.590298 7f99c8ff96c0 Compacted 1@0 + 0@1 files => 111653 bytes
2025/08/25-21:56:45.648076 7f99c8ff96c0 compacted to: files[ 0 1 0 0 0 0 0 ]
2025/08/25-21:56:45.648259 7f99c8ff96c0 Delete type=2 #44
2025/08/25-21:56:45.801444 7f99c8ff96c0 Manual compaction at level-0 from '!items!zv9dwgL3p7ThQn7j' @ 385 : 1 .. '!items!zv9dwgL3p7ThQn7j' @ 0 : 0; will stop at (end)
2025/08/26-08:04:22.211637 7f99c9ffb6c0 Recovering log #48
2025/08/26-08:04:22.223370 7f99c9ffb6c0 Delete type=3 #46
2025/08/26-08:04:22.223498 7f99c9ffb6c0 Delete type=0 #48
2025/08/26-08:13:33.915174 7f99c8ff96c0 Level-0 table #54: started
2025/08/26-08:13:33.915296 7f99c8ff96c0 Level-0 table #54: 0 bytes OK
2025/08/26-08:13:33.948896 7f99c8ff96c0 Delete type=0 #52
2025/08/26-08:13:33.949217 7f99c8ff96c0 Manual compaction at level-0 from '!folders!AuBtSOj1mJmh88qx' @ 72057594037927935 : 1 .. '!items!zv9dwgL3p7ThQn7j' @ 0 : 0; will stop at (end)

View File

@@ -1,4 +1,11 @@
2025/08/25-21:48:36.813932 7f99c9ffb6c0 Log #42: 0 ops saved to Table #45 OK
2025/08/25-21:48:36.814091 7f99c9ffb6c0 Archiving /home/morr/foundry/foundrydata-v13/Data/systems/fvtt-ftl-nomad/packs/ftl-nomad-items/000042.log: OK
2025/08/25-21:48:36.814401 7f99c9ffb6c0 Table #44: 285 entries OK
2025/08/25-21:48:36.843347 7f99c9ffb6c0 **** Repaired leveldb /home/morr/foundry/foundrydata-v13/Data/systems/fvtt-ftl-nomad/packs/ftl-nomad-items; recovered 1 files; 111653 bytes. Some data may have been lost. ****
2025/08/25-21:48:36.909732 7f99c9ffb6c0 Delete type=3 #1
2025/08/25-21:56:45.440471 7f99c8ff96c0 Level-0 table #49: started
2025/08/25-21:56:45.440527 7f99c8ff96c0 Level-0 table #49: 0 bytes OK
2025/08/25-21:56:45.504826 7f99c8ff96c0 Delete type=0 #47
2025/08/25-21:56:45.558056 7f99c8ff96c0 Manual compaction at level-0 from '!folders!AuBtSOj1mJmh88qx' @ 72057594037927935 : 1 .. '!items!zv9dwgL3p7ThQn7j' @ 0 : 0; will stop at '!items!zv9dwgL3p7ThQn7j' @ 385 : 1
2025/08/25-21:56:45.558080 7f99c8ff96c0 Compacting 1@0 + 0@1 files
2025/08/25-21:56:45.590210 7f99c8ff96c0 Generated table #50@0: 285 keys, 111653 bytes
2025/08/25-21:56:45.590298 7f99c8ff96c0 Compacted 1@0 + 0@1 files => 111653 bytes
2025/08/25-21:56:45.648076 7f99c8ff96c0 compacted to: files[ 0 1 0 0 0 0 0 ]
2025/08/25-21:56:45.648259 7f99c8ff96c0 Delete type=2 #44
2025/08/25-21:56:45.801444 7f99c8ff96c0 Manual compaction at level-0 from '!items!zv9dwgL3p7ThQn7j' @ 385 : 1 .. '!items!zv9dwgL3p7ThQn7j' @ 0 : 0; will stop at (end)

Binary file not shown.

View File

@@ -1 +1 @@
MANIFEST-000024
MANIFEST-000029

View File

@@ -1,11 +1,7 @@
2025/08/25-21:48:36.994202 7f99ca7fc6c0 Delete type=3 #1
2025/08/25-21:56:45.505125 7f99c8ff96c0 Level-0 table #27: started
2025/08/25-21:56:45.505238 7f99c8ff96c0 Level-0 table #27: 0 bytes OK
2025/08/25-21:56:45.557727 7f99c8ff96c0 Delete type=0 #25
2025/08/25-21:56:45.648499 7f99c8ff96c0 Manual compaction at level-0 from '!actors!3pydTJsM73Z4o0V6' @ 72057594037927935 : 1 .. '!folders!vRnrOJqSMlxbSgyX' @ 0 : 0; will stop at '!folders!vRnrOJqSMlxbSgyX' @ 92 : 1
2025/08/25-21:56:45.648514 7f99c8ff96c0 Compacting 1@0 + 0@1 files
2025/08/25-21:56:45.676577 7f99c8ff96c0 Generated table #28@0: 51 keys, 49087 bytes
2025/08/25-21:56:45.676616 7f99c8ff96c0 Compacted 1@0 + 0@1 files => 49087 bytes
2025/08/25-21:56:45.736809 7f99c8ff96c0 compacted to: files[ 0 1 0 0 0 0 0 ]
2025/08/25-21:56:45.736931 7f99c8ff96c0 Delete type=2 #22
2025/08/25-21:56:45.801488 7f99c8ff96c0 Manual compaction at level-0 from '!folders!vRnrOJqSMlxbSgyX' @ 92 : 1 .. '!folders!vRnrOJqSMlxbSgyX' @ 0 : 0; will stop at (end)
2025/08/26-08:04:22.229470 7f99caffd6c0 Recovering log #26
2025/08/26-08:04:22.240597 7f99caffd6c0 Delete type=3 #24
2025/08/26-08:04:22.240743 7f99caffd6c0 Delete type=0 #26
2025/08/26-08:13:33.840012 7f99c8ff96c0 Level-0 table #32: started
2025/08/26-08:13:33.840112 7f99c8ff96c0 Level-0 table #32: 0 bytes OK
2025/08/26-08:13:33.862575 7f99c8ff96c0 Delete type=0 #30
2025/08/26-08:13:33.949166 7f99c8ff96c0 Manual compaction at level-0 from '!actors!3pydTJsM73Z4o0V6' @ 72057594037927935 : 1 .. '!folders!vRnrOJqSMlxbSgyX' @ 0 : 0; will stop at (end)

View File

@@ -1,4 +1,11 @@
2025/08/25-21:48:36.915000 7f99ca7fc6c0 Log #20: 0 ops saved to Table #23 OK
2025/08/25-21:48:36.915188 7f99ca7fc6c0 Archiving /home/morr/foundry/foundrydata-v13/Data/systems/fvtt-ftl-nomad/packs/ftl-nomad-vehicles/000020.log: OK
2025/08/25-21:48:36.915342 7f99ca7fc6c0 Table #22: 51 entries OK
2025/08/25-21:48:36.932577 7f99ca7fc6c0 **** Repaired leveldb /home/morr/foundry/foundrydata-v13/Data/systems/fvtt-ftl-nomad/packs/ftl-nomad-vehicles; recovered 1 files; 49087 bytes. Some data may have been lost. ****
2025/08/25-21:48:36.994202 7f99ca7fc6c0 Delete type=3 #1
2025/08/25-21:56:45.505125 7f99c8ff96c0 Level-0 table #27: started
2025/08/25-21:56:45.505238 7f99c8ff96c0 Level-0 table #27: 0 bytes OK
2025/08/25-21:56:45.557727 7f99c8ff96c0 Delete type=0 #25
2025/08/25-21:56:45.648499 7f99c8ff96c0 Manual compaction at level-0 from '!actors!3pydTJsM73Z4o0V6' @ 72057594037927935 : 1 .. '!folders!vRnrOJqSMlxbSgyX' @ 0 : 0; will stop at '!folders!vRnrOJqSMlxbSgyX' @ 92 : 1
2025/08/25-21:56:45.648514 7f99c8ff96c0 Compacting 1@0 + 0@1 files
2025/08/25-21:56:45.676577 7f99c8ff96c0 Generated table #28@0: 51 keys, 49087 bytes
2025/08/25-21:56:45.676616 7f99c8ff96c0 Compacted 1@0 + 0@1 files => 49087 bytes
2025/08/25-21:56:45.736809 7f99c8ff96c0 compacted to: files[ 0 1 0 0 0 0 0 ]
2025/08/25-21:56:45.736931 7f99c8ff96c0 Delete type=2 #22
2025/08/25-21:56:45.801488 7f99c8ff96c0 Manual compaction at level-0 from '!folders!vRnrOJqSMlxbSgyX' @ 92 : 1 .. '!folders!vRnrOJqSMlxbSgyX' @ 0 : 0; will stop at (end)

Binary file not shown.