Various fixes

This commit is contained in:
2025-09-16 23:49:02 +02:00
parent 59a39850ce
commit 76a99fe33f
33 changed files with 148 additions and 128 deletions

View File

@@ -140,7 +140,7 @@ export default class LethalFantasyActorSheet extends HandlebarsApplicationMixin(
if ("link" in event.target.dataset) return
const el = event.currentTarget.closest('[data-drag="true"]')
const dragType = el.dataset.dragType
const dragType = el?.dataset?.dragType
let dragData = {}

View File

@@ -136,7 +136,7 @@ export const INITIATIVE_DICE_CHOICES_PER_CLASS = {
"cleric": [
{ "name": "Asleep or totally distracted (1D12)", "value": "1D12" },
{ "name": "Awake but unsuspecting (1D10)", "value": "1D10" },
{ "name": "Declared Ready on Alert (1D)", "value": "1D" },
{ "name": "Declared Ready on Alert (1)", "value": "1" },
/*{ "name": "Aware of the enemy, can hear them but not see (1D6)", "value": "1D6" },
{ "name": "Aware and know exactly where the enemy is (1D4)", "value": "1D4" }*/
],

View File

@@ -442,6 +442,8 @@ export default class LethalFantasyRoll extends Roll {
// Specific pain/poison/contagion case
if (options.rollType === "save" && (options.rollTarget.rollKey === "pain" || options.rollTarget.rollKey === "paincourage" || options.rollTarget.rollKey === "poison" || options.rollTarget.rollKey === "contagion")) {
hasD30 = false
hasStaticModifier = true
modifierFormula = ` + ${Math.abs(fullModifier)}`
}
if (letItFly) {
@@ -979,7 +981,7 @@ export default class LethalFantasyRoll extends Roll {
if (rollContext.range === "beyondskill") {
rollContext.movement = rollContext.movement.replace("kh", "")
rollContext.movement = rollContext.movement.replace("kl", "")
rollContext.movement += "kh" // Add the kl to the movement (disfavor for point blank range)
rollContext.movement += "kh" // Add the kl to the movement (favor for point blank range)
rollContext.range = "+11"
}
@@ -987,8 +989,8 @@ export default class LethalFantasyRoll extends Roll {
let fullModifier = Number(rollContext.moveDirection) +
Number(rollContext.size) +
Number(rollContext.range) +
Number(rollContext.attackerAim)
console.log("Modifier", fullModifier)
Number(rollContext?.attackerAim || 0)
console.log("Modifier", fullModifier, rollContext)
let modifierFormula
if (fullModifier === 0) {
@@ -1009,6 +1011,12 @@ export default class LethalFantasyRoll extends Roll {
let rollD30 = await new Roll("1D30").evaluate()
options.D30result = rollD30.total
if (rollContext.movement.includes("kh")) {
rollData.favor = "favor"
}
if (rollContext.movement.includes("kl")) {
rollData.favor = "disfavor"
}
let dice = rollContext.movement
let maxValue = 20 // As per latest changes (was : Number(dice.match(/\d+$/)[0])
@@ -1043,7 +1051,7 @@ export default class LethalFantasyRoll extends Roll {
rollBase.options.titleFormula = `${dice}E + ${modifierFormula}`
rollBase.options.D30result = options.D30result
rollBase.options.rollName = "Ranged Defense"
rollBase.options.rollData = foundry.utils.duplicate(rollData)
/**
* A hook event that fires after the roll has been made.
* @function