New weapon management, including shotgun

This commit is contained in:
2025-07-14 21:33:32 +02:00
parent 61b8da8ccf
commit cdefecdeba
43 changed files with 651 additions and 133 deletions

View File

@@ -196,11 +196,6 @@ export default class CthulhuEternalUtils {
ui.notifications.error(game.i18n.localize("CTHULHUETERNAL.Notifications.noSanTypeFound"))
return
}
// If the sanType is "none", we don't apply any SAN processing
if (sanType === "none") {
ui.notifications.info(game.i18n.localize("CTHULHUETERNAL.Notifications.noSanLossApplied"))
return
}
rollData.sanType = sanType
await actor.system.applySANConsequences(rollData)
// Delete the roll message
@@ -253,7 +248,7 @@ export default class CthulhuEternalUtils {
})
}
static async damageRoll(rollMessage) {
static async damageRoll(rollMessage, formula = null) {
let rollData = rollMessage.rolls[0]?.options?.rollData
let actor = game.actors.get(rollData.actorId)
if (!actor) {
@@ -263,6 +258,7 @@ export default class CthulhuEternalUtils {
console.log("Damage roll data", rollData)
rollData.weapon.resultType = rollData.resultType // Keep the result type from the roll message
rollData.weapon.selectiveFireChoice = rollData.selectiveFireChoice // Keep the selected fire choice from the roll message
rollData.weapon.damageFormula = formula || rollData.weapon.system.damage
actor.system.roll("damage", rollData.weapon)
}