';
+ }
+
+ }
+ }
+ }
+ //END SKILL XP
+
return data.data;
}
@@ -57,6 +91,7 @@ export class MothershipActorSheet extends ActorSheet {
const skills = [];
const weapons = [];
const armors = [];
+ const conditions = [];
let curWeight = 0;
// Iterate through items, allocating to containers
@@ -74,6 +109,27 @@ export class MothershipActorSheet extends ActorSheet {
armors.push(i);
} else if (i.type === 'weapon') {
weapons.push(i);
+ } else if (i.type === 'condition') {
+ // We'll handle the pip html here.
+ if (item.treatment == null) {
+ item.treatment = {
+ "value": 0,
+ "html": ""
+ };
+ }
+ let pipHtml = "";
+ for (let i = 0; i < 3; i++) {
+ if (i < item.treatment.value){
+ pipHtml += '';
+ }
+ else{
+ pipHtml += '';
+ }
+ }
+
+ item.treatment.html = pipHtml;
+
+ conditions.push(i);
}
}
@@ -98,6 +154,7 @@ export class MothershipActorSheet extends ActorSheet {
actorData.skills = skills;
actorData.armors = armors;
actorData.weapons = weapons;
+ actorData.conditions = conditions;
}
@@ -108,6 +165,57 @@ export class MothershipActorSheet extends ActorSheet {
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;
+ html.on('mousedown', '.char-pip-button', ev => {
+ const data = super.getData();
+
+ const div = $(ev.currentTarget);
+ const targetName = div.data("key");
+ const attribute = data.data.data[targetName];
+
+ let amount = attribute.value;
+ let max = div.data("max");
+ let min = div.data("min");
+
+ if (event.button == 0) {
+ if (amount < max) {
+ attribute.value = Number(amount) + 1;
+ }
+ } else if (event.button == 2) {
+ if (amount > min) {
+ attribute.value = Number(amount) - 1;
+ }
+ }
+
+ let updated = {
+ html: '',
+ value: attribute.value
+ }
+
+ const updateString = "data."+targetName;
+
+ this.actor.update({[updateString] : updated});
+ });
+
+ html.on('mousedown', '.treatment-button', ev => {
+ const li = ev.currentTarget.closest(".item");
+ const item = duplicate(this.actor.getEmbeddedDocument("Item", li.dataset.itemId))
+
+ let amount = item.data.treatment.value;
+
+ if (event.button == 0) {
+ if (amount < 3) {
+ item.data.treatment.value = Number(amount) + 1;
+ }
+ } else if (event.button == 2) {
+ if (amount > 0) {
+ item.data.treatment.value = Number(amount) - 1;
+ }
+ }
+
+ this.actor.updateEmbeddedDocuments('Item', [item]);
+ });
+
+
// Update Inventory Item
html.find('.item-equip').click(ev => {
const li = ev.currentTarget.closest(".item");
diff --git a/module/actor/actor.js b/module/actor/actor.js
index 0447949..c8acd84 100644
--- a/module/actor/actor.js
+++ b/module/actor/actor.js
@@ -325,15 +325,18 @@ export class MothershipActor extends Actor {
t.render(true);
}
- rollAttribute(attribute, advantage, item = "", rollOver = false) {
+ async 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);
let isStress = (attribute.label == "Stress" ? true : false);
// Roll
- let diceformular = (isStress ? "2d10" : "1d100");
-
+ let firstEdition = game.settings.get("mosh", "firstEdition");
+
+ let diceformular = (isStress ? (firstEdition ? "2d10" : "1d20") : "1d100");
+
+
// if (advantage != undefined && advantage != NaN && advantage != 0) {
// diceformular = diceformular + "+" + advantage + "d6kh";
// }
@@ -376,6 +379,24 @@ export class MothershipActor extends Actor {
if (r._total == 0 && !isStress || rSplit[0] == rSplit[1] && !isStress)
critical = true;
+
+ let panic = false;
+ let panicText = '';
+ if(isStress && r._total < attribute.value && firstEdition){
+ await(async () => {
+ // const contents = await game.packs.get("Tables").getContent();
+ // const table= contents.find(i => i.name === `Panic`);
+ let tableLocation = game.settings.get("mosh", "panicTable");
+ const documentIndex = game.packs.get(tableLocation).index.getName("Panic");
+ const doc = await game.packs.get(tableLocation).getDocument(documentIndex._id);
+ panic = true;
+ panicText = doc.getResultsForRoll(r._total)[0].data.text;
+
+ //then just put your normal table rolling command using `table`
+ })()
+
+ }
+
//Here's where we handle the result text.
let resultText = "";
@@ -408,7 +429,9 @@ export class MothershipActor extends Actor {
},
isCreature: {
value: this.data.type == "creature" ? true : false
- }
+ },
+ panic: panic,
+ panicText : panicText
},
target: attribute.value,
mod: mod,
diff --git a/module/settings.js b/module/settings.js
index ea21955..751e280 100644
--- a/module/settings.js
+++ b/module/settings.js
@@ -1,7 +1,7 @@
export const registerSettings = function () {
- game.settings.register('mosh', 'newArmor', {
- name: "1e Armor System",
- hint: "[COMING SOON] Use the 1st edition Armor system.",
+ game.settings.register('mosh', 'firstEdition', {
+ name: "1e Rules",
+ hint: "Use the 1st edition rules and character sheet.",
default: true,
scope: 'world',
type: Boolean,
@@ -10,28 +10,52 @@ export const registerSettings = function () {
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,
+
+ game.settings.register('mosh', 'panicTable', {
+ name: "Panic Table",
+ hint: "Where is our panic table located?",
+ default: "mosh.tables",
scope: 'world',
- type: Boolean,
+ type: String,
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)
+ console.log("panicTable set to " + value)
}
});
+
+ // game.settings.register('mosh', 'newArmor', {
+ // name: "1e Armor System",
+ // hint: "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("newArmorandCombat set to " + value)
+ // }
+ // });
+ // game.settings.register('mosh', 'newStress', {
+ // name: "1e Stress System",
+ // hint: "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: "[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', {
name: "Hide Weight",
hint: "Hide weight in the items list for players and ships?",
@@ -54,5 +78,4 @@ export const registerSettings = function () {
console.log("useCalm set to " + value)
}
});
-
};
diff --git a/packs/tables.db b/packs/tables.db
new file mode 100644
index 0000000..26c108f
--- /dev/null
+++ b/packs/tables.db
@@ -0,0 +1 @@
+{"name":"Panic","img":"icons/svg/terror.svg","description":"Stress, Damage, and emotional wear and tear will\neventually bring you to your breaking point. When\nthat happens, there’s a chance you’ll Panic. You\ndetermine this by making a Panic Check.","results":[{"_id":"walsykkkVw8O6g8h","type":0,"text":"LASER FOCUS. [+] on all rolls for the next 2d10 minutes.","weight":1,"range":[1,1],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","rangeL":1,"rangeH":1},{"_id":"9AwRCIdUzsLQSz0R","type":0,"text":"ANXIOUS. Gain 1 Stress.","weight":1,"range":[2,2],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","rangeL":2,"rangeH":2},{"_id":"jxBoCa2HpCFz8BOf","type":0,"text":"JUMPY. Gain 1 Stress. All Nearby crewmembers gain 2 Stress.","weight":1,"range":[3,3],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","rangeL":3,"rangeH":3},{"_id":"8uAAq3NXpymcXXla","type":0,"text":"OVERWHELMED. All actions at [-] for 1d10 minutes. Permanently raise your Minimum Stress by 1.","weight":1,"range":[4,4],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","rangeL":4,"rangeH":4},{"_id":"Dxrs6kprpkL8LMKV","type":0,"text":"COWARD. Gain a new Condition: You must make a Fear Save to engage in violence or flee.","weight":1,"range":[5,5],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","rangeL":5,"rangeH":5},{"_id":"oRKd8KxwdgtVZboQ","type":0,"text":"FRIGHTENED. Gain a new Condition: Phobia: When encountering this Phobia make a Fear[-] Save or gain 1d5 Stress.","weight":1,"range":[6,6],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","rangeL":6,"rangeH":6},{"_id":"8TXWnk9AXGbuFLzq","type":0,"text":"NIGHTMARES. Gain a new Condition: Sleep is difficult, gain [-] on all Comfort Saves.","weight":1,"range":[7,7],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","rangeL":7,"rangeH":7},{"_id":"rXOLEzry0nZQOwh4","type":0,"text":"LOSS OF CONFIDENCE. Gain a new Condition: Choose one of your Skills and lose that Skill’s bonus.","weight":1,"range":[8,8],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","rangeL":8,"rangeH":8},{"_id":"Js7vZQJkUpNk3NYZ","type":0,"text":"DEFLATED. Gain a new Condition: Whenever a Nearby crewmember fails a Save, gain 1 Stress.","weight":1,"range":[9,9],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","rangeL":9,"rangeH":9},{"_id":"nXr4kJ9xU5vfJrtj","type":0,"text":"DOOMED. Gain a new Condition: You feel cursed and unlucky. All Critical Successes are instead Critical Failures.","weight":1,"range":[10,10],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","rangeL":10,"rangeH":10},{"_id":"MBDFWjb9pfvtoOcV","type":0,"text":"PARANOID. For the next week, whenever someone joins your group (even if they only left for a short period of time) make a Fear Save or gain 1 Stress.","weight":1,"range":[11,11],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","rangeL":11,"rangeH":11},{"_id":"7iNxxLn4Flty631Z","type":0,"text":"HAUNTED. Gain a new Condition: Something starts visiting you at night. In your dreams. Out of the corner of your eye. And soon it will start making demands.","weight":1,"range":[12,12],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","rangeL":12,"rangeH":12},{"_id":"4SGDnizOkWYz6aR8","type":0,"text":"DEATH WISH. For the next 24 hours, whenever you encounter a stranger or known enemy, you must make a Sanity Save or immediately attack them.","weight":1,"range":[13,13],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","rangeL":13,"rangeH":13},{"_id":"Pfy0wJO0qEOwB7mI","type":0,"text":"PROPHETIC VISION. You immediately experience an intense hallucination or vision of an impending terror or horrific event. Gain 1 Stress.","weight":1,"range":[14,14],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","rangeL":14,"rangeH":14},{"_id":"fvgahu70gGqneZKQ","type":0,"text":"CATATONIC. Become unresponsive and unmoving for 2d10 minutes. Reduce Stress by 1d10.","weight":1,"range":[15,15],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","rangeL":15,"rangeH":15},{"_id":"guci1cldpF3G7pbE","type":0,"text":"RAGE. Immediately attack the closest crewmember until you inflict at least 2d10 DMG. If there is no crewmember Nearby you attack your surrounding environment.","weight":1,"range":[16,16],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","rangeL":16,"rangeH":16},{"_id":"YnM0EB2Ft0jErGZR","type":0,"text":"SPIRALING. Gain a new Condition: You make Panic Checks with Disadvantage.","weight":1,"range":[17,17],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","rangeL":17,"rangeH":17},{"_id":"jVzb4aYqfXVR31os","type":0,"text":"COMPOUNDING PROBLEMS. Roll twice on this table. Permanently raise your Minimum Stress by 1.","weight":1,"range":[18,18],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","rangeL":18,"rangeH":18},{"_id":"q0i7DdSf7aL34hV0","type":0,"text":"HEART ATTACK / SHORT CIRCUIT (ANDROIDS). Permanently lose 1 Wound. Gain [-] on all rolls for 1d10 hours. Permanently raise your Minimum Stress by 1.","weight":1,"range":[19,19],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","rangeL":19,"rangeH":19},{"_id":"t9LsgwXro6SsnPks","type":0,"text":"COLLAPSE. You no longer control this character. Hand your sheet to the Warden and roll up a new character to play.","weight":1,"range":[20,20],"drawn":false,"flags":{},"img":"icons/svg/d20-black.svg","rangeL":20,"rangeH":20}],"formula":"1d20","replacement":true,"displayRoll":true,"folder":null,"sort":0,"permission":{"default":0,"kRrcXIQG9UdChdqJ":3},"flags":{"core":{"sourceId":"RollTable.K1Z31lcBIScsVwyg"}},"_id":"ppqsMcDXZCCJZCM5"}
diff --git a/system.json b/system.json
index b5e094b..ba6e576 100644
--- a/system.json
+++ b/system.json
@@ -2,7 +2,7 @@
"name": "mosh",
"title": "MoSh - Unofficial Mothership",
"description": "The unofficial Mothership system for FoundryVTT.",
- "version": "0.1.7b",
+ "version": "0.2.0",
"minimumCoreVersion": "0.8.6",
"compatibleCoreVersion": "V9",
"templateVersion": 2,
@@ -10,7 +10,15 @@
"esmodules": ["module/mosh.js"],
"styles": ["css/mosh.css"],
"scripts": [],
- "packs": [],
+ "packs": [
+ {
+ "name": "tables",
+ "label": "Tables",
+ "system": "mosh",
+ "path": "packs/tables.db",
+ "entity": "RollTable"
+ }
+ ],
"languages": [
{
"lang": "en",
diff --git a/template.json b/template.json
index 2595c9f..f33f41e 100644
--- a/template.json
+++ b/template.json
@@ -37,6 +37,9 @@
"rank": {
"value": ""
},
+ "pronouns": {
+ "value": ""
+ },
"credits": {
"value": ""
},
@@ -44,7 +47,9 @@
"value": ""
},
"xp": {
- "value": 0
+ "value": 0,
+ "html" : 0,
+ "selectedSkill" : ""
},
"attributes": {
"level": {
@@ -103,7 +108,8 @@
"biography": "",
"description": "This is a description",
"xp": {
- "value": 1
+ "value": 1,
+ "html": ""
},
"stats": {
"combat": {
@@ -197,7 +203,8 @@
"weapon",
"armor",
"ability",
- "module"
+ "module",
+ "condition"
],
"templates": {
"base": {
@@ -246,6 +253,15 @@
],
"bonus": 10
},
+ "condition": {
+ "templates": [
+ "base"
+ ],
+ "treatment" : {
+ "value" : 0,
+ "html" : ""
+ }
+ },
"ability": {
"templates": [
"base"
diff --git a/templates/actor/actor-sheet.html b/templates/actor/actor-sheet.html
index 46e3544..bfd1b67 100644
--- a/templates/actor/actor-sheet.html
+++ b/templates/actor/actor-sheet.html
@@ -44,16 +44,25 @@
value="{{data.rank.value}}" placeholder="" />
+ {{#if data.settings.firstEdition}}
+
+