Fix spell save/defense again
Release Creation / build (release) Successful in 45s

This commit is contained in:
2026-06-13 21:06:18 +02:00
parent ace726a1fc
commit 60b351f50d
4 changed files with 43 additions and 1 deletions
@@ -255,18 +255,21 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
buttons: [
{
action: "noDR",
type: "button",
label: game.i18n.localize("LETHALFANTASY.Combat.spellNoDR"),
icon: "fa-solid fa-wand-magic-sparkles",
callback: () => 0
},
{
action: "applyDR",
type: "button",
label: game.i18n.localize("LETHALFANTASY.Combat.spellApplyDR"),
icon: "fa-solid fa-shield",
callback: (event, button) => Number(button.form?.elements?.manualDr?.value) || 0
},
{
action: "cancel",
type: "button",
label: game.i18n.localize("LETHALFANTASY.Combat.proceedNo"),
callback: () => "cancel"
}
+1
View File
@@ -218,6 +218,7 @@ export default class LethalFantasyActor extends Actor {
if (available.length > 1) {
const buttons = available.map(([id]) => ({
action: id,
type: "button",
label: id.charAt(0).toUpperCase() + id.slice(1),
callback: () => id,
}))
+14 -1
View File
@@ -391,6 +391,8 @@ export default class LethalFantasyRoll extends Roll {
position,
buttons: [
{
action: "roll",
type: "button",
label: label,
callback: (event, button, dialog) => {
log("Roll context", event, button, dialog)
@@ -445,7 +447,7 @@ export default class LethalFantasyRoll extends Roll {
if (hasModifier) {
let bonus = Number(options.rollTarget.value)
fullModifier = rollContext.modifier === "" ? 0 : parseInt(rollContext.modifier, 10) + bonus
fullModifier += (rollContext.saveSpell) ? options.rollTarget.actorModifiers.saveModifier : 0
fullModifier += (rollContext.saveSpell) ? (options.rollTarget.actorModifiers?.saveModifier ?? 0) : 0
if (Number(rollContext.attackerAim) > 0) {
fullModifier += Number(rollContext.attackerAim)
}
@@ -719,6 +721,8 @@ export default class LethalFantasyRoll extends Roll {
content,
buttons: [
{
action: "initiative",
type: "button",
label: label,
callback: (event, button) => {
const output = Array.from(button.form.elements).reduce((obj, input) => {
@@ -796,6 +800,7 @@ export default class LethalFantasyRoll extends Roll {
}
buttons.push({
action: "roll",
type: "button",
label: weaponLabel,
callback: (event, button) => {
let pos = $('#combat-action-dialog').position()
@@ -822,6 +827,7 @@ export default class LethalFantasyRoll extends Roll {
}
buttons.push({
action: "roll",
type: "button",
label: label,
callback: (event, button) => {
let pos = $('#combat-action-dialog').position()
@@ -833,6 +839,7 @@ export default class LethalFantasyRoll extends Roll {
} else {
buttons.push({
action: "roll",
type: "button",
label: "Select action",
callback: (event, button) => {
let pos = $('#combat-action-dialog').position()
@@ -848,6 +855,7 @@ export default class LethalFantasyRoll extends Roll {
}
buttons.push({
action: "cancel",
type: "button",
label: "Other action, not listed here",
callback: (event, button) => {
let pos = $('#combat-action-dialog').position()
@@ -915,6 +923,7 @@ export default class LethalFantasyRoll extends Roll {
content: `<div class="grit-luck-dialog"><p><strong>${selectedItem.name}</strong> has multiple damage tiers.</p><p>Choose which damage to use when the attack lands:</p></div>`,
buttons: tiers.map(t => ({
action: t.id,
type: "button",
label: `${t.label} (${t.dice.toUpperCase()})`,
icon: "fa-solid fa-wand-magic-sparkles",
callback: () => t.id
@@ -1119,6 +1128,8 @@ export default class LethalFantasyRoll extends Roll {
content,
buttons: [
{
action: "rangeDefense",
type: "button",
label: label,
callback: (event, button) => {
const output = Array.from(button.form.elements).reduce((obj, input) => {
@@ -1278,6 +1289,8 @@ export default class LethalFantasyRoll extends Roll {
content,
buttons: [
{
action: "rangedAttack",
type: "button",
label,
callback: (event, button) => {
const output = Array.from(button.form.elements).reduce((obj, input) => {
+25
View File
@@ -299,6 +299,7 @@ export default class LethalFantasyUtils {
if (currentGrit > 0) {
buttons.push({
action: "grit",
type: "button",
label: `Spend 1 Grit (+1D6) [${currentGrit} left]`,
icon: "fa-solid fa-fist-raised",
callback: () => "grit"
@@ -308,6 +309,7 @@ export default class LethalFantasyUtils {
if (currentLuck > 0) {
buttons.push({
action: "luck",
type: "button",
label: `Spend 1 Luck (+1D6) [${currentLuck} left]`,
icon: "fa-solid fa-clover",
callback: () => "luck"
@@ -316,6 +318,7 @@ export default class LethalFantasyUtils {
buttons.push({
action: "bonusDie",
type: "button",
label: "Add bonus die",
icon: "fa-solid fa-dice",
callback: () => "bonusDie"
@@ -324,6 +327,7 @@ export default class LethalFantasyUtils {
if (canShieldReact) {
buttons.push({
action: "shieldReact",
type: "button",
label: `Roll shield (${shieldLabel})`,
icon: "fa-solid fa-shield",
callback: () => "shieldReact"
@@ -331,6 +335,7 @@ export default class LethalFantasyUtils {
} else if (canAdHoc) {
buttons.push({
action: "adHocShield",
type: "button",
label: "Roll ad-hoc shield (choose dice + DR)",
icon: "fa-solid fa-shield-halved",
callback: () => "adHocShield"
@@ -339,6 +344,7 @@ export default class LethalFantasyUtils {
buttons.push({
action: "continue",
type: "button",
label: "Continue (no defense bonus)",
icon: "fa-solid fa-forward",
callback: () => "continue"
@@ -534,6 +540,7 @@ export default class LethalFantasyUtils {
buttons: [
{
action: "rollSave",
type: "button",
label: "Roll Save",
icon: "fa-solid fa-person-running",
callback: (event, button) => button.form.elements.saveKey.value,
@@ -607,6 +614,8 @@ export default class LethalFantasyUtils {
content,
buttons: [
{
action: "rangeDefense",
type: "button",
label: "Roll Defense",
icon: "fa-solid fa-shield",
callback: (event, button, dialog) => {
@@ -714,6 +723,8 @@ export default class LethalFantasyUtils {
content,
buttons: [
{
action: "defenseRoll",
type: "button",
label: "Roll Defense",
icon: "fa-solid fa-shield",
callback: (event, button, dialog) => {
@@ -809,6 +820,7 @@ export default class LethalFantasyUtils {
}
return {
action: c.type,
type: "button",
label,
icon,
callback: () => c
@@ -998,6 +1010,7 @@ export default class LethalFantasyUtils {
buttons: [
{
action: "roll",
type: "button",
label: "Roll Bonus Die",
icon: "fa-solid fa-dice",
callback: (event, button) => {
@@ -1007,6 +1020,7 @@ export default class LethalFantasyUtils {
},
{
action: "cancel",
type: "button",
label: "Cancel",
icon: "fa-solid fa-xmark",
callback: () => null
@@ -1054,6 +1068,7 @@ export default class LethalFantasyUtils {
buttons: [
{
action: "roll",
type: "button",
label: "Roll Shield",
icon: "fa-solid fa-shield",
callback: (event, button) => {
@@ -1067,6 +1082,7 @@ export default class LethalFantasyUtils {
},
{
action: "cancel",
type: "button",
label: "Cancel",
icon: "fa-solid fa-xmark",
callback: () => null
@@ -1137,6 +1153,7 @@ export default class LethalFantasyUtils {
if (currentGrit > 0) {
buttons.push({
action: "grit",
type: "button",
label: `Spend 1 Grit (+1D6) [${currentGrit} left]`,
icon: "fa-solid fa-fist-raised",
callback: () => "grit"
@@ -1146,6 +1163,7 @@ export default class LethalFantasyUtils {
if (currentLuck > 0) {
buttons.push({
action: "luck",
type: "button",
label: `Spend 1 Luck (+1D6) [${currentLuck} left]`,
icon: "fa-solid fa-clover",
callback: () => "luck"
@@ -1154,6 +1172,7 @@ export default class LethalFantasyUtils {
buttons.push({
action: "continue",
type: "button",
label: "Continue (no bonus)",
icon: "fa-solid fa-forward",
callback: () => "continue"
@@ -1229,12 +1248,14 @@ export default class LethalFantasyUtils {
const buttons = [
{
action: "grit",
type: "button",
label: `Spend 1 Grit (+1D6) [${currentGrit} left]`,
icon: "fa-solid fa-fist-raised",
callback: () => "grit"
},
{
action: "continue",
type: "button",
label: "Continue (no bonus)",
icon: "fa-solid fa-forward",
callback: () => "continue"
@@ -1625,21 +1646,25 @@ export default class LethalFantasyUtils {
buttons: [
{
action: "noDR",
type: "button",
label: "No DR",
callback: () => ({ drType: "none", damage: damageTotal })
},
{
action: "armorDR",
type: "button",
label: "With Armor DR",
callback: () => ({ drType: "armor", damage: Math.max(0, damageTotal - armorDR) })
},
{
action: "allDR",
type: "button",
label: "With Armor + Shield DR",
callback: () => ({ drType: "all", damage: Math.max(0, damageTotal - totalDR) })
},
{
action: "cancel",
type: "button",
label: "Cancel",
callback: () => null
}