Calm + Weight Settings 0.0.6
This commit is contained in:
@@ -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
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+45
-3
@@ -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: "<h2> Advantages/Disadvantage </h2> <select style='margin-bottom:10px;'name='advantage' id='advantage'> <option value='none'>None</option> <option value='advantage'>Advantage/Disadvantage</option></select> <br/>",
|
||||
buttons: {
|
||||
roll: {
|
||||
icon: '<i class="fas fa-check"></i>',
|
||||
label: "Roll",
|
||||
callback: (html) => this.rollAttribute(attribute, html.find('[id=\"advantage\"]')[0].value, '', rollOver)
|
||||
},
|
||||
cancel: {
|
||||
icon: '<i class="fas fa-times"></i>',
|
||||
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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user