Fix TIC display for NPC owned by players

This commit is contained in:
LeRatierBretonnien 2023-09-17 20:53:13 +02:00
parent 9de2bc48b8
commit 588c6655b3
4 changed files with 31 additions and 3 deletions

View File

@ -1467,7 +1467,7 @@ export class PegasusActor extends Actor {
updates['system.momentum.max'] = momentum 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; mrLevel = (mrLevel < 1) ? 1 : mrLevel;
if (mrLevel != this.system.mr.value) { if (mrLevel != this.system.mr.value) {
updates['system.mr.value'] = mrLevel updates['system.mr.value'] = mrLevel
@ -1573,6 +1573,7 @@ export class PegasusActor extends Actor {
for (let e of effects) { for (let e of effects) {
meleeBonus += Number(e.system.effectlevel) 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") let weaponsMelee = this.items.filter(it => it.type == "weapon" && it.system.damagestatistic.toLowerCase() == "str")
for (let w of weaponsMelee) { 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 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 if (role?.name?.toLowerCase() == "defender") { // Add defender bonus to ADRL
roleBonus = this.getRoleLevel() 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") let armors = this.items.filter(it => it.type == "armor")
for (let a of armors) { 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 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) this.updateEmbeddedDocuments('Item', updates)
} }
} }
/* -------------------------------------------- */
getBaseADRL() {
}
/* -------------------------------------------- */ /* -------------------------------------------- */
parseStatEffects() { parseStatEffects() {
if (this.system.biodata.noautobonus) { // If we are in "no-bonus mode 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.noBonusDice = this.checkNoBonusDice()
rollData.dicePool = [] rollData.dicePool = []
rollData.subKey = subKey rollData.subKey = subKey
rollData.MDL = this.baseMDL
rollData.ADRL = this.baseADRL
if (subKey == "melee-dmg" || subKey == "ranged-dmg" || subKey == "power-dmg") { if (subKey == "melee-dmg" || subKey == "ranged-dmg" || subKey == "power-dmg") {
rollData.isDamage = true rollData.isDamage = true

View File

@ -104,6 +104,12 @@ export class PegasusRollDialog extends Dialog {
if (armor) { if (armor) {
armor.applied = toggled 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) console.log("Armor", armorIdx, toggled)
PegasusUtility.updateArmorDicePool(this.rollData) PegasusUtility.updateArmorDicePool(this.rollData)
} }
@ -120,6 +126,12 @@ export class PegasusRollDialog extends Dialog {
} }
weapon.applied = toggled 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) console.log("Weapon", weaponIdx, toggled, weapon)
PegasusUtility.updateDamageDicePool(this.rollData) PegasusUtility.updateDamageDicePool(this.rollData)
} }

View File

@ -252,7 +252,7 @@
], ],
"title": "Pegasus RPG", "title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg", "url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "11.0.15", "version": "11.0.16",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v11.0.15.zip", "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" "background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
} }

View File

@ -57,7 +57,16 @@
{{/if}} {{/if}}
{{/if}} {{/if}}
{{#if (eq subKey "melee-dmg")}}
{{#if (not weaponUsed)}}
<li>MDL : {{MDL}}</li>
{{/if}}
{{/if}}
{{#if (eq subKey "dmg-res")}} {{#if (eq subKey "dmg-res")}}
{{#if (not armorUsed)}}
<li>ADRL : {{ADRL}}</li>
{{/if}}
{{#each armorsList as |armor idx|}} {{#each armorsList as |armor idx|}}
{{#if armor.applied}} {{#if armor.applied}}
<li>ADRL: {{armor.adrl}}</li> <li>ADRL: {{armor.adrl}}</li>