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