diff --git a/module/documents/roll.mjs b/module/documents/roll.mjs index c8fd2d2..54dcea3 100644 --- a/module/documents/roll.mjs +++ b/module/documents/roll.mjs @@ -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}` diff --git a/packs/ftl-nomad-items/000048.log b/packs/ftl-nomad-items/000053.log similarity index 100% rename from packs/ftl-nomad-items/000048.log rename to packs/ftl-nomad-items/000053.log diff --git a/packs/ftl-nomad-items/CURRENT b/packs/ftl-nomad-items/CURRENT index a6d5883..29ffc22 100644 --- a/packs/ftl-nomad-items/CURRENT +++ b/packs/ftl-nomad-items/CURRENT @@ -1 +1 @@ -MANIFEST-000046 +MANIFEST-000051 diff --git a/packs/ftl-nomad-items/LOG b/packs/ftl-nomad-items/LOG index d9f6a30..aa99086 100644 --- a/packs/ftl-nomad-items/LOG +++ b/packs/ftl-nomad-items/LOG @@ -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) diff --git a/packs/ftl-nomad-items/LOG.old b/packs/ftl-nomad-items/LOG.old index fb7a5c8..d9f6a30 100644 --- a/packs/ftl-nomad-items/LOG.old +++ b/packs/ftl-nomad-items/LOG.old @@ -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) diff --git a/packs/ftl-nomad-items/MANIFEST-000046 b/packs/ftl-nomad-items/MANIFEST-000046 deleted file mode 100644 index 8d4e8dd..0000000 Binary files a/packs/ftl-nomad-items/MANIFEST-000046 and /dev/null differ diff --git a/packs/ftl-nomad-items/MANIFEST-000051 b/packs/ftl-nomad-items/MANIFEST-000051 new file mode 100644 index 0000000..a9ccbca Binary files /dev/null and b/packs/ftl-nomad-items/MANIFEST-000051 differ diff --git a/packs/ftl-nomad-vehicles/000026.log b/packs/ftl-nomad-vehicles/000031.log similarity index 100% rename from packs/ftl-nomad-vehicles/000026.log rename to packs/ftl-nomad-vehicles/000031.log diff --git a/packs/ftl-nomad-vehicles/CURRENT b/packs/ftl-nomad-vehicles/CURRENT index 1e21b78..52f34be 100644 --- a/packs/ftl-nomad-vehicles/CURRENT +++ b/packs/ftl-nomad-vehicles/CURRENT @@ -1 +1 @@ -MANIFEST-000024 +MANIFEST-000029 diff --git a/packs/ftl-nomad-vehicles/LOG b/packs/ftl-nomad-vehicles/LOG index a2757a6..085a926 100644 --- a/packs/ftl-nomad-vehicles/LOG +++ b/packs/ftl-nomad-vehicles/LOG @@ -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) diff --git a/packs/ftl-nomad-vehicles/LOG.old b/packs/ftl-nomad-vehicles/LOG.old index dfa9e2e..a2757a6 100644 --- a/packs/ftl-nomad-vehicles/LOG.old +++ b/packs/ftl-nomad-vehicles/LOG.old @@ -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) diff --git a/packs/ftl-nomad-vehicles/MANIFEST-000024 b/packs/ftl-nomad-vehicles/MANIFEST-000024 deleted file mode 100644 index ab23f8f..0000000 Binary files a/packs/ftl-nomad-vehicles/MANIFEST-000024 and /dev/null differ diff --git a/packs/ftl-nomad-vehicles/MANIFEST-000029 b/packs/ftl-nomad-vehicles/MANIFEST-000029 new file mode 100644 index 0000000..269c031 Binary files /dev/null and b/packs/ftl-nomad-vehicles/MANIFEST-000029 differ