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) {

View File

@@ -278,6 +278,7 @@ export default class LethalFantasyRoll extends Roll {
} else if (options.rollType.includes("monster-damage")) {
options.rollName = options.rollTarget.name
options.isDamage = true
hasModifier = true
hasChangeDice = false
options.rollTarget.value = options.rollTarget.damageModifier
@@ -1151,6 +1152,15 @@ export default class LethalFantasyRoll extends Roll {
damageM: weapon.system?.damage?.damageM
}
console.log("Weapon damage options:", weaponDamageOptions)
} else if (this.type === "monster-attack" && this.rollTarget) {
weaponDamageOptions = {
weaponId: this.rollTarget.rollKey,
weaponName: this.rollTarget.name,
damageFormula: this.rollTarget.damageDice,
damageModifier: this.rollTarget.damageModifier,
isMonster: true
}
console.log("Monster damage options:", weaponDamageOptions)
}
const cardData = {