UPdate and fixes for roll in combats
Release Creation / build (release) Successful in 43s

This commit is contained in:
2026-05-18 20:26:39 +02:00
parent 7279cd752d
commit 96306623e5
47 changed files with 329 additions and 177 deletions
+22 -17
View File
@@ -862,20 +862,25 @@ export default class LethalFantasyUtils {
} else if (data.attackRollType === "spell-attack" || data.attackRollType === "miracle-attack") {
const attacker = game.actors.get(data.attackerId)
const spell = attacker?.items.get(data.attackWeaponId)
const damageDice = spell?.system?.damageDice
if (damageDice) {
damageButton = `
<div class="attack-result-damage">
<button class="roll-damage-btn"
data-attacker-id="${data.attackerId}"
data-defender-id="${data.defenderId}"
data-defender-token-id="${data.defenderTokenId || ""}"
data-damage-type="spell"
data-damage-formula="${damageDice}">
<i class="fa-solid fa-wand-magic-sparkles"></i> Spell Damage (${damageDice})
</button>
</div>
`
const tiers = [
{ formula: spell?.system?.damageDice, label: "Standard" },
{ formula: spell?.system?.damageDiceOverpowered, label: "Overpowered" },
{ formula: spell?.system?.damageDiceOverpowered2, label: "Overpowered 2" },
].filter(t => t.formula)
if (tiers.length) {
const buttons = tiers.map(t => {
const escapedFormula = Handlebars.escapeExpression(t.formula)
return `
<button class="roll-damage-btn"
data-attacker-id="${data.attackerId}"
data-defender-id="${data.defenderId}"
data-defender-token-id="${data.defenderTokenId || ""}"
data-damage-type="spell"
data-damage-formula="${escapedFormula}">
<i class="fa-solid fa-wand-magic-sparkles"></i> ${t.label} (${escapedFormula})
</button>`
}).join("")
damageButton = `<div class="attack-result-damage">${buttons}</div>`
}
}
}
@@ -902,10 +907,10 @@ export default class LethalFantasyUtils {
</div>
<div class="combat-result-text">
${outcome === "shielded-hit"
? `<i class="fa-solid fa-shield"></i> <strong>${data.attackerName}</strong> hits <strong>${data.defenderName}</strong>, but the shield blocked — apply armor DR + shield DR <strong>${data.shieldDamageReduction || 0}</strong>.`
? `<i class="fa-solid fa-shield"></i> <strong>${data.defenderName}</strong> has blocked with shield — apply armor DR + shield DR <strong>${data.shieldDamageReduction || 0}</strong>.`
: isAttackWin
? `<i class="fa-solid fa-circle-check"></i> <strong>${data.attackerName}</strong> hits <strong>${data.defenderName}</strong>!`
: `<i class="fa-solid fa-shield-halved"></i> <strong>${data.defenderName}</strong> parries the attack!`
: `<i class="fa-solid fa-shield-halved"></i> <strong>${data.defenderName}</strong> avoided the attack!`
}
</div>
${damageButton}
@@ -1195,7 +1200,7 @@ export default class LethalFantasyUtils {
ChatMessage.create({
user: game.user.id,
speaker: { alias: targetActor.name },
mode: "gmroll",
mode: "gm",
content: messageContent
})
}