forked from public/bol
Fix auto-compute
This commit is contained in:
@ -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;
|
||||
this.update( { '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);
|
||||
|
Reference in New Issue
Block a user