Fix auto-compute
This commit is contained in:
parent
1074a1d91c
commit
b034a92541
@ -108,27 +108,32 @@ export class BoLActorSheet extends ActorSheet {
|
||||
/** @override */
|
||||
getData(options) {
|
||||
const data = super.getData(options);
|
||||
const actorData = data.data;
|
||||
data.config = game.bol.config;
|
||||
data.data = actorData.data;
|
||||
data.details = this.actor.details;
|
||||
data.attributes = this.actor.attributes;
|
||||
data.aptitudes = this.actor.aptitudes;
|
||||
data.resources = this.actor.resources;
|
||||
data.equipment = this.actor.equipment;
|
||||
data.weapons = this.actor.weapons;
|
||||
data.protections = this.actor.protections;
|
||||
data.containers = this.actor.containers;
|
||||
data.treasure = this.actor.treasure;
|
||||
data.vehicles = this.actor.vehicles;
|
||||
data.ammos = this.actor.ammos;
|
||||
data.misc = this.actor.misc;
|
||||
data.combat = this.actor.buildCombat();
|
||||
data.features = this.actor.buildFeatures();
|
||||
data.isGM = game.user.isGM;
|
||||
const actorData = duplicate(data.data);
|
||||
let formData = duplicate(data)
|
||||
formData.config = game.bol.config;
|
||||
formData.data = actorData.data;
|
||||
formData.details = this.actor.details;
|
||||
formData.attributes = this.actor.attributes;
|
||||
formData.aptitudes = this.actor.aptitudes;
|
||||
formData.resources = this.actor.resources;
|
||||
formData.equipment = this.actor.equipment;
|
||||
formData.weapons = this.actor.weapons;
|
||||
formData.protections = this.actor.protections;
|
||||
formData.containers = this.actor.containers;
|
||||
formData.treasure = this.actor.treasure;
|
||||
formData.vehicles = this.actor.vehicles;
|
||||
formData.ammos = this.actor.ammos;
|
||||
formData.misc = this.actor.misc;
|
||||
formData.combat = this.actor.buildCombat();
|
||||
formData.features = this.actor.buildFeatures();
|
||||
formData.isGM = game.user.isGM;
|
||||
formData.options= this.options,
|
||||
formData.owner= this.document.isOwner,
|
||||
formData.editScore= this.options.editScore,
|
||||
formData.isGM= game.user.isGM
|
||||
|
||||
console.log("ACTORDATA", data);
|
||||
return data;
|
||||
console.log("ACTORDATA", formData);
|
||||
return formData;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
|
||||
@ -159,7 +164,6 @@ export class BoLActorSheet extends ActorSheet {
|
||||
return this.actor.createEmbeddedDocuments("Item", [itemData]);
|
||||
}
|
||||
|
||||
|
||||
_onToggleEquip(event) {
|
||||
event.preventDefault();
|
||||
const li = $(event.currentTarget).closest(".item");
|
||||
|
@ -6,32 +6,41 @@ export class BoLActor extends Actor {
|
||||
|
||||
/** @override */
|
||||
prepareData() {
|
||||
super.prepareData();
|
||||
const actorData = this.data;
|
||||
// console.log(actorData);
|
||||
// const data = actorData.data;
|
||||
// const flags = actorData.flags;
|
||||
// Make separate methods for each Actor type (character, npc, etc.) to keep things organized.
|
||||
if (actorData.type === 'character') {
|
||||
this._prepareCharacterData(actorData);
|
||||
//this._prepareCharacterData(actorData);
|
||||
}
|
||||
super.prepareData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare Character type specific data
|
||||
*/
|
||||
_prepareCharacterData(actorData) {
|
||||
let newVitality = 10 + this.data.data.attributes.vigor.value;
|
||||
if ( newVitality != this.data.data.resources.hp.max) {
|
||||
this.data.data.resources.hp.max = newVitality;
|
||||
/* -------------------------------------------- */
|
||||
//_onUpdate(changed, options, user) {
|
||||
//
|
||||
//}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
updateResourcesData( ) {
|
||||
let newVitality = 10 + this.data.data.attributes.vigor.value + this.data.data.resources.hp.bonus
|
||||
if ( this.data.data.resources.hp.max != newVitality) {
|
||||
this.update( {'data.resources.hp.max': newVitality} );
|
||||
}
|
||||
let newPower = 10 + this.data.data.attributes.mind.value + this.data.data.resources.power.bonus
|
||||
if ( this.data.data.resources.power.max != newPower) {
|
||||
this.update( {'data.resources.power.max': newPower} );
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_onUpdate() {
|
||||
this.manageHealthState()
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData()
|
||||
this.updateResourcesData()
|
||||
this.manageHealthState();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
get itemData(){
|
||||
return Array.from(this.data.items.values()).map(i => i.data);
|
||||
|
@ -393,31 +393,6 @@ export class BoLUtility {
|
||||
let formula = nbDice + "d" + res[2] + postForm + ((res[modIndex]) ? res[modIndex] : "");
|
||||
return formula;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static async showDiceSoNice(roll, rollMode) {
|
||||
if (game.modules.get("dice-so-nice")?.active) {
|
||||
if (game.dice3d) {
|
||||
let whisper = null;
|
||||
let blind = false;
|
||||
rollMode = rollMode ?? game.settings.get("core", "rollMode");
|
||||
switch (rollMode) {
|
||||
case "blindroll": //GM only
|
||||
blind = true;
|
||||
case "gmroll": //GM + rolling player
|
||||
whisper = BoLUtility.getUsers(user => user.isGM);
|
||||
break;
|
||||
case "roll": //everybody
|
||||
whisper = BoLUtility.getUsers(user => user.active);
|
||||
break;
|
||||
case "selfroll":
|
||||
whisper = [game.user.id];
|
||||
break;
|
||||
}
|
||||
await game.dice3d.showForRoll(roll, game.user, true, whisper, blind);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async confirmDelete(actorSheet, li) {
|
||||
let itemId = li.data("item-id");
|
||||
|
@ -7,7 +7,8 @@
|
||||
"url": "https://github.com/ZigmundKreud/bol",
|
||||
"license": "LICENSE.txt",
|
||||
"flags": {},
|
||||
"version": "0.8.9.1",
|
||||
"version": "0.8.9.2",
|
||||
"templateVersion": 10,
|
||||
"minimumCoreVersion": "0.8.6",
|
||||
"compatibleCoreVersion": "9",
|
||||
"scripts": [],
|
||||
|
@ -111,12 +111,14 @@
|
||||
"faith": {
|
||||
"key" : "faith",
|
||||
"label" : "BOL.resources.faith",
|
||||
"bonus": 0,
|
||||
"value": 0,
|
||||
"max": 0
|
||||
},
|
||||
"power": {
|
||||
"key" : "power",
|
||||
"label" : "BOL.resources.power",
|
||||
"bonus": 0,
|
||||
"value": 0,
|
||||
"max": 0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user