diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js
index 49b449d..95fdb1a 100644
--- a/module/actor/actor-sheet.js
+++ b/module/actor/actor-sheet.js
@@ -30,6 +30,13 @@ export class MothershipActorSheet extends ActorSheet {
this._prepareCharacterItems(data);
}
+
+ if (data.data.settings == null) {
+ data.data.settings = {};
+ }
+ data.data.settings.useCalm = game.settings.get("mothership", "useCalm");
+ data.data.settings.hideWeight = game.settings.get("mothership", "hideWeight");
+
return data;
}
@@ -224,6 +231,18 @@ export class MothershipActorSheet extends ActorSheet {
});
+ // Rollable Item/Anything with a description that we want to click on.
+ html.find('.calm-roll').click(ev => {
+ const attribute = this.actor.data.data.other.stress;
+ attribute.label = "Calm";
+ this.actor.rollStress(attribute);
+ });
+ // Rollable Item/Anything with a description that we want to click on.
+ html.find('.stress-roll').click(ev => {
+ const attribute = this.actor.data.data.other.stress;
+ attribute.label = "Stress";
+ this.actor.rollStress(attribute);
+ });
}
/* -------------------------------------------- */
@@ -305,4 +324,15 @@ export class MothershipActorSheet extends ActorSheet {
}
}
+ async _updateObject(event, formData) {
+ const actor = this.object;
+ const updateData = expandObject(formData);
+
+ await actor.update(updateData, {
+ diff: false
+ });
+ }
+
+
+
}
diff --git a/module/actor/actor.js b/module/actor/actor.js
index 0a506f0..80294ac 100644
--- a/module/actor/actor.js
+++ b/module/actor/actor.js
@@ -20,6 +20,8 @@ export class MothershipActor extends Actor {
else if (actorData.type === 'creature') this._prepareCreatureData(actorData);
else if (actorData.type === 'ship') this._prepareShipData(actorData);
+
+
}
/**
* Prepare Character type specific data
@@ -86,6 +88,37 @@ export class MothershipActor extends Actor {
d.render(true);
}
+ rollStress(attribute) {
+ //this.rollAttribute(attribute, "none");
+ let rollOver = true;
+ if(attribute.label == "Calm")
+ rollOver = false;
+
+ let attLabel = attribute.label?.charAt(0).toUpperCase() + attribute.label?.toLowerCase().slice(1);
+ if (!attribute.label && isNaN(attLabel))
+ attLabel = attribute.charAt(0)?.toUpperCase() + attribute.toLowerCase().slice(1);
+
+ let d = new Dialog({
+ title: "Select Roll Type",
+ content: "
Advantages/Disadvantage
",
+ buttons: {
+ roll: {
+ icon: '',
+ label: "Roll",
+ callback: (html) => this.rollAttribute(attribute, html.find('[id=\"advantage\"]')[0].value, '', rollOver)
+ },
+ cancel: {
+ icon: '',
+ label: "Cancel",
+ callback: () => { }
+ }
+ },
+ default: "roll",
+ close: () => { }
+ });
+ d.render(true);
+ }
+
rollWeapon(itemId, options = { event: null }) {
let item = duplicate(this.getEmbeddedEntity("OwnedItem", itemId));
@@ -189,7 +222,7 @@ export class MothershipActor extends Actor {
t.render(true);
}
- rollAttribute(attribute, advantage, item = "") {
+ rollAttribute(attribute, advantage, item = "", rollOver = false) {
let attributeName = attribute.label?.charAt(0).toUpperCase() + attribute.label?.toLowerCase().slice(1);
if (!attribute.label && isNaN(attributeName))
attributeName = attribute.charAt(0)?.toUpperCase() + attribute.toLowerCase().slice(1);
@@ -197,7 +230,7 @@ export class MothershipActor extends Actor {
console.log("Got here baybee");
// Roll
- let diceformular = "1d100";
+ let diceformular = "1d100-1";
console.log(attribute);
@@ -207,6 +240,8 @@ export class MothershipActor extends Actor {
let r = new Roll(diceformular, {});
r.roll();
+ console.log(r);
+
//Advantage roll
let a = new Roll(diceformular, {});
a.roll();
@@ -226,6 +261,13 @@ export class MothershipActor extends Actor {
let targetValue = attribute.value + mod + (item == "" ? 0 : item.data.bonus);
+ //Here's where we handle the result text.
+ let resultText = (r._total < targetValue ? "Success" : "Failure");
+ if(rollOver == true)
+ resultText = (r._total > targetValue ? "Success" : "Failure");
+
+ console.log(attribute.value + attribute.mod);
+
var templateData = {
actor: this,
stat: {
@@ -239,7 +281,7 @@ export class MothershipActor extends Actor {
damageRoll: damageRoll
},
resultText: {
- value: (r._total < attribute.value + attribute.mod ? "Success" : "Failure")
+ value: resultText
},
isCreature: {
value: this.data.type == "creature" ? true : false
diff --git a/module/actor/ship-sheet.js b/module/actor/ship-sheet.js
index 6bb7588..4e3dd53 100644
--- a/module/actor/ship-sheet.js
+++ b/module/actor/ship-sheet.js
@@ -30,6 +30,13 @@ export class MothershipShipSheet extends ActorSheet {
this._prepareShipItems(data);
}
+ if (data.data.settings == null) {
+ data.data.settings = {};
+ }
+
+ data.data.settings.useCalm = game.settings.get("mothership", "useCalm");
+ data.data.settings.hideWeight = game.settings.get("mothership", "hideWeight");
+
return data;
}
diff --git a/module/mothership.js b/module/mothership.js
index 9493db7..8b91ab0 100644
--- a/module/mothership.js
+++ b/module/mothership.js
@@ -5,6 +5,9 @@ import { MothershipCreatureSheet } from "./actor/creature-sheet.js";
import { MothershipShipSheet } from "./actor/ship-sheet.js";
import { MothershipItem } from "./item/item.js";
import { MothershipItemSheet } from "./item/item-sheet.js";
+import {
+ registerSettings
+} from "./settings.js";
Hooks.once('init', async function () {
@@ -26,6 +29,8 @@ Hooks.once('init', async function () {
CONFIG.Actor.entityClass = MothershipActor;
CONFIG.Item.entityClass = MothershipItem;
+ registerSettings();
+
// Register sheet application classes
Actors.unregisterSheet("core", ActorSheet);
diff --git a/module/settings.js b/module/settings.js
new file mode 100644
index 0000000..58e0547
--- /dev/null
+++ b/module/settings.js
@@ -0,0 +1,18 @@
+export const registerSettings = function () {
+ game.settings.register('mothership', 'useCalm', {
+ name: "Use Calm?",
+ hint: "Uses the traaa.sh Calm system instead of Stress.",
+ default: false,
+ scope: 'world',
+ type: Boolean,
+ config: true
+ });
+ game.settings.register('mothership', 'hideWeight', {
+ name: "Hide Weight",
+ hint: "Hide weight in the items list for players and ships?",
+ default: false,
+ scope: 'world',
+ type: Boolean,
+ config: true
+ });
+};
diff --git a/system.json b/system.json
index a753554..4be2edc 100644
--- a/system.json
+++ b/system.json
@@ -2,7 +2,7 @@
"name": "mothership",
"title": "Mothership",
"description": "The Mothership system for FoundryVTT!",
- "version": "0.0.5",
+ "version": "0.0.6",
"minimumCoreVersion": "0.5.5",
"compatibleCoreVersion": "0.5.5",
"templateVersion": 2,
diff --git a/template.json b/template.json
index 326956e..bf45465 100644
--- a/template.json
+++ b/template.json
@@ -24,6 +24,10 @@
],
"biography": "",
"notes": "",
+ "settings" : {
+ "useCalm" : false
+ },
+
"class": {
"value": ""
},
@@ -78,7 +82,8 @@
"other": {
"stress": {
"value": 2,
- "min": 0
+ "min": 0,
+ "label" : "Stress"
},
"resolve": {
"value": 0
diff --git a/templates/actor/actor-sheet.html b/templates/actor/actor-sheet.html
index f138c42..e559c85 100644
--- a/templates/actor/actor-sheet.html
+++ b/templates/actor/actor-sheet.html
@@ -96,9 +96,26 @@
Maximum
+ {{#if data.settings.useCalm}}
+
+
+
+
+
+
+
Current
+
Maximum
+
+ {{else}}
-
+
Current
Minimum
+ {{/if}}
@@ -310,26 +328,45 @@
Item Name
Quantity
+ {{#if data.settings.hideWeight}}
+ {{else}}
Weight
+ {{/if}}
Value
- {{#each actor.gear as |item id|}}
-
-
- {{item.name}}
- {{item.data.quantity}}
- {{item.data.weight}}
- {{item.data.cost}}
-
-
- {{/each}}
+ {{#if actor.data.settings.hideWeight}}
+ {{#each actor.gear as |item id|}}
+
+
+ {{item.name}}
+ {{item.data.quantity}}
+ {{item.data.cost}}
+
+
+ {{/each}}
+ {{else}}
+ {{#each actor.gear as |item id|}}
+
+
+ {{item.name}}
+ {{item.data.quantity}}
+ {{item.data.weight}}
+ {{item.data.cost}}
+
+
+ {{/each}}
+ {{/if}}
+
{{!-- Owned Skills Tab --}}
diff --git a/templates/chat/statroll.html b/templates/chat/statroll.html
index ad14aa4..d3747e9 100644
--- a/templates/chat/statroll.html
+++ b/templates/chat/statroll.html
@@ -12,7 +12,7 @@
{{{item.data.description}}}
-
+
{{else}}
{{#if isWeapon}}
@@ -37,36 +37,6 @@
{{else}}
{{data.diceTotal.value}}
{{/if}}
-
- {{#if data.isCreature.value}}
-
-
- {{#each diceData.dice}}
-
-
- {{#if this.img}}
-

- {{/if}}
-
- {{/each}}
-
-
- {{else}}
-
- {{#each diceData.dice}}
-
-
- {{#if this.img}}
-

- {{/if}}
-
- {{/each}}
-
- {{/if}}