Foundryv14 migration
All checks were successful
Release Creation / build (release) Successful in 46s

This commit is contained in:
2026-04-01 22:57:43 +02:00
parent 7dc2492c96
commit bb6a6248f2
25 changed files with 178 additions and 53 deletions

View File

@@ -310,7 +310,13 @@ export default class CthulhuEternalRoll extends Roll {
options.rollItem = CthulhuEternalUtils.getWeaponSkill(actor, options.rollItem, era)
options.initialScore = options.rollItem.system.skillTotal
console.log("WEAPON", era, options.rollItem)
if (options.weapon.system.state === "junk") {
options.isJunk = true
options.initialScore = Math.max(0, options.initialScore - 20) // -20% for junk weapons
}
if (options.weapon.system.state === "worn") {
options.isWorn = true
}
}
break
default:
@@ -341,6 +347,8 @@ export default class CthulhuEternalRoll extends Roll {
targetScore: options.initialScore,
isLowWP: options.isLowWP,
isZeroWP: options.isZeroWP,
isJunk: options.isJunk,
isWorn: options.isWorn,
isExhausted: options.isExhausted,
enableHand: options.rollItem.enableHand,
enableStowed: options.rollItem.enableStowed,
@@ -464,14 +472,15 @@ export default class CthulhuEternalRoll extends Roll {
const roll = new this(formula, options.data, rollData)
await roll.evaluate()
roll.displayRollResult(roll, options, rollData)
await roll.displayRollResult(roll, options, rollData)
if (Hooks.call("fvtt-cthulhu-eternal.Roll", options, rollData, roll) === false) return
return roll
}
displayRollResult(formula, options, rollData) {
async displayRollResult(formula, options, rollData) {
// Compute the result quality
let resultType = "failure"
@@ -489,6 +498,11 @@ export default class CthulhuEternalRoll extends Roll {
resultType = "failureCritical"
}
}
if (rollData.weapon?.system?.state === "junk" && this.total > 95) {
this.options.isDestroyed = true
rollData.isDestroyed = true
resultType = "failureCritical"
}
// As per the rules, a roll of 100 is always a failure, even if the target is above 100
if (this.total === 100) {
resultType = "failureCritical"