From baacbf38a9dd34c67ec3134801668f9f340c173d Mon Sep 17 00:00:00 2001 From: sladecraven Date: Mon, 17 Jan 2022 15:09:52 +0100 Subject: [PATCH] Fix --- modules/pegasus-actor.js | 52 +++++++++++++++++++---------- system.json | 8 ++--- template.json | 6 ++++ templates/actor-sheet.html | 36 ++++++++++++++------ templates/item-equipment-sheet.html | 3 ++ 5 files changed, 74 insertions(+), 31 deletions(-) diff --git a/modules/pegasus-actor.js b/modules/pegasus-actor.js index 7634ae4..a73d0bf 100644 --- a/modules/pegasus-actor.js +++ b/modules/pegasus-actor.js @@ -578,37 +578,55 @@ export class PegasusActor extends Actor { } /* -------------------------------------------- */ - computeNRGHealth() { - let phyDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.phy.value) + this.data.data.statistics.phy.mod; + async computeNRGHealth() { + let updates = {} + let phyDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.phy.value) + this.data.data.secondary.health.bonus + this.data.data.statistics.phy.mod; if (phyDiceValue != this.data.data.secondary.health.max) { - this.update({ 'data.secondary.health.max': phyDiceValue, 'data.secondary.health.value': phyDiceValue }) + updates['data.secondary.health.max'] = phyDiceValue + updates['data.secondary.health.value'] = phyDiceValue } - let mndDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.mnd.value) + this.data.data.statistics.mnd.mod; + let mndDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.mnd.value) + this.data.data.secondary.delirium.bonus + this.data.data.statistics.mnd.mod; if (mndDiceValue != this.data.data.secondary.delirium.max) { - this.update({ 'data.secondary.delirium.max': mndDiceValue, 'data.secondary.delirium.value': mndDiceValue }) + updates['data.secondary.delirium.max'] = mndDiceValue + updates['data.secondary.delirium.value'] = mndDiceValue } - let stlDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.stl.value) +this.data.data.statistics.stl.mod; + let stlDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.stl.value) + this.data.data.secondary.stealthhealth.bonus + this.data.data.statistics.stl.mod; if (stlDiceValue != this.data.data.secondary.stealthhealth.max) { - this.update({ 'data.secondary.stealthhealth.max': stlDiceValue, 'data.secondary.stealthhealth.value': stlDiceValue }) + updates['data.secondary.stealthhealth.max'] = stlDiceValue + updates['data.secondary.stealthhealth.value'] = stlDiceValue } - let socDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.soc.value) + this.data.data.statistics.soc.mod; + + let socDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.soc.value) + this.data.data.secondary.socialhealth.bonus + this.data.data.statistics.soc.mod; if (socDiceValue != this.data.data.secondary.socialhealth.max) { - this.update({ 'data.secondary.socialhealth.max': socDiceValue, 'data.secondary.socialhealth.value': socDiceValue }) + updates['data.secondary.socialhealth.max'] = socDiceValue + updates['data.secondary.socialhealth.value'] = socDiceValue } - - let nrgValue = PegasusUtility.getDiceValue(this.data.data.statistics.foc.value) + + this.data.data.statistics.foc.mod; + + let nrgValue = PegasusUtility.getDiceValue(this.data.data.statistics.foc.value) + this.data.data.nrg.mod + this.data.data.statistics.foc.mod; if (nrgValue != this.data.data.nrg.max) { - this.update({ 'data.nrg.max': nrgValue, 'data.nrg.value': nrgValue }) + updates['data.nrg.max'] = nrgValue + updates['data.nrg.value'] = nrgValue } if (nrgValue != this.data.data.combat.stunthreshold) { - this.update({ 'data.combat.stunthreshold': nrgValue }) + updates['data.combat.stunthreshold'] = nrgValue } - + let mrLevel = (this.data.data.statistics.agi.value + this.data.data.statistics.str.value) - this.data.data.statistics.phy.value mrLevel = (mrLevel < 1) ? 1 : mrLevel; if (mrLevel != this.data.data.mr.value) { - this.update({ 'data.mr.value': mrLevel }); + updates['data.mr.value'] = mrLevel } + + let race = this.getRace() + if ( race && race.name && (race.name != this.data.data.biodata.racename) ) { + updates['data.biodata.racename'] = race.name + } + let role = this.getRole() + if ( role && role.name && (role.name != this.data.data.biodata.rolename)) { + updates['data.biodata.rolename'] = role.name + } + //console.log("UPD", updates, this.data.data.biodata) + await this.update(updates) } /* -------------------------------------------- */ @@ -652,7 +670,7 @@ export class PegasusActor extends Actor { } /* -------------------------------------------- */ async applyRace(race) { - let updates = { 'data.racename': race.name } + let updates = { 'data.biodata.racename': race.name } let newItems = [] await this.deleteAllItemsByType('race') newItems.push(race); @@ -699,7 +717,7 @@ export class PegasusActor extends Actor { async applyRole(role) { console.log("ROLE", role) - let updates = { 'data.rolename': role.name } + let updates = { 'data.biodata.rolename': role.name } let newItems = [] await this.deleteAllItemsByType('role') newItems.push(role); diff --git a/system.json b/system.json index 4ec211b..9f92441 100644 --- a/system.json +++ b/system.json @@ -154,15 +154,15 @@ ] } ], - "primaryTokenAttribute": "endurance.endurance", - "secondaryTokenAttribute": "fate.value", + "primaryTokenAttribute": "secondary.health", + "secondaryTokenAttribute": "secondary.delirium", "socket": true, "styles": [ "styles/simple.css" ], - "templateVersion": 58, + "templateVersion": 60, "title": "Pegasus RPG", "url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg", - "version": "0.1.5", + "version": "0.1.8", "background" : "./images/ui/pegasus_welcome_page.webp" } diff --git a/template.json b/template.json index e7ac7fa..2b8fc79 100644 --- a/template.json +++ b/template.json @@ -109,6 +109,7 @@ "type": "value", "value": 0, "max": 0, + "mod": 0, "activated": 0 }, "mr": { @@ -129,6 +130,7 @@ "value": 0, "type": "value", "ismax": true, + "bonus": 0, "max": 0 }, "delirium": { @@ -136,6 +138,7 @@ "value": 0, "type": "value", "ismax": true, + "bonus": 0, "max": 0 }, "stealthhealth": { @@ -143,6 +146,7 @@ "type": "value", "value": 0, "ismax": true, + "bonus": 0, "max": 0 }, "socialhealth": { @@ -150,6 +154,7 @@ "type": "value", "value": 0, "ismax": true, + "bonus": 0, "max": 0 } }, @@ -421,6 +426,7 @@ "cost": 0, "weight": 0, "idr": "", + "quantity": 0, "equipped": false, "description":"" }, diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index e368f32..967e9c6 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -53,7 +53,7 @@
@@ -193,6 +195,7 @@

{{data.nrg.label}}

+ @@ -296,6 +299,16 @@
+
    +
  • +

    {{data.nrg.label}}

    + + + + +
  • +
+

Powers

@@ -344,7 +357,10 @@
  • {{equip.name}} - {{equip.type}} + {{upperFirst equip.type}} + {{#if (eq equip.type "equipment")}} + Qty {{equip.data.quantity}} + {{/if}}
  • - +
  • - +
    @@ -422,13 +438,13 @@
    • - +
    • + data-dtype="String" />
    @@ -436,13 +452,13 @@
    • - +
    • + data-dtype="String" />
    • diff --git a/templates/item-equipment-sheet.html b/templates/item-equipment-sheet.html index 27bb7e0..3674197 100644 --- a/templates/item-equipment-sheet.html +++ b/templates/item-equipment-sheet.html @@ -21,6 +21,9 @@
    • +
    • + +