diff --git a/lang/en.json b/lang/en.json index e896f63..dc5d397 100644 --- a/lang/en.json +++ b/lang/en.json @@ -266,4 +266,4 @@ "adventure": "Adventure", "greatness": "Greatness", "Notes": "Notes" -} \ No newline at end of file +} diff --git a/scripts/actor/character/character-data.js b/scripts/actor/character/character-data.js index 30de58d..4969674 100644 --- a/scripts/actor/character/character-data.js +++ b/scripts/actor/character/character-data.js @@ -95,7 +95,9 @@ export class CharacterData extends foundry.abstract.TypeDataModel { // Make sure only four themes are present const themes = this.parent.items.filter((item) => item.type === "theme"); if (themes.length > 4) { - warn(`Too many themes found for ${this.parent.name}, attempting to resolve...`); + warn( + `Too many themes found for ${this.parent.name}, attempting to resolve...`, + ); const toDelete = themes.slice(4); await this.parent.deleteEmbeddedDocuments( "Item", @@ -108,7 +110,9 @@ export class CharacterData extends foundry.abstract.TypeDataModel { (item) => item.type === "backpack", ); if (backpacks.length > 1) { - warn(`Too many backpacks found for ${this.parent.name}, attempting to resolve...`); + warn( + `Too many backpacks found for ${this.parent.name}, attempting to resolve...`, + ); const toDelete = backpacks.slice(1); await this.parent.deleteEmbeddedDocuments( "Item", diff --git a/scripts/actor/character/character-sheet.js b/scripts/actor/character/character-sheet.js index 7938954..163129e 100644 --- a/scripts/actor/character/character-sheet.js +++ b/scripts/actor/character/character-sheet.js @@ -522,13 +522,19 @@ export class CharacterSheet extends SheetMixin(ActorSheet) { const { contents } = item.system; const chosenLoot = await Dialog.wait({ title: game.i18n.localize("Litm.ui.item-transfer-title"), - content: await renderTemplate("systems/litm/templates/apps/loot-dialog.html", { contents, cssClass: "litm--loot-dialog" }), + content: await renderTemplate( + "systems/litm/templates/apps/loot-dialog.html", + { contents, cssClass: "litm--loot-dialog" }, + ), buttons: { loot: { icon: '', label: game.i18n.localize("Litm.other.transfer"), callback: (html) => { - const chosenLoot = html.find("input[type=checkbox]:checked").map((_, i) => i.value).get(); + const chosenLoot = html + .find("input[type=checkbox]:checked") + .map((_, i) => i.value) + .get(); return chosenLoot; }, }, @@ -542,14 +548,22 @@ export class CharacterSheet extends SheetMixin(ActorSheet) { if (!backpack) { error("Litm.ui.error-no-backpack"); throw new Error("Litm.ui.error-no-backpack"); - }; + } // Add the loot to the backpack - await backpack.update({ ['system.contents']: [...this.system.backpack, ...loot] }); + await backpack.update({ + "system.contents": [...this.system.backpack, ...loot], + }); // Remove the loot from the item - await item.update({ ['system.contents']: contents.filter((i) => !chosenLoot.includes(i.id)) }); + await item.update({ + "system.contents": contents.filter((i) => !chosenLoot.includes(i.id)), + }); - ui.notifications.info(game.i18n.format("Litm.ui.item-transfer-success", { items: loot.map((i) => i.name).join(", ") })); + ui.notifications.info( + game.i18n.format("Litm.ui.item-transfer-success", { + items: loot.map((i) => i.name).join(", "), + }), + ); backpack.sheet.render(true); } diff --git a/scripts/apps/roll-dialog.js b/scripts/apps/roll-dialog.js index 6f7c6ff..d3ae774 100644 --- a/scripts/apps/roll-dialog.js +++ b/scripts/apps/roll-dialog.js @@ -59,22 +59,26 @@ export class LitmRollDialog extends FormApplication { negativeStatuses, }); - const formula = typeof CONFIG.litm.roll.formula === "function" ? CONFIG.litm.roll.formula({ - burnedTags, - powerTags, - weaknessTags, - positiveStatuses, - negativeStatuses, - burnedValue, - powerValue, - weaknessValue, - positiveStatusValue, - negativeStatusValue, - totalPower, - actorId, - type, - title, - }) : CONFIG.litm.roll.formula || "2d6 + (@burnedValue + @powerValue + @positiveStatusValue - @weaknessValue - @negativeStatusValue)"; + const formula = + typeof CONFIG.litm.roll.formula === "function" + ? CONFIG.litm.roll.formula({ + burnedTags, + powerTags, + weaknessTags, + positiveStatuses, + negativeStatuses, + burnedValue, + powerValue, + weaknessValue, + positiveStatusValue, + negativeStatusValue, + totalPower, + actorId, + type, + title, + }) + : CONFIG.litm.roll.formula || + "2d6 + (@burnedValue + @powerValue + @positiveStatusValue - @weaknessValue - @negativeStatusValue)"; // Roll const roll = new game.litm.LitmRoll( diff --git a/scripts/apps/roll.js b/scripts/apps/roll.js index 3cf7e85..787b859 100644 --- a/scripts/apps/roll.js +++ b/scripts/apps/roll.js @@ -41,7 +41,7 @@ export class LitmRoll extends Roll { // Quick outcomes don't need to track power if (this.litm.type === "quick") return null; - if (outcome === 'failure') return 0; + if (outcome === "failure") return 0; // Minimum of 1 power let totalPower = Math.max(this.litm.totalPower, 1); @@ -57,8 +57,7 @@ export class LitmRoll extends Roll { get outcome() { const { resolver } = CONFIG.litm.roll; - if (typeof resolver === "function") - return resolver(this); + if (typeof resolver === "function") return resolver(this); if (this.total > 9) return { label: "success", description: "Litm.ui.roll-success" }; @@ -73,7 +72,6 @@ export class LitmRoll extends Roll { template = this.constructor.CHAT_TEMPLATE, isPrivate = false, } = {}) { - if (!this._evaluated) await this.evaluate({ async: true }); const chatData = { @@ -94,7 +92,7 @@ export class LitmRoll extends Roll { hasWeaknessTags: !this.litm.gainedExp && this.litm.weaknessTags.filter((t) => t.type === "weaknessTag").length > - 0, + 0, }; return renderTemplate(template, chatData); @@ -107,9 +105,9 @@ export class LitmRoll extends Roll { } getTooltipData() { - const { label: outcome } = this.outcome + const { label: outcome } = this.outcome; return { - mitigate: this.litm.type === "mitigate" && outcome === 'success', + mitigate: this.litm.type === "mitigate" && outcome === "success", burnedTags: this.litm.burnedTags, powerTags: this.litm.powerTags, weaknessTags: this.litm.weaknessTags, diff --git a/scripts/system/config.js b/scripts/system/config.js index e0c8db9..bc605fd 100644 --- a/scripts/system/config.js +++ b/scripts/system/config.js @@ -1,5 +1,4 @@ export class LitmConfig { - challenge_types = [ "attacker", "barrier-hazard", @@ -104,7 +103,7 @@ export class LitmConfig { * @link scripts/apps/roll-dialog.js * @link scripts/apps/roll.js */ - roll = { formula: null, resolver: null } + roll = { formula: null, resolver: null }; theme_levels = { origin: [ diff --git a/scripts/system/handlebars.js b/scripts/system/handlebars.js index 122e453..bd3890d 100644 --- a/scripts/system/handlebars.js +++ b/scripts/system/handlebars.js @@ -12,7 +12,7 @@ export class HandlebarsHelpers { Handlebars.registerHelper("includes", (array, value, path) => Array.isArray(array) ? (path && array.some((i) => i[path] === value)) || - array.includes(value) + array.includes(value) : false, ); diff --git a/system.json b/system.json index b152d8c..0db9657 100644 --- a/system.json +++ b/system.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/foundryvtt-system-manifest.json", "id": "litm", - "version": 25, + "version": 26, "license": "LICENSE", "title": "Legend in the Mist Demo", "description": "A Rustic Fantasy Game for Foundry Virtual Tabletop.", @@ -93,6 +93,6 @@ "url": "https://github.com/aMediocreDad/litm", "bugs": "https://github.com/aMediocreDad/litm/issues?q=is:issue+is:open+sort:updated-desc", "manifest": "https://raw.githubusercontent.com/aMediocreDad/litm/main/system.json", - "download": "https://github.com/aMediocreDad/litm/archive/refs/tags/v25.zip", + "download": "https://github.com/aMediocreDad/litm/archive/refs/tags/v26.zip", "readme": "https://github.com/aMediocreDad/litm/blob/main/README.md" }