From 588c6655b36fe12a5b9be163f7beadb54e9dc36c Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Sun, 17 Sep 2023 20:53:13 +0200 Subject: [PATCH] Fix TIC display for NPC owned by players --- modules/pegasus-actor.js | 9 ++++++++- modules/pegasus-roll-dialog.js | 12 ++++++++++++ system.json | 4 ++-- templates/chat-generic-result.html | 9 +++++++++ 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/modules/pegasus-actor.js b/modules/pegasus-actor.js index c331731..5a06e9a 100644 --- a/modules/pegasus-actor.js +++ b/modules/pegasus-actor.js @@ -1467,7 +1467,7 @@ export class PegasusActor extends Actor { updates['system.momentum.max'] = momentum } - let mrLevel = (this.system.statistics.agi.value + this.system.statistics.str.value) - this.system.statistics.phy.value + let mrLevel = (this.system.statistics.agi.value + + this.system.statistics.agi.mod + this.system.statistics.str.value + this.system.statistics.str.mod) - (this.system.statistics.phy.value+this.system.statistics.phy.mod) mrLevel = (mrLevel < 1) ? 1 : mrLevel; if (mrLevel != this.system.mr.value) { updates['system.mr.value'] = mrLevel @@ -1573,6 +1573,7 @@ export class PegasusActor extends Actor { for (let e of effects) { meleeBonus += Number(e.system.effectlevel) } + this.baseMDL = this.system.biodata.sizenum + this.system.biodata.sizebonus + this.system.statistics.str.value + this.system.statistics.str.bonuseffect + meleeBonus let weaponsMelee = this.items.filter(it => it.type == "weapon" && it.system.damagestatistic.toLowerCase() == "str") for (let w of weaponsMelee) { let damage = Number(w.system.damage) + this.system.biodata.sizenum + this.system.biodata.sizebonus + this.system.statistics.str.value + this.system.statistics.str.bonuseffect + meleeBonus @@ -1606,6 +1607,7 @@ export class PegasusActor extends Actor { if (role?.name?.toLowerCase() == "defender") { // Add defender bonus to ADRL roleBonus = this.getRoleLevel() } + this.baseADRL = roleBonus + this.system.statistics.phy.value + this.system.statistics.phy.bonuseffect + this.system.biodata.sizenum + this.system.biodata.sizebonus let armors = this.items.filter(it => it.type == "armor") for (let a of armors) { let adrl = roleBonus + this.system.statistics.phy.value + this.system.statistics.phy.bonuseffect + this.system.biodata.sizenum + this.system.biodata.sizebonus + a.system.resistance + armorBonus @@ -1618,7 +1620,10 @@ export class PegasusActor extends Actor { this.updateEmbeddedDocuments('Item', updates) } } + /* -------------------------------------------- */ + getBaseADRL() { + } /* -------------------------------------------- */ parseStatEffects() { if (this.system.biodata.noautobonus) { // If we are in "no-bonus mode @@ -2145,6 +2150,8 @@ export class PegasusActor extends Actor { rollData.noBonusDice = this.checkNoBonusDice() rollData.dicePool = [] rollData.subKey = subKey + rollData.MDL = this.baseMDL + rollData.ADRL = this.baseADRL if (subKey == "melee-dmg" || subKey == "ranged-dmg" || subKey == "power-dmg") { rollData.isDamage = true diff --git a/modules/pegasus-roll-dialog.js b/modules/pegasus-roll-dialog.js index a978edc..2b80788 100644 --- a/modules/pegasus-roll-dialog.js +++ b/modules/pegasus-roll-dialog.js @@ -104,6 +104,12 @@ export class PegasusRollDialog extends Dialog { if (armor) { armor.applied = toggled } + this.rollData.armorUsed = false + for(let a of this.rollData.armorsList) { + if (a.applied) { + this.rollData.armorUsed = true + } + } console.log("Armor", armorIdx, toggled) PegasusUtility.updateArmorDicePool(this.rollData) } @@ -120,6 +126,12 @@ export class PegasusRollDialog extends Dialog { } weapon.applied = toggled } + this.rollData.weaponUsed = false + for(let a of this.rollData.weaponsList) { + if (a.applied) { + this.rollData.weaponUsed = true + } + } console.log("Weapon", weaponIdx, toggled, weapon) PegasusUtility.updateDamageDicePool(this.rollData) } diff --git a/system.json b/system.json index 8caee49..6977c4d 100644 --- a/system.json +++ b/system.json @@ -252,7 +252,7 @@ ], "title": "Pegasus RPG", "url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg", - "version": "11.0.15", - "download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v11.0.15.zip", + "version": "11.0.16", + "download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v11.0.16.zip", "background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp" } \ No newline at end of file diff --git a/templates/chat-generic-result.html b/templates/chat-generic-result.html index 9071ef5..cac02e8 100644 --- a/templates/chat-generic-result.html +++ b/templates/chat-generic-result.html @@ -57,7 +57,16 @@ {{/if}} {{/if}} + {{#if (eq subKey "melee-dmg")}} + {{#if (not weaponUsed)}} +
  • MDL : {{MDL}}
  • + {{/if}} + {{/if}} + {{#if (eq subKey "dmg-res")}} + {{#if (not armorUsed)}} +
  • ADRL : {{ADRL}}
  • + {{/if}} {{#each armorsList as |armor idx|}} {{#if armor.applied}}
  • ADRL: {{armor.adrl}}