From b62f3412e9e7b2a9c857ff5276874af3bfec3541 Mon Sep 17 00:00:00 2001 From: Martin Jencka Date: Mon, 27 Dec 2021 09:51:47 -0700 Subject: [PATCH] 0.1.7 - Foundry 0.9 Compatibility --- module/actor/actor-sheet.js | 1 - module/actor/actor.js | 16 +++++--------- module/mosh.js | 4 ++-- module/settings.js | 44 ++++++++++++++++++++++++++++++++----- system.json | 4 ++-- 5 files changed, 48 insertions(+), 21 deletions(-) diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index 6a6058e..2d6e297 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -179,7 +179,6 @@ export class MothershipActorSheet extends ActorSheet { const attribute = this.actor.data.data.stats[statName]; var shifted = false; if (ev.shiftKey) shifted = true; - this.actor.rollStat(attribute, shifted); }); diff --git a/module/actor/actor.js b/module/actor/actor.js index 7de2f30..0447949 100644 --- a/module/actor/actor.js +++ b/module/actor/actor.js @@ -147,6 +147,7 @@ export class MothershipActor extends Actor { } rollWeapon(itemId, options = { event: null }) { + let item = duplicate(this.getEmbeddedDocument("Item",itemId)); console.log(item); @@ -333,22 +334,17 @@ export class MothershipActor extends Actor { // Roll let diceformular = (isStress ? "2d10" : "1d100"); - - console.log(attribute); - // if (advantage != undefined && advantage != NaN && advantage != 0) { // diceformular = diceformular + "+" + advantage + "d6kh"; // } let r = new Roll(diceformular, {}); - r.roll(); - - console.log(r); + r.evaluate({async: false}); let rSplit = ("" + r._total).split(""); //Advantage roll let a = new Roll(diceformular, {}); - a.roll(); + a.evaluate({async: false}); if (r._total == 100) { r.results[0] = 0; @@ -363,7 +359,7 @@ export class MothershipActor extends Actor { let damageRoll = 0; if (item.type == "weapon") { damageRoll = new Roll(item.data.damage); - damageRoll.roll(); + damageRoll.evaluate({async: false}); console.log(damageRoll); } @@ -395,8 +391,6 @@ export class MothershipActor extends Actor { resultText = (r._total < targetValue ? "Success" : "Failure"); } - console.log(attribute.value + attribute.mod); - var templateData = { actor: this, stat: { @@ -538,7 +532,7 @@ export class MothershipActor extends Actor { if(item.data.roll){ let r = new Roll(item.data.roll, {}); - r.roll(); + r.evaluate({async: false}); rollInsert = '\
'+item.data.roll+'
\ diff --git a/module/mosh.js b/module/mosh.js index 7e6961e..f75d39a 100644 --- a/module/mosh.js +++ b/module/mosh.js @@ -31,8 +31,8 @@ Hooks.once('init', async function () { }; // Define custom Entity classes - CONFIG.Actor.entityClass = MothershipActor; - CONFIG.Item.entityClass = MothershipItem; + CONFIG.Actor.documentClass = MothershipActor; + CONFIG.Item.documentClass = MothershipItem; // Register sheet application classes diff --git a/module/settings.js b/module/settings.js index f2f932f..ea21955 100644 --- a/module/settings.js +++ b/module/settings.js @@ -1,13 +1,35 @@ export const registerSettings = function () { - game.settings.register('mosh', 'useCalm', { - name: "Use Calm?", - hint: "Uses the traaa.sh Calm system instead of Stress.", - default: false, + game.settings.register('mosh', 'newArmor', { + name: "1e Armor System", + hint: "[COMING SOON] Use the 1st edition Armor system.", + default: true, scope: 'world', type: Boolean, config: true, onChange: value => { // A callback function which triggers when the setting is changed - console.log("useCalm set to " + value) + console.log("newArmorandCombat set to " + value) + } + }); + game.settings.register('mosh', 'newStress', { + name: "1e Stress System", + hint: "[COMING SOON] Use the 1st edition stress system with the roll under d20 and stress table.", + default: true, + scope: 'world', + type: Boolean, + config: true, + onChange: value => { // A callback function which triggers when the setting is changed + console.log("newStress set to " + value) + } + }); + game.settings.register('mosh', 'newWounds', { + name: "1e Wound System", + hint: "[COMING SOON] Instead of the 0e health system, use the 1e wounds and health system.", + default: true, + scope: 'world', + type: Boolean, + config: true, + onChange: value => { // A callback function which triggers when the setting is changed + console.log("newWounds set to " + value) } }); game.settings.register('mosh', 'hideWeight', { @@ -21,4 +43,16 @@ export const registerSettings = function () { console.log("hideWeight set to " + value) } }); + game.settings.register('mosh', 'useCalm', { + name: "Use Calm?", + hint: "Uses the traaa.sh Calm system instead of Stress.", + default: false, + scope: 'world', + type: Boolean, + config: true, + onChange: value => { // A callback function which triggers when the setting is changed + console.log("useCalm set to " + value) + } + }); + }; diff --git a/system.json b/system.json index e02e295..f203451 100644 --- a/system.json +++ b/system.json @@ -2,9 +2,9 @@ "name": "mosh", "title": "MoSh - Unofficial Mothership", "description": "The unofficial Mothership system for FoundryVTT.", - "version": "0.1.6", + "version": "0.1.7", "minimumCoreVersion": "0.8.6", - "compatibleCoreVersion": "0.8.9", + "compatibleCoreVersion": "0.9.0", "templateVersion": 2, "author": "Futilrevenge", "esmodules": ["module/mosh.js"],