Add damage management and DR for monsters also
All checks were successful
Release Creation / build (release) Successful in 1m48s

This commit is contained in:
2025-12-19 15:41:27 +01:00
parent 96062c6fd9
commit 61ed1597e7
36 changed files with 488 additions and 230 deletions

View File

@@ -80,14 +80,26 @@ export default class LethalFantasyActor extends Actor {
/* *************************************************/
computeDamageReduction() {
let naturalDR = Number(this.system.biodata.naturalDR) || 0
let magicDR = Number(this.system.biodata.magicDR) || 0
// Pour les monstres, utiliser hp.damageResistance et combat.damageReduction
if (this.type === "monster") {
let hpDR = Number(this.system.hp?.damageResistance) || 0
let combatDR = Number(this.system.combat?.damageReduction) || 0
return hpDR + combatDR
}
// Pour les personnages, utiliser biodata et items
let naturalDR = Number(this.system.biodata?.naturalDR) || 0
let magicDR = Number(this.system.biodata?.magicDR) || 0
let armorDR = this.getArmorDR()
return naturalDR + magicDR + armorDR
}
/* *************************************************/
getShieldDR() {
// Pour les monstres, utiliser combat.shieldDamageReduction
if (this.type === "monster") {
return Number(this.system.combat?.shieldDamageReduction) || 0
}
// Pour les personnages, utiliser les items de type shield
let dr = 0
for (let item of this.items) {
if (item.type === "shield" && item.system.equipped) {