6 Commits

Author SHA1 Message Date
6c6c473147 Fixes regarding shields usage and spells
All checks were successful
Release Creation / build (release) Successful in 52s
2026-04-14 21:31:17 +02:00
2e2a917a45 Fixes regarding shields usage and spells 2026-04-14 21:31:03 +02:00
343abc32e2 FIx init à 1 again
All checks were successful
Release Creation / build (release) Successful in 50s
2026-04-12 11:08:19 +02:00
c37d92af25 Various initiative fixes + shield management messages
All checks were successful
Release Creation / build (release) Successful in 46s
2026-04-12 01:07:58 +02:00
42945d33db ATtempt to fix init rolls
All checks were successful
Release Creation / build (release) Successful in 52s
2026-04-07 20:44:13 +02:00
1bf88bac06 ATtempt to fix init rolls 2026-04-07 20:43:15 +02:00
39 changed files with 791 additions and 229 deletions

View File

@@ -294,13 +294,13 @@
"miracle-power": "Miracle - Power", "miracle-power": "Miracle - Power",
"miracle-attack": "Miracle - Attack", "miracle-attack": "Miracle - Attack",
"spell": "Spell", "spell": "Spell",
"will":"Will", "will": "Will",
"dodge":"Dodge", "dodge": "Dodge",
"toughness":"Toughness", "toughness": "Toughness",
"contagion":"Contagion", "contagion": "Contagion",
"poison":"Poison", "poison": "Poison",
"pain":"Pain", "pain": "Pain",
"paincourage":"Pain/Courage", "paincourage": "Pain/Courage",
"granted": "Granted Dice", "granted": "Granted Dice",
"shields": "Shields", "shields": "Shields",
"armorHitPoints": "Armor hit points", "armorHitPoints": "Armor hit points",
@@ -320,7 +320,7 @@
"aetherPoints": "Aether points", "aetherPoints": "Aether points",
"attacks": "Attacks", "attacks": "Attacks",
"monster": "Monster", "monster": "Monster",
"Resist" :"Resist", "Resist": "Resist",
"resist": "Resist", "resist": "Resist",
"resistTorture": "Resist torture", "resistTorture": "Resist torture",
"resistPerformance": "Resist performance", "resistPerformance": "Resist performance",
@@ -428,7 +428,8 @@
"weapons": "Weapons", "weapons": "Weapons",
"wis": "WIS", "wis": "WIS",
"weapon-damage-medium": "Weapon damage medium", "weapon-damage-medium": "Weapon damage medium",
"weapon-damage-small": "Weapon damage small" "weapon-damage-small": "Weapon damage small",
"combatProgressionStart": "Combat start threshold"
}, },
"Miracle": { "Miracle": {
"FIELDS": { "FIELDS": {
@@ -722,6 +723,9 @@
}, },
"catalyst": { "catalyst": {
"label": "Catalyst" "label": "Catalyst"
},
"damageDice": {
"label": "Damage dice"
} }
} }
}, },
@@ -729,7 +733,8 @@
"Tooltip": { "Tooltip": {
"addEquipment": "New equipment", "addEquipment": "New equipment",
"addSpell": "New spells", "addSpell": "New spells",
"skill": "Skills list" "skill": "Skills list",
"combatProgressionStart": "First attack of combat can succeed on a roll of 1 through this value. Resets to 1 for subsequent attacks."
}, },
"Vulnerability": { "Vulnerability": {
"FIELDS": { "FIELDS": {

View File

@@ -250,6 +250,18 @@ Hooks.on(hookName, (message, html, data) => {
const attackWeaponId = message.rolls[0]?.rollTarget?.weapon?.id || message.rolls[0]?.rollTarget?.weapon?._id const attackWeaponId = message.rolls[0]?.rollTarget?.weapon?.id || message.rolls[0]?.rollTarget?.weapon?._id
const attackRollType = message.rolls[0]?.type const attackRollType = message.rolls[0]?.type
const attackRollKey = message.rolls[0]?.rollTarget?.rollKey const attackRollKey = message.rolls[0]?.rollTarget?.rollKey
const attackD30result = message.rolls[0]?.options?.D30result || null
const attackD30message = message.rolls[0]?.options?.D30message || null
const attackRerollContext = {
rollType: message.rolls[0]?.options?.rollType,
rollTarget: foundry.utils.duplicate(message.rolls[0]?.options?.rollTarget ?? {}),
actorId: message.rolls[0]?.options?.actorId,
actorName: message.rolls[0]?.options?.actorName,
actorImage: message.rolls[0]?.options?.actorImage,
defenderId: combatant.actor?.id || null,
defenderTokenId: tokenId || combatant.token?.id || null,
rollContext: foundry.utils.duplicate(message.rolls[0]?.options?.rollData ?? {})
}
// Préparer le message de demande de défense // Préparer le message de demande de défense
const defenseMsg = { const defenseMsg = {
@@ -262,6 +274,9 @@ Hooks.on(hookName, (message, html, data) => {
attackWeaponId: attackWeaponId, attackWeaponId: attackWeaponId,
attackRollType: attackRollType, attackRollType: attackRollType,
attackRollKey: attackRollKey, attackRollKey: attackRollKey,
attackD30result: attackD30result,
attackD30message: attackD30message,
attackRerollContext: attackRerollContext,
combatantId: combatantId, combatantId: combatantId,
tokenId: tokenId tokenId: tokenId
} }
@@ -317,6 +332,8 @@ Hooks.on(hookName, (message, html, data) => {
const attackKey = button.data("attack-key") const attackKey = button.data("attack-key")
let attackerId = button.data("attacker-id") let attackerId = button.data("attacker-id")
const defenderId = button.data("defender-id") const defenderId = button.data("defender-id")
const defenderTokenId = button.data("defender-token-id") || null
const extraShieldDr = Number(button.data("extra-shield-dr") || 0)
const damageType = button.data("damage-type") const damageType = button.data("damage-type")
const damageFormula = button.data("damage-formula") const damageFormula = button.data("damage-formula")
const damageModifier = button.data("damage-modifier") const damageModifier = button.data("damage-modifier")
@@ -329,9 +346,39 @@ Hooks.on(hookName, (message, html, data) => {
return return
} }
// Pour les sorts, rouler les dés de dégâts avec option bypass DR
if (damageType === "spell" && damageFormula) {
const bypassArmor = await foundry.applications.api.DialogV2.confirm({
window: { title: "Spell Damage" },
classes: ["lethalfantasy"],
content: "<p>Does this spell's damage bypass armor DR?</p>",
yes: { label: "Yes (ignore armor)", icon: "fa-solid fa-wand-magic-sparkles" },
no: { label: "No (apply armor DR)", icon: "fa-solid fa-shield" }
})
const rollOpts = {
type: "spell-damage",
rollType: "spell-damage",
rollName: damageFormula,
isDamage: true,
rollData: { isDamage: true },
bypassArmor: bypassArmor ?? false,
defenderId,
defenderTokenId,
actorId: actor.id,
actorName: actor.name,
actorImage: actor.img
}
const roll = new LethalFantasyRoll(damageFormula, {}, rollOpts)
await roll.evaluate()
roll.options.rollTotal = roll.total
if (game?.dice3d) await game.dice3d.showForRoll(roll, game.user, true)
await roll.toMessage()
return
}
// Pour les boutons de résultat de combat (monster damage) // Pour les boutons de résultat de combat (monster damage)
if (damageType === "monster" && attackKey) { if (damageType === "monster" && attackKey) {
await actor.system.prepareMonsterRoll("monster-damage", attackKey, undefined, undefined, undefined, defenderId) await actor.system.prepareMonsterRoll("monster-damage", attackKey, undefined, undefined, undefined, defenderId, defenderTokenId, extraShieldDr)
return return
} }
@@ -350,7 +397,7 @@ Hooks.on(hookName, (message, html, data) => {
// Lancer les dégâts avec la bonne méthode // Lancer les dégâts avec la bonne méthode
const rollType = damageType === "small" ? "weapon-damage-small" : "weapon-damage-medium" const rollType = damageType === "small" ? "weapon-damage-small" : "weapon-damage-medium"
await actor.prepareRoll(rollType, weaponId, undefined, defenderId) await actor.prepareRoll(rollType, weaponId, undefined, defenderId, defenderTokenId, extraShieldDr)
}) })
// Masquer les boutons de dommages dans les messages de résultat de combat si l'utilisateur n'est pas l'attaquant // Masquer les boutons de dommages dans les messages de résultat de combat si l'utilisateur n'est pas l'attaquant
@@ -377,7 +424,7 @@ Hooks.on("preCreateChatMessage", (message) => {
const rollType = message.rolls[0]?.options?.rollType const rollType = message.rolls[0]?.options?.rollType
// Si c'est un message de défense et qu'on a des données en attente // Si c'est un message de défense et qu'on a des données en attente
if ((rollType === "weapon-defense" || rollType === "monster-defense") && game.lethalFantasy?.nextDefenseData) { if ((rollType === "weapon-defense" || rollType === "monster-defense" || rollType === "save") && game.lethalFantasy?.nextDefenseData) {
// Ajouter les données dans les flags du message // Ajouter les données dans les flags du message
message.updateSource({ message.updateSource({
[`flags.${SYSTEM.id}.attackData`]: game.lethalFantasy.nextDefenseData [`flags.${SYSTEM.id}.attackData`]: game.lethalFantasy.nextDefenseData
@@ -397,7 +444,7 @@ Hooks.on("createChatMessage", async (message) => {
console.log("Defense hook checking message, rollType:", rollType) console.log("Defense hook checking message, rollType:", rollType)
// Vérifier si c'est un message de défense // Vérifier si c'est un message de défense
if (rollType !== "weapon-defense" && rollType !== "monster-defense") return if (rollType !== "weapon-defense" && rollType !== "monster-defense" && rollType !== "save") return
// Récupérer les données d'attaque depuis les flags // Récupérer les données d'attaque depuis les flags
const attackData = message.flags?.[SYSTEM.id]?.attackData const attackData = message.flags?.[SYSTEM.id]?.attackData
@@ -409,8 +456,21 @@ Hooks.on("createChatMessage", async (message) => {
return return
} }
const { attackerId, attackRoll, attackerName, defenderName, attackWeaponId, attackRollType, attackRollKey, defenderId } = attackData const {
attackerId,
attackRoll,
attackerName,
defenderName,
attackWeaponId,
attackRollType,
attackRollKey,
attackD30message,
attackRerollContext,
defenderId,
defenderTokenId
} = attackData
let defenseRoll = message.rolls[0]?.options?.rollTotal || message.rolls[0]?.total || 0 let defenseRoll = message.rolls[0]?.options?.rollTotal || message.rolls[0]?.total || 0
const defenseD30message = message.rolls[0]?.options?.D30message || null
console.log("Processing defense:", { attackRoll, defenseRoll, attackerId, defenderId }) console.log("Processing defense:", { attackRoll, defenseRoll, attackerId, defenderId })
@@ -422,26 +482,180 @@ Hooks.on("createChatMessage", async (message) => {
// Récupérer le défenseur et l'attaquant // Récupérer le défenseur et l'attaquant
const defender = game.actors.get(defenderId) const defender = game.actors.get(defenderId)
const attacker = game.actors.get(attackerId) const attacker = game.actors.get(attackerId)
const defenseRerollContext = {
rollType: message.rolls[0]?.options?.rollType,
rollTarget: foundry.utils.duplicate(message.rolls[0]?.options?.rollTarget ?? {}),
actorId: message.rolls[0]?.options?.actorId,
actorName: message.rolls[0]?.options?.actorName,
actorImage: message.rolls[0]?.options?.actorImage,
defenderId,
defenderTokenId,
rollContext: foundry.utils.duplicate(message.rolls[0]?.options?.rollData ?? {})
}
const isPrimaryController = actor => {
if (!actor) return false
const activePlayerOwners = game.users.filter(u => u.active && !u.isGM && actor.testUserPermission(u, "OWNER"))
if (activePlayerOwners.length > 0) {
return activePlayerOwners[0].id === game.user.id
}
return game.user.isGM
}
const createReactionMessage = async (actorDocument, content) => {
await ChatMessage.create({
content,
speaker: ChatMessage.getSpeaker({ actor: actorDocument })
})
}
// Si le défenseur est un personnage qui perd, proposer Grit/Luck (seulement s'il a des points) // Si le défenseur est un personnage qui perd, proposer Grit/Luck (seulement s'il a des points)
// Seulement si l'utilisateur actuel est le propriétaire du défenseur // Seulement si l'utilisateur actuel est le propriétaire du défenseur
let defenderHandledBonus = false let defenderHandledBonus = false
if (defender?.type === "character" && defenseRoll < attackRoll && !game.user.isGM && defender.isOwner) { let shieldReaction = null
const hasGritOrLuck = (defender.system.grit.current > 0) || (defender.system.luck.current > 0) let shieldBlocked = false
const isSpellOrMiracle = attackRollType === "spell-attack" || attackRollType === "miracle-attack"
if (defender && defenseRoll < attackRoll && isPrimaryController(defender) && !isSpellOrMiracle) {
const shieldData = LethalFantasyUtils.getShieldReactionData(defender)
let canRerollDefense = LethalFantasyUtils.hasD30Reroll(defenseD30message)
let canShieldReact = !!shieldData
if (hasGritOrLuck) { while (defenseRoll < attackRoll) {
const bonusRoll = await LethalFantasyUtils.offerGritLuckBonus( const currentGrit = Number(defender.system?.grit?.current) || 0
defender, const currentLuck = Number(defender.system?.luck?.current) || 0
attackRoll, const buttons = []
defenseRoll,
attackerName, if (currentGrit > 0) {
defenderName buttons.push({
) action: "grit",
if (bonusRoll > 0) { label: `Spend 1 Grit (+1D6) [${currentGrit} left]`,
defenseRoll += bonusRoll icon: "fa-solid fa-fist-raised",
callback: () => "grit"
})
} }
if (currentLuck > 0) {
buttons.push({
action: "luck",
label: `Spend 1 Luck (+1D6) [${currentLuck} left]`,
icon: "fa-solid fa-clover",
callback: () => "luck"
})
} }
buttons.push({
action: "bonusDie",
label: "Add bonus die",
icon: "fa-solid fa-dice",
callback: () => "bonusDie"
})
if (canRerollDefense) {
buttons.push({
action: "rerollDefense",
label: "Re-roll defense",
icon: "fa-solid fa-rotate-right",
callback: () => "rerollDefense"
})
}
if (canShieldReact) {
buttons.push({
action: "shieldReact",
label: `Roll shield (${shieldData.label})`,
icon: "fa-solid fa-shield",
callback: () => "shieldReact"
})
}
buttons.push({
action: "continue",
label: "Continue (no defense bonus)",
icon: "fa-solid fa-forward",
callback: () => "continue"
})
const choice = await foundry.applications.api.DialogV2.wait({
window: { title: "Defense reactions" },
classes: ["lethalfantasy"],
content: `
<div class="grit-luck-dialog">
<div class="combat-status">
<p><strong>${attackerName}</strong> rolled <strong>${attackRoll}</strong></p>
<p><strong>${defenderName}</strong> currently has <strong>${defenseRoll}</strong></p>
${defenseD30message ? `<p class="bonus-info">D30 special: ${defenseD30message}</p>` : ""}
</div>
<p class="offer-text">Choose how to improve the defense before resolving the hit.</p>
</div>
`,
buttons,
rejectClose: false
})
if (!choice || choice === "continue") break
defenderHandledBonus = true defenderHandledBonus = true
if (choice === "grit") {
const bonusRoll = await LethalFantasyUtils.rollBonusDie("1d6", defender, (total) => `<p><strong>${defenderName}</strong> spends 1 Grit and rolls <strong>${total}</strong> for defense.</p>`)
defenseRoll += bonusRoll
await defender.update({ "system.grit.current": currentGrit - 1 })
continue
}
if (choice === "luck") {
const bonusRoll = await LethalFantasyUtils.rollBonusDie("1d6", defender, (total) => `<p><strong>${defenderName}</strong> spends 1 Luck and rolls <strong>${total}</strong> for defense.</p>`)
defenseRoll += bonusRoll
await defender.update({ "system.luck.current": currentLuck - 1 })
continue
}
if (choice === "bonusDie") {
const bonusDie = await LethalFantasyUtils.promptCombatBonusDie(defenderName, "attack", defenseRoll, attackRoll)
if (!bonusDie) continue
const bonusRoll = await LethalFantasyUtils.rollBonusDie(bonusDie, defender, (total, formula) => `<p><strong>${defenderName}</strong> adds <strong>${formula.toUpperCase()}</strong> and rolls <strong>${total}</strong> for defense.</p>`)
defenseRoll += bonusRoll
continue
}
if (choice === "rerollDefense" && canRerollDefense) {
const oldDefenseRoll = defenseRoll
const reroll = await LethalFantasyUtils.rerollConfiguredRoll(defenseRerollContext)
canRerollDefense = false
if (!reroll) continue
defenseRoll = reroll.options?.rollTotal || reroll.total || oldDefenseRoll
await createReactionMessage(defender, `<p><strong>${defenderName}</strong> uses Mulligan and re-rolls defense: <strong>${oldDefenseRoll}</strong> → <strong>${defenseRoll}</strong>.</p>`)
continue
}
if (choice === "shieldReact" && canShieldReact) {
const shieldBonus = await LethalFantasyUtils.rollBonusDie(shieldData.formula, defender)
const newDefenseTotal = defenseRoll + shieldBonus
defenseRoll = newDefenseTotal
canShieldReact = false
if (newDefenseTotal >= attackRoll) {
// Shield roll tied or exceeded the attack — shield blocked
shieldBlocked = true
shieldReaction = {
damageReduction: shieldData.damageReduction,
label: shieldData.label,
bonus: shieldBonus
}
await createReactionMessage(
defender,
`<p><strong>${defenderName}</strong> rolls <strong>${shieldData.label}</strong> and adds <strong>${shieldBonus}</strong> to defense (${newDefenseTotal}${attackRoll}). <strong>Shield blocked the attack!</strong> Both armor DR and shield DR <strong>${shieldData.damageReduction}</strong> will apply to damage.</p>`
)
} else {
// Shield roll not enough — hit still lands, armor DR only
shieldReaction = null
await createReactionMessage(
defender,
`<p><strong>${defenderName}</strong> rolls <strong>${shieldData.label}</strong> and adds <strong>${shieldBonus}</strong> to defense (${newDefenseTotal} < ${attackRoll}). Shield did not block — normal hit, armor DR only.</p>`
)
}
}
}
} }
let attackRollFinal = attackRoll let attackRollFinal = attackRoll
@@ -449,31 +663,98 @@ Hooks.on("createChatMessage", async (message) => {
// Si l'attaquant est un personnage qui perd et a du Grit // Si l'attaquant est un personnage qui perd et a du Grit
// Seulement si l'utilisateur actuel est le propriétaire de l'attaquant (pas le MJ) // Seulement si l'utilisateur actuel est le propriétaire de l'attaquant (pas le MJ)
if (attacker?.type === "character" && attackRollFinal <= defenseRoll && attacker.system.grit.current > 0) { if (!defenderHandledBonus && attacker && attackRollFinal <= defenseRoll && isPrimaryController(attacker)) {
// Vérifier si l'utilisateur est un propriétaire non-GM de l'attaquant let canRerollAttack = LethalFantasyUtils.hasD30Reroll(attackD30message)
const isAttackerOwner = !game.user.isGM && attacker.testUserPermission(game.user, "OWNER")
if (isAttackerOwner) { while (attackRollFinal <= defenseRoll) {
console.log("Offering Grit to attacker") const currentGrit = Number(attacker.system?.grit?.current) || 0
const buttons = []
const attackBonus = await LethalFantasyUtils.offerAttackerGritBonus( if (currentGrit > 0) {
attacker, buttons.push({
attackRollFinal, action: "grit",
defenseRoll, label: `Spend 1 Grit (+1D6) [${currentGrit} left]`,
attackerName, icon: "fa-solid fa-fist-raised",
defenderName callback: () => "grit"
) })
}
buttons.push({
action: "bonusDie",
label: "Add bonus die",
icon: "fa-solid fa-dice",
callback: () => "bonusDie"
})
if (canRerollAttack && attackRerollContext) {
buttons.push({
action: "rerollAttack",
label: "Re-roll attack",
icon: "fa-solid fa-rotate-right",
callback: () => "rerollAttack"
})
}
buttons.push({
action: "continue",
label: "Continue (no attack bonus)",
icon: "fa-solid fa-forward",
callback: () => "continue"
})
const choice = await foundry.applications.api.DialogV2.wait({
window: { title: "Attack reactions" },
classes: ["lethalfantasy"],
content: `
<div class="grit-luck-dialog">
<div class="combat-status">
<p><strong>${attackerName}</strong> currently has <strong>${attackRollFinal}</strong></p>
<p><strong>${defenderName}</strong> rolled <strong>${defenseRoll}</strong></p>
${attackD30message ? `<p class="bonus-info">D30 special: ${attackD30message}</p>` : ""}
</div>
<p class="offer-text">Choose how to improve the attack before resolving the combat result.</p>
</div>
`,
buttons,
rejectClose: false
})
if (!choice || choice === "continue") break
attackRollFinal += attackBonus
attackerHandledBonus = true attackerHandledBonus = true
} else {
console.log("Not attacker owner or is GM, skipping Grit offer") if (choice === "grit") {
const attackBonus = await LethalFantasyUtils.rollBonusDie("1d6", attacker, (total) => `<p><strong>${attackerName}</strong> spends 1 Grit and rolls <strong>${total}</strong> for attack.</p>`)
attackRollFinal += attackBonus
await attacker.update({ "system.grit.current": currentGrit - 1 })
continue
}
if (choice === "bonusDie") {
const bonusDie = await LethalFantasyUtils.promptCombatBonusDie(attackerName, "defense", attackRollFinal, defenseRoll)
if (!bonusDie) continue
const attackBonus = await LethalFantasyUtils.rollBonusDie(bonusDie, attacker, (total, formula) => `<p><strong>${attackerName}</strong> adds <strong>${formula.toUpperCase()}</strong> and rolls <strong>${total}</strong> for attack.</p>`)
attackRollFinal += attackBonus
continue
}
if (choice === "rerollAttack" && canRerollAttack && attackRerollContext) {
const oldAttackRoll = attackRollFinal
const reroll = await LethalFantasyUtils.rerollConfiguredRoll(attackRerollContext)
canRerollAttack = false
if (!reroll) continue
attackRollFinal = reroll.options?.rollTotal || reroll.total || oldAttackRoll
await createReactionMessage(attacker, `<p><strong>${attackerName}</strong> uses Mulligan and re-rolls attack: <strong>${oldAttackRoll}</strong> → <strong>${attackRollFinal}</strong>.</p>`)
} }
} }
}
const shieldDamageReduction = shieldBlocked ? shieldReaction.damageReduction : 0
const outcome = shieldBlocked ? "shielded-hit" : (attackRollFinal > defenseRoll ? "hit" : "miss")
// Créer le message de comparaison - uniquement par le client qui a géré le dernier bonus // Créer le message de comparaison - uniquement par le client qui a géré le dernier bonus
// Priorité: attaquant si il a géré le bonus, sinon défenseur si il a géré le bonus, sinon défenseur // Priorité: attaquant si il a géré le bonus, sinon défenseur si il a géré le bonus, sinon défenseur
const shouldCreateMessage = attackerHandledBonus || (!attackerHandledBonus && defenderHandledBonus) || (!attackerHandledBonus && !defenderHandledBonus && defender.isOwner) const shouldCreateMessage = attackerHandledBonus || (!attackerHandledBonus && defenderHandledBonus) || (!attackerHandledBonus && !defenderHandledBonus && isPrimaryController(defender))
if (shouldCreateMessage) { if (shouldCreateMessage) {
console.log("Creating comparison message", { attackerHandledBonus, defenderHandledBonus, isDefenderOwner: defender.isOwner }) console.log("Creating comparison message", { attackerHandledBonus, defenderHandledBonus, isDefenderOwner: defender.isOwner })
@@ -487,7 +768,10 @@ Hooks.on("createChatMessage", async (message) => {
attackRollKey, attackRollKey,
defenderName, defenderName,
defenderId, defenderId,
defenseRoll defenderTokenId,
defenseRoll,
outcome,
shieldDamageReduction
}) })
} else { } else {
console.log("Skipping message creation", { attackerHandledBonus, defenderHandledBonus }) console.log("Skipping message creation", { attackerHandledBonus, defenderHandledBonus })
@@ -512,7 +796,7 @@ Hooks.on("createChatMessage", async (message) => {
// 1. Si l'attaquant a un propriétaire joueur, seul ce joueur applique // 1. Si l'attaquant a un propriétaire joueur, seul ce joueur applique
// 2. Si l'attaquant n'a que le MJ comme propriétaire (monstre), seul le MJ applique // 2. Si l'attaquant n'a que le MJ comme propriétaire (monstre), seul le MJ applique
const attackerOwners = attacker ? game.users.filter(u => const attackerOwners = attacker ? game.users.filter(u =>
!u.isGM && attacker.testUserPermission(u, "OWNER") u.active && !u.isGM && attacker.testUserPermission(u, "OWNER")
) : [] ) : []
let shouldApplyDamage = false let shouldApplyDamage = false
@@ -549,14 +833,19 @@ Hooks.on("createChatMessage", async (message) => {
const attackerName = message.rolls[0]?.options?.actorName || "Unknown Attacker" const attackerName = message.rolls[0]?.options?.actorName || "Unknown Attacker"
// Calculer les DR // Calculer les DR
const armorDR = defender.computeDamageReduction() || 0 const bypassArmor = message.rolls[0]?.options?.bypassArmor || false
const finalDamage = Math.max(0, damageTotal - armorDR) const armorDR = bypassArmor ? 0 : (defender.computeDamageReduction() || 0)
const extraShieldDr = Number(message.rolls[0]?.options?.extraShieldDr) || 0
const totalDR = armorDR + extraShieldDr
const finalDamage = Math.max(0, damageTotal - totalDR)
// For unlinked tokens (default for monsters), we need the specific token actor, not the base // Prefer the token ID stored in roll options (set at attack time when the exact token is known).
// world actor — otherwise applyDamage would modify the base actor and affect every unlinked // For unlinked tokens (default for monsters), this ensures we target the right instance even
// copy of that monster. Prefer the combatant actor, fall back to canvas scan. // when multiple unlinked copies of the same monster type are in combat.
const rollDefenderTokenId = message.rolls[0]?.options?.defenderTokenId
const defenderCombatant = game.combat?.combatants?.find(c => c.actorId === defender.id) const defenderCombatant = game.combat?.combatants?.find(c => c.actorId === defender.id)
const defenderTokenId = defenderCombatant?.token?.id const defenderTokenId = rollDefenderTokenId
?? defenderCombatant?.token?.id
?? canvas.tokens?.placeables?.find(t => t.actor?.id === defender.id)?.id ?? canvas.tokens?.placeables?.find(t => t.actor?.id === defender.id)?.id
?? null ?? null
@@ -564,7 +853,11 @@ Hooks.on("createChatMessage", async (message) => {
// route the HP update to the GM via socket. The confirmation message is still created here // route the HP update to the GM via socket. The confirmation message is still created here
// since all users can create chat messages. // since all users can create chat messages.
if (defender.isOwner) { if (defender.isOwner) {
const tokenActor = defenderCombatant?.actor ?? defender // Resolve the token actor: prefer lookup by token ID (exact match for unlinked monsters),
// fall back to combatant actor, then base world actor.
const tokenActor = (defenderTokenId
? canvas.tokens?.placeables?.find(t => t.id === defenderTokenId)?.actor
: defenderCombatant?.actor) ?? defender
await tokenActor.applyDamage(-finalDamage) await tokenActor.applyDamage(-finalDamage)
} else { } else {
game.socket.emit(`system.${SYSTEM.id}`, { type: "applyDamage", actorId: defender.id, tokenId: defenderTokenId, damage: -finalDamage }) game.socket.emit(`system.${SYSTEM.id}`, { type: "applyDamage", actorId: defender.id, tokenId: defenderTokenId, damage: -finalDamage })
@@ -576,7 +869,7 @@ Hooks.on("createChatMessage", async (message) => {
{ {
targetName: defender.name, targetName: defender.name,
damage: finalDamage, damage: finalDamage,
drText: armorDR > 0 ? `Armor DR: ${armorDR}` : "", drText: bypassArmor ? "Armor DR bypassed (spell)" : (totalDR > 0 ? `Armor DR: ${armorDR}${extraShieldDr > 0 ? ` + Shield DR: ${extraShieldDr}` : ""}` : ""),
weaponName: weaponName, weaponName: weaponName,
attackerName: attackerName, attackerName: attackerName,
rawDamage: damageTotal rawDamage: damageTotal

View File

@@ -100,6 +100,14 @@ export class LethalFantasyCombat extends Combat {
return this.turns = turns; return this.turns = turns;
} }
async startCombat() {
this._playCombatSound("startEncounter")
const updateData = { round: 0, turn: 0 }
Hooks.callAll("combatStart", this, updateData)
await this.update(updateData)
return this
}
async rollInitiative(ids, options) { async rollInitiative(ids, options) {
console.log("%%%%%%%%% Roll Initiative", ids, options); console.log("%%%%%%%%% Roll Initiative", ids, options);
@@ -110,13 +118,12 @@ export class LethalFantasyCombat extends Combat {
let updates = []; let updates = [];
for (let cId of ids) { for (let cId of ids) {
const c = this.combatants.get(cId); const c = this.combatants.get(cId);
let user = game.users.find(u => u.active && u.character && u.character.id === c.actor.id); const playerOwner = game.users.find(u => u.active && !u.isGM && u.character?.id === c.actor.id);
if (user?.hasPlayerOwner) { if (game.user.isGM && playerOwner) {
console.log("Rolling initiative for", c.actor.name); console.log("Rolling initiative for", c.actor.name);
game.socket.emit(`system.${SYSTEM.id}`, { type: "rollInitiative", actorId: c.actor.id, combatId: this.id, combatantId: c.id }); game.socket.emit(`system.${SYSTEM.id}`, { type: "rollInitiative", userId: playerOwner.id, actorId: c.actor.id, combatId: this.id, combatantId: c.id });
} else { } else {
user = game.users.find(u => u.active && u.isGM); await c.actor.system.rollInitiative(this.id, c.id);
c.actor.system.rollInitiative(this.id, c.id);
} }
} }
@@ -196,12 +203,11 @@ export class LethalFantasyCombat extends Combat {
for (let c of this.combatants) { for (let c of this.combatants) {
if (nextRound >= c.initiative) { if (nextRound >= c.initiative) {
let user = game.users.find(u => u.active && u.character && u.character.id === c.actor.id); const playerOwner = game.users.find(u => u.active && !u.isGM && u.character?.id === c.actor.id);
if (user?.hasPlayerOwner) { if (game.user.isGM && playerOwner) {
game.socket.emit(`system.${SYSTEM.id}`, { type: "rollProgressionDice", progressionCount: c.system.progressionCount + 1, actorId: c.actor.id, combatId: this.id, combatantId: c.id }); game.socket.emit(`system.${SYSTEM.id}`, { type: "rollProgressionDice", userId: playerOwner.id, progressionCount: c.system.progressionCount + 1, actorId: c.actor.id, combatId: this.id, combatantId: c.id });
} else { } else {
user = game.users.find(u => u.active && u.isGM); await c.actor.system.rollProgressionDice(this.id, c.id);
c.actor.system.rollProgressionDice(this.id, c.id);
} }
} }
} }

View File

@@ -153,7 +153,7 @@ export default class LethalFantasyActor extends Actor {
} }
/* *************************************************/ /* *************************************************/
async prepareRoll(rollType, rollKey, rollDice, defenderId) { async prepareRoll(rollType, rollKey, rollDice, defenderId, defenderTokenId, extraShieldDr = 0) {
console.log("Preparing roll", rollType, rollKey, rollDice, defenderId) console.log("Preparing roll", rollType, rollKey, rollDice, defenderId)
let rollTarget let rollTarget
switch (rollType) { switch (rollType) {
@@ -268,7 +268,7 @@ export default class LethalFantasyActor extends Actor {
rollTarget.magicUser = this.system.biodata.magicUser rollTarget.magicUser = this.system.biodata.magicUser
rollTarget.actorModifiers = foundry.utils.duplicate(this.system.modifiers) rollTarget.actorModifiers = foundry.utils.duplicate(this.system.modifiers)
rollTarget.actorLevel = this.system.biodata.level rollTarget.actorLevel = this.system.biodata.level
await this.system.roll(rollType, rollTarget, defenderId) await this.system.roll(rollType, rollTarget, defenderId, defenderTokenId, extraShieldDr)
} }
} }

View File

@@ -346,11 +346,25 @@ export default class LethalFantasyRoll extends Roll {
favor: "none", favor: "none",
targetName targetName
} }
let rollContext
if (options.rollContext) {
rollContext = foundry.utils.duplicate(options.rollContext)
hasGrantedDice = !!rollContext.hasGrantedDice
pointBlank = !!rollContext.pointBlank
beyondSkill = !!rollContext.beyondSkill
letItFly = !!rollContext.letItFly
saveSpell = !!rollContext.saveSpell
rollContext.visibility ||= rollContext.rollMode || game.settings.get("core", "rollMode")
rollContext.modifier ||= modifier
rollContext.favor ||= "none"
rollContext.changeDice ||= `${dice}`
rollContext.attackerAim ||= "0"
} else {
const content = await foundry.applications.handlebars.renderTemplate("systems/fvtt-lethal-fantasy/templates/roll-dialog.hbs", dialogContext) const content = await foundry.applications.handlebars.renderTemplate("systems/fvtt-lethal-fantasy/templates/roll-dialog.hbs", dialogContext)
let position = game.user.getFlag(SYSTEM.id, "roll-dialog-pos") || { top: -1, left: -1 } let position = game.user.getFlag(SYSTEM.id, "roll-dialog-pos") || { top: -1, left: -1 }
const label = game.i18n.localize("LETHALFANTASY.Roll.roll") const label = game.i18n.localize("LETHALFANTASY.Roll.roll")
const rollContext = await foundry.applications.api.DialogV2.wait({ rollContext = await foundry.applications.api.DialogV2.wait({
window: { title: "Roll dialog" }, window: { title: "Roll dialog" },
classes: ["lethalfantasy"], classes: ["lethalfantasy"],
content, content,
@@ -391,13 +405,14 @@ export default class LethalFantasyRoll extends Roll {
let token = canvas.tokens?.get(tokenId) let token = canvas.tokens?.get(tokenId)
if (token) { if (token) {
canvas.animatePan({ x: token.x, y: token.y, duration: 200 }) canvas.animatePan({ x: token.x, y: token.y, duration: 200 })
canvas.tokens.releaseAll(); canvas.tokens.releaseAll()
token.control({ releaseOthers: true }); token.control({ releaseOthers: true })
} }
} }
}, },
rejectClose: false // Click on Close button will not launch an error rejectClose: false // Click on Close button will not launch an error
}) })
}
// If the user cancels the dialog, exit // If the user cancels the dialog, exit
if (rollContext === null) return if (rollContext === null) return
@@ -547,6 +562,10 @@ export default class LethalFantasyRoll extends Roll {
rollFavor = null rollFavor = null
} }
if (options.forceNoD30) {
hasD30 = false
}
if (hasD30) { if (hasD30) {
let rollD30 = await new Roll("1D30").evaluate() let rollD30 = await new Roll("1D30").evaluate()
if (game?.dice3d) { if (game?.dice3d) {
@@ -620,6 +639,8 @@ export default class LethalFantasyRoll extends Roll {
rollBase.options.badResult = badResult rollBase.options.badResult = badResult
rollBase.options.rollData = foundry.utils.duplicate(rollData) rollBase.options.rollData = foundry.utils.duplicate(rollData)
rollBase.options.defenderId = options.defenderId rollBase.options.defenderId = options.defenderId
rollBase.options.defenderTokenId = options.defenderTokenId
rollBase.options.extraShieldDr = options.extraShieldDr || 0
/** /**
* A hook event that fires after the roll has been made. * A hook event that fires after the roll has been made.
@@ -692,13 +713,13 @@ export default class LethalFantasyRoll extends Roll {
let initRoll = new Roll(formula, options.data) let initRoll = new Roll(formula, options.data)
await initRoll.evaluate() await initRoll.evaluate()
let msg = await initRoll.toMessage({ flavor: `Initiative for ${options.actorName}` }, { rollMode: rollContext.visibility }) let msg = await initRoll.toMessage({ flavor: `Initiative for ${options.actorName}` }, { rollMode: rollContext.visibility })
if (game?.dice3d) { if (game?.dice3d && initRoll.dice?.length) {
await game.dice3d.waitFor3DAnimationByMessageID(msg.id) await game.dice3d.waitFor3DAnimationByMessageID(msg.id)
} }
if (options.combatId && options.combatantId) { if (options.combatId && options.combatantId) {
let combat = game.combats.get(options.combatId) let combat = game.combats.get(options.combatId)
await combat.updateEmbeddedDocuments("Combatant", [{ _id: options.combatantId, initiative: initRoll.total, 'system.progressionCount': 0 }]) await combat.updateEmbeddedDocuments("Combatant", [{ _id: options.combatantId, initiative: initRoll.total, 'system.progressionCount': 0, [`flags.${SYSTEM.id}.firstActionTaken`]: false }])
} }
} }
@@ -835,7 +856,11 @@ export default class LethalFantasyRoll extends Roll {
let selectedItem = combatant.actor.items.find(i => i.id === selectedChoice) let selectedItem = combatant.actor.items.find(i => i.id === selectedChoice)
// Setup flag for combat action usage // Setup flag for combat action usage
let actionItem = foundry.utils.duplicate(selectedItem) let actionItem = foundry.utils.duplicate(selectedItem)
actionItem.progressionCount = 1 // First action of this combat: use the class-based starting threshold;
// all subsequent actions reset to 1 (normal progression).
const firstActionTaken = combatant.getFlag(SYSTEM.id, "firstActionTaken")
actionItem.progressionCount = firstActionTaken ? 1 : (combatant.actor.system.combat?.combatProgressionStart ?? 1)
if (!firstActionTaken) await combatant.setFlag(SYSTEM.id, "firstActionTaken", true)
actionItem.rangedMode = rangedMode actionItem.rangedMode = rangedMode
actionItem.castingTime = 1 actionItem.castingTime = 1
actionItem.spellStatus = "castingTime" actionItem.spellStatus = "castingTime"
@@ -1291,7 +1316,7 @@ export default class LethalFantasyRoll extends Roll {
* @returns {Promise} - A promise that resolves when the message is created. * @returns {Promise} - A promise that resolves when the message is created.
*/ */
async toMessage(messageData = {}, { rollMode, create = true } = {}) { async toMessage(messageData = {}, { rollMode, create = true } = {}) {
super.toMessage( return await super.toMessage(
{ {
isSave: this.isSave, isSave: this.isSave,
isChallenge: this.isChallenge, isChallenge: this.isChallenge,
@@ -1308,7 +1333,7 @@ export default class LethalFantasyRoll extends Roll {
rollData: this.rollData, rollData: this.rollData,
...messageData, ...messageData,
}, },
{ rollMode: rollMode }, { rollMode, create },
) )
} }

View File

@@ -155,6 +155,7 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
defenseBonus: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }), defenseBonus: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
damageModifier: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }), damageModifier: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
armorHitPoints: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }), armorHitPoints: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
combatProgressionStart: new fields.NumberField({ ...requiredInteger, initial: 1, min: 1 }),
}) })
const moneyField = (label) => { const moneyField = (label) => {
@@ -273,7 +274,7 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
* @param {"="|"+"|"++"|"-"|"--"} rollAdvantage If there is an avantage (+), a disadvantage (-), a double advantage (++), a double disadvantage (--) or a normal roll (=). * @param {"="|"+"|"++"|"-"|"--"} rollAdvantage If there is an avantage (+), a disadvantage (-), a double advantage (++), a double disadvantage (--) or a normal roll (=).
* @returns {Promise<null>} - A promise that resolves to null if the roll is cancelled. * @returns {Promise<null>} - A promise that resolves to null if the roll is cancelled.
*/ */
async roll(rollType, rollTarget, defenderId) { async roll(rollType, rollTarget, defenderId, defenderTokenId, extraShieldDr = 0) {
const hasTarget = false const hasTarget = false
let roll = await LethalFantasyRoll.prompt({ let roll = await LethalFantasyRoll.prompt({
rollType, rollType,
@@ -283,7 +284,9 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
actorImage: this.parent.img, actorImage: this.parent.img,
hasTarget, hasTarget,
target: false, target: false,
defenderId defenderId,
defenderTokenId,
extraShieldDr
}) })
if (!roll) return null if (!roll) return null

View File

@@ -141,7 +141,7 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
* @param {"="|"+"|"++"|"-"|"--"} rollAdvantage If there is an avantage (+), a disadvantage (-), a double advantage (++), a double disadvantage (--) or a normal roll (=). * @param {"="|"+"|"++"|"-"|"--"} rollAdvantage If there is an avantage (+), a disadvantage (-), a double advantage (++), a double disadvantage (--) or a normal roll (=).
* @returns {Promise<null>} - A promise that resolves to null if the roll is cancelled. * @returns {Promise<null>} - A promise that resolves to null if the roll is cancelled.
*/ */
async roll(rollType, rollTarget, defenderId = undefined) { async roll(rollType, rollTarget, defenderId = undefined, defenderTokenId = undefined, extraShieldDr = 0) {
const hasTarget = false const hasTarget = false
let roll = await LethalFantasyRoll.prompt({ let roll = await LethalFantasyRoll.prompt({
rollType, rollType,
@@ -151,14 +151,16 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
actorImage: this.parent.img, actorImage: this.parent.img,
hasTarget, hasTarget,
target: false, target: false,
defenderId defenderId,
defenderTokenId,
extraShieldDr
}) })
if (!roll) return null if (!roll) return null
await roll.toMessage({}, { rollMode: roll.options.rollMode }) await roll.toMessage({}, { rollMode: roll.options.rollMode })
} }
async prepareMonsterRoll(rollType, rollKey, rollDice = undefined, tokenId = undefined, damageModifier = undefined, defenderId = undefined) { async prepareMonsterRoll(rollType, rollKey, rollDice = undefined, tokenId = undefined, damageModifier = undefined, defenderId = undefined, defenderTokenId = undefined, extraShieldDr = 0) {
let rollTarget let rollTarget
switch (rollType) { switch (rollType) {
case "monster-attack": case "monster-attack":
@@ -254,7 +256,7 @@ export default class LethalFantasyMonster extends foundry.abstract.TypeDataModel
if (rollTarget) { if (rollTarget) {
rollTarget.tokenId = tokenId rollTarget.tokenId = tokenId
console.log(rollTarget) console.log(rollTarget)
await this.roll(rollType, rollTarget, defenderId) await this.roll(rollType, rollTarget, defenderId, defenderTokenId, extraShieldDr)
} }
} }

View File

@@ -39,6 +39,7 @@ export default class LethalFantasySpell extends foundry.abstract.TypeDataModel {
schema.attackRoll = new fields.StringField({ required: true, initial: "" }) schema.attackRoll = new fields.StringField({ required: true, initial: "" })
schema.powerRoll = new fields.StringField({ required: true, initial: "" }) schema.powerRoll = new fields.StringField({ required: true, initial: "" })
schema.damageDice = new fields.StringField({ required: false, initial: "" })
return schema return schema
} }

View File

@@ -124,10 +124,12 @@ export default class LethalFantasyUtils {
} }
break break
case "rollInitiative": case "rollInitiative":
if (msg.userId && msg.userId !== game.user.id) break
actor = game.actors.get(msg.actorId) actor = game.actors.get(msg.actorId)
actor.system.rollInitiative(msg.combatId, msg.combatantId) actor.system.rollInitiative(msg.combatId, msg.combatantId)
break break
case "rollProgressionDice": case "rollProgressionDice":
if (msg.userId && msg.userId !== game.user.id) break
actor = game.actors.get(msg.actorId) actor = game.actors.get(msg.actorId)
actor.system.rollProgressionDice(msg.combatId, msg.combatantId, msg.rollProgressionCount) actor.system.rollProgressionDice(msg.combatId, msg.combatantId, msg.rollProgressionCount)
break break
@@ -190,6 +192,9 @@ export default class LethalFantasyUtils {
const attackWeaponId = msg.attackWeaponId const attackWeaponId = msg.attackWeaponId
const attackRollType = msg.attackRollType const attackRollType = msg.attackRollType
const attackRollKey = msg.attackRollKey const attackRollKey = msg.attackRollKey
const attackD30result = msg.attackD30result
const attackD30message = msg.attackD30message
const attackRerollContext = msg.attackRerollContext
const combatantId = msg.combatantId const combatantId = msg.combatantId
const tokenId = msg.tokenId const tokenId = msg.tokenId
@@ -216,8 +221,84 @@ export default class LethalFantasyUtils {
return return
} }
// Resolve the specific token ID now while we still have combatant/token context.
// This is passed through to the damage roll so the GM-side socket handler can find the
// correct synthetic actor for unlinked tokens (avoids wrong-instance damage with multiple
// unlinked copies of the same monster).
const defenderTokenId = (() => {
if (game.combat && combatantId) {
const cbt = game.combat.combatants.get(combatantId)
if (cbt?.token?.id) return cbt.token.id
}
return tokenId ?? canvas.tokens?.placeables?.find(t => t.actor?.id === defender.id)?.id ?? null
})()
const isMonster = defender.type === "monster" const isMonster = defender.type === "monster"
// Spell/miracle attacks use saving throws instead of weapon defense
const isSpellAttack = attackRollType === "spell-attack" || attackRollType === "miracle-attack"
if (isSpellAttack) {
const savesConfig = isMonster ? SYSTEM.MONSTER_SAVES : SYSTEM.SAVES
const combatSaves = ["will", "dodge", "toughness"]
const savesHTML = Object.values(savesConfig)
.filter(s => combatSaves.includes(s.id))
.map(s => `<option value="${s.id}">${game.i18n.localize(s.label)}</option>`)
.join("")
const content = `
<div class="defense-request-dialog">
<div class="attack-info">
<p><strong>${attackerName}</strong> targets <strong>${defenderName}</strong> with <strong>${weaponName}</strong>!</p>
<p>Attack roll: <strong>${attackRoll}</strong></p>
</div>
<div class="weapon-selection">
<label for="save-type">Choose saving throw:</label>
<select id="save-type" name="saveKey" style="width: 100%; margin-top: 8px;">
${savesHTML}
</select>
</div>
</div>
`
const result = await foundry.applications.api.DialogV2.wait({
window: { title: "Saving Throw vs Spell" },
classes: ["lethalfantasy"],
content,
buttons: [
{
label: "Roll Save",
icon: "fa-solid fa-person-running",
callback: (event, button) => button.form.elements.saveKey.value,
},
],
rejectClose: false
})
if (result) {
game.lethalFantasy = game.lethalFantasy || {}
game.lethalFantasy.nextDefenseData = {
attackerId,
attackRoll,
attackerName,
defenderName,
attackWeaponId,
attackRollType,
attackRollKey,
attackD30result,
attackD30message,
attackRerollContext,
defenderId: defender.id,
defenderTokenId
}
if (isMonster) {
defender.system.prepareMonsterRoll("save", result)
} else {
defender.prepareRoll("save", result)
}
}
return
}
// Pour les monstres, récupérer les attaques activées // Pour les monstres, récupérer les attaques activées
if (isMonster) { if (isMonster) {
const enabledAttacks = Object.entries(defender.system.attacks).filter(([key, attack]) => attack.enabled) const enabledAttacks = Object.entries(defender.system.attacks).filter(([key, attack]) => attack.enabled)
@@ -277,11 +358,13 @@ export default class LethalFantasyUtils {
attackWeaponId, attackWeaponId,
attackRollType, attackRollType,
attackRollKey, attackRollKey,
defenderId: defender.id attackD30result,
attackD30message,
attackRerollContext,
defenderId: defender.id,
defenderTokenId
} }
console.log("Storing defense data for monster:", defender.id)
defender.system.prepareMonsterRoll("monster-defense", result) defender.system.prepareMonsterRoll("monster-defense", result)
} }
return return
@@ -347,7 +430,11 @@ export default class LethalFantasyUtils {
attackWeaponId, attackWeaponId,
attackRollType, attackRollType,
attackRollKey, attackRollKey,
defenderId: defender.id attackD30result,
attackD30message,
attackRerollContext,
defenderId: defender.id,
defenderTokenId
} }
console.log("Storing defense data for character:", defender.id) console.log("Storing defense data for character:", defender.id)
@@ -356,6 +443,119 @@ export default class LethalFantasyUtils {
} }
} }
/* -------------------------------------------- */
static hasD30Reroll(d30Message) {
return /mulligan|re-?roll/i.test(d30Message || "")
}
/* -------------------------------------------- */
static getCombatBonusDiceChoices() {
return ["1d4", "1d6", "1d8", "1d10", "1d12", "1d20", "1d20e"]
}
/* -------------------------------------------- */
static getShieldReactionData(actor) {
if (!actor) return null
if (actor.type === "monster") {
const formula = actor.system.combat?.shieldDefenseDice
const damageReduction = actor.getShieldDR()
if (!formula || damageReduction <= 0) return null
return {
label: game.i18n.localize("LETHALFANTASY.Label.shieldDefenseDice"),
formula,
damageReduction
}
}
const equippedShields = actor.items.filter(item => item.type === "shield" && item.system.equipped)
if (equippedShields.length === 0) return null
const shield = equippedShields[0]
return {
label: shield.name,
formula: shield.system.defense,
damageReduction: actor.getShieldDR(),
shieldId: shield.id
}
}
/* -------------------------------------------- */
static async promptCombatBonusDie(actorName, sideLabel, currentRoll, opposingRoll) {
const choices = this.getCombatBonusDiceChoices()
const optionsHtml = choices.map(choice => `<option value="${choice}">${choice.toUpperCase()}</option>`).join("")
const content = `
<div class="grit-luck-dialog">
<div class="combat-status">
<p><strong>${actorName}</strong> currently has <strong>${currentRoll}</strong></p>
<p>Opposing ${sideLabel} roll: <strong>${opposingRoll}</strong></p>
</div>
<div class="weapon-selection">
<label for="bonus-die">Choose a bonus die:</label>
<select id="bonus-die" name="bonusDie" style="width: 100%; margin-top: 8px;">
${optionsHtml}
</select>
</div>
</div>
`
return await foundry.applications.api.DialogV2.wait({
window: { title: "Add Bonus Die" },
classes: ["lethalfantasy"],
content,
buttons: [
{
action: "roll",
label: "Roll Bonus Die",
icon: "fa-solid fa-dice",
callback: (event, button) => {
const sel = button.form?.elements?.bonusDie ?? button.closest("form")?.elements?.bonusDie
return sel?.value ?? choices[0]
}
},
{
action: "cancel",
label: "Cancel",
icon: "fa-solid fa-xmark",
callback: () => null
}
],
rejectClose: false
})
}
/* -------------------------------------------- */
static async rollBonusDie(formula, actor, messageContent) {
const roll = new Roll(formula)
await roll.evaluate()
if (game?.dice3d) {
await game.dice3d.showForRoll(roll, game.user, true)
}
if (messageContent) {
await ChatMessage.create({
content: messageContent(roll.total, formula),
speaker: ChatMessage.getSpeaker({ actor })
})
}
return roll.total
}
/* -------------------------------------------- */
static async rerollConfiguredRoll(rerollContext = {}) {
const RollClass = CONFIG.Dice.rolls.find(r => r.name === "LethalFantasyRoll")
if (typeof RollClass?.prompt !== "function") {
ui.notifications.error("Lethal Fantasy roll class not available for reroll")
return null
}
return await RollClass.prompt({
...foundry.utils.duplicate(rerollContext),
rollContext: foundry.utils.duplicate(rerollContext.rollContext || {}),
forceNoD30: true,
hasTarget: false,
target: false
})
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static async offerGritLuckBonus(defender, attackRoll, currentDefenseRoll, attackerName, defenderName) { static async offerGritLuckBonus(defender, attackRoll, currentDefenseRoll, attackerName, defenderName) {
let totalBonus = 0 let totalBonus = 0
@@ -526,7 +726,8 @@ export default class LethalFantasyUtils {
/* -------------------------------------------- */ /* -------------------------------------------- */
static async compareAttackDefense(data) { static async compareAttackDefense(data) {
console.log("compareAttackDefense called with:", data) console.log("compareAttackDefense called with:", data)
const isAttackWin = data.attackRoll > data.defenseRoll const outcome = data.outcome || (data.attackRoll > data.defenseRoll ? "hit" : "miss")
const isAttackWin = outcome !== "miss"
console.log("isAttackWin:", isAttackWin, "attackRoll:", data.attackRoll, "defenseRoll:", data.defenseRoll) console.log("isAttackWin:", isAttackWin, "attackRoll:", data.attackRoll, "defenseRoll:", data.defenseRoll)
let damageButton = "" let damageButton = ""
@@ -536,10 +737,10 @@ export default class LethalFantasyUtils {
if (data.attackRollType === "weapon-attack") { if (data.attackRollType === "weapon-attack") {
damageButton = ` damageButton = `
<div class="attack-result-damage"> <div class="attack-result-damage">
<button class="roll-damage-btn" data-attacker-id="${data.attackerId}" data-defender-id="${data.defenderId}" data-weapon-id="${data.attackWeaponId}" data-damage-type="small"> <button class="roll-damage-btn" data-attacker-id="${data.attackerId}" data-defender-id="${data.defenderId}" data-defender-token-id="${data.defenderTokenId || ""}" data-extra-shield-dr="${data.shieldDamageReduction || 0}" data-weapon-id="${data.attackWeaponId}" data-damage-type="small">
<i class="fa-solid fa-dice-d6"></i> Damage (Small) <i class="fa-solid fa-dice-d6"></i> Damage (Small)
</button> </button>
<button class="roll-damage-btn" data-attacker-id="${data.attackerId}" data-defender-id="${data.defenderId}" data-weapon-id="${data.attackWeaponId}" data-damage-type="medium"> <button class="roll-damage-btn" data-attacker-id="${data.attackerId}" data-defender-id="${data.defenderId}" data-defender-token-id="${data.defenderTokenId || ""}" data-extra-shield-dr="${data.shieldDamageReduction || 0}" data-weapon-id="${data.attackWeaponId}" data-damage-type="medium">
<i class="fa-solid fa-dice-d20"></i> Damage (Medium) <i class="fa-solid fa-dice-d20"></i> Damage (Medium)
</button> </button>
</div> </div>
@@ -547,11 +748,29 @@ export default class LethalFantasyUtils {
} else if (data.attackRollType === "monster-attack") { } else if (data.attackRollType === "monster-attack") {
damageButton = ` damageButton = `
<div class="attack-result-damage"> <div class="attack-result-damage">
<button class="roll-damage-btn" data-attacker-id="${data.attackerId}" data-defender-id="${data.defenderId}" data-attack-key="${data.attackRollKey}" data-damage-type="monster"> <button class="roll-damage-btn" data-attacker-id="${data.attackerId}" data-defender-id="${data.defenderId}" data-defender-token-id="${data.defenderTokenId || ""}" data-extra-shield-dr="${data.shieldDamageReduction || 0}" data-attack-key="${data.attackRollKey}" data-damage-type="monster">
<i class="fa-solid fa-burst"></i> Damage <i class="fa-solid fa-burst"></i> Damage
</button> </button>
</div> </div>
` `
} 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>
`
}
} }
} }
@@ -576,9 +795,11 @@ export default class LethalFantasyUtils {
</div> </div>
</div> </div>
<div class="combat-result-text"> <div class="combat-result-text">
${isAttackWin ? ${outcome === "shielded-hit"
`<i class="fa-solid fa-circle-check"></i> <strong>${data.attackerName}</strong> hits <strong>${data.defenderName}</strong>!` : ? `<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-halved"></i> <strong>${data.defenderName}</strong> parries the attack!` : 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!`
} }
</div> </div>
${damageButton} ${damageButton}

View File

@@ -1 +1 @@
MANIFEST-000539 MANIFEST-000559

View File

@@ -1,8 +1,8 @@
2026/02/06-21:03:10.117032 7f71b6ffd6c0 Recovering log #537 2026/04/14-20:54:14.172569 7fc1dafbf6c0 Recovering log #557
2026/02/06-21:03:10.127068 7f71b6ffd6c0 Delete type=3 #535 2026/04/14-20:54:14.184089 7fc1dafbf6c0 Delete type=3 #555
2026/02/06-21:03:10.127128 7f71b6ffd6c0 Delete type=0 #537 2026/04/14-20:54:14.184186 7fc1dafbf6c0 Delete type=0 #557
2026/02/06-21:51:23.216143 7f71b67fc6c0 Level-0 table #542: started 2026/04/14-21:31:09.240081 7fc1d8fbb6c0 Level-0 table #562: started
2026/02/06-21:51:23.216190 7f71b67fc6c0 Level-0 table #542: 0 bytes OK 2026/04/14-21:31:09.240104 7fc1d8fbb6c0 Level-0 table #562: 0 bytes OK
2026/02/06-21:51:23.251149 7f71b67fc6c0 Delete type=0 #540 2026/04/14-21:31:09.273756 7fc1d8fbb6c0 Delete type=0 #560
2026/02/06-21:51:23.327713 7f71b67fc6c0 Manual compaction at level-0 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end) 2026/04/14-21:31:09.274050 7fc1d8fbb6c0 Manual compaction at level-0 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end)
2026/02/06-21:51:23.327750 7f71b67fc6c0 Manual compaction at level-1 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end) 2026/04/14-21:31:09.274107 7fc1d8fbb6c0 Manual compaction at level-1 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end)

View File

@@ -1,8 +1,8 @@
2026/02/04-08:49:16.805619 7f3bddbff6c0 Recovering log #533 2026/04/12-10:10:03.851531 7f20ed3fd6c0 Recovering log #553
2026/02/04-08:49:16.866468 7f3bddbff6c0 Delete type=3 #531 2026/04/12-10:10:03.861282 7f20ed3fd6c0 Delete type=3 #551
2026/02/04-08:49:16.866605 7f3bddbff6c0 Delete type=0 #533 2026/04/12-10:10:03.861341 7f20ed3fd6c0 Delete type=0 #553
2026/02/04-08:52:25.382505 7f3946fff6c0 Level-0 table #538: started 2026/04/12-11:08:03.389691 7f1e4ffff6c0 Level-0 table #558: started
2026/02/04-08:52:25.382568 7f3946fff6c0 Level-0 table #538: 0 bytes OK 2026/04/12-11:08:03.389742 7f1e4ffff6c0 Level-0 table #558: 0 bytes OK
2026/02/04-08:52:25.390046 7f3946fff6c0 Delete type=0 #536 2026/04/12-11:08:03.395757 7f1e4ffff6c0 Delete type=0 #556
2026/02/04-08:52:25.403667 7f3946fff6c0 Manual compaction at level-0 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end) 2026/04/12-11:08:03.415391 7f1e4ffff6c0 Manual compaction at level-0 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end)
2026/02/04-08:52:25.403757 7f3946fff6c0 Manual compaction at level-1 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end) 2026/04/12-11:08:03.415438 7f1e4ffff6c0 Manual compaction at level-1 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zw9RQocTdz3HRjZK' @ 0 : 0; will stop at (end)

View File

@@ -1 +1 @@
MANIFEST-000536 MANIFEST-000556

View File

@@ -1,8 +1,8 @@
2026/02/06-21:03:10.133019 7f71b7fff6c0 Recovering log #534 2026/04/14-20:54:14.189613 7fc1d9fbd6c0 Recovering log #554
2026/02/06-21:03:10.144336 7f71b7fff6c0 Delete type=3 #532 2026/04/14-20:54:14.199454 7fc1d9fbd6c0 Delete type=3 #552
2026/02/06-21:03:10.144427 7f71b7fff6c0 Delete type=0 #534 2026/04/14-20:54:14.199515 7fc1d9fbd6c0 Delete type=0 #554
2026/02/06-21:51:23.291316 7f71b67fc6c0 Level-0 table #539: started 2026/04/14-21:31:09.274309 7fc1d8fbb6c0 Level-0 table #559: started
2026/02/06-21:51:23.291356 7f71b67fc6c0 Level-0 table #539: 0 bytes OK 2026/04/14-21:31:09.274344 7fc1d8fbb6c0 Level-0 table #559: 0 bytes OK
2026/02/06-21:51:23.327518 7f71b67fc6c0 Delete type=0 #537 2026/04/14-21:31:09.316123 7fc1d8fbb6c0 Delete type=0 #557
2026/02/06-21:51:23.327733 7f71b67fc6c0 Manual compaction at level-0 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end) 2026/04/14-21:31:09.426109 7fc1d8fbb6c0 Manual compaction at level-0 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end)
2026/02/06-21:51:23.327757 7f71b67fc6c0 Manual compaction at level-1 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end) 2026/04/14-21:31:09.426138 7fc1d8fbb6c0 Manual compaction at level-1 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end)

View File

@@ -1,8 +1,8 @@
2026/02/04-08:49:16.884043 7f3bdd3fe6c0 Recovering log #530 2026/04/12-10:10:03.864565 7f20ecbfc6c0 Recovering log #550
2026/02/04-08:49:16.942005 7f3bdd3fe6c0 Delete type=3 #528 2026/04/12-10:10:03.875268 7f20ecbfc6c0 Delete type=3 #548
2026/02/04-08:49:16.942138 7f3bdd3fe6c0 Delete type=0 #530 2026/04/12-10:10:03.875332 7f20ecbfc6c0 Delete type=0 #550
2026/02/04-08:52:25.418216 7f3946fff6c0 Level-0 table #535: started 2026/04/12-11:08:03.395874 7f1e4ffff6c0 Level-0 table #555: started
2026/02/04-08:52:25.418276 7f3946fff6c0 Level-0 table #535: 0 bytes OK 2026/04/12-11:08:03.395896 7f1e4ffff6c0 Level-0 table #555: 0 bytes OK
2026/02/04-08:52:25.424939 7f3946fff6c0 Delete type=0 #533 2026/04/12-11:08:03.401955 7f1e4ffff6c0 Delete type=0 #553
2026/02/04-08:52:25.432353 7f3946fff6c0 Manual compaction at level-0 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end) 2026/04/12-11:08:03.415404 7f1e4ffff6c0 Manual compaction at level-0 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end)
2026/02/04-08:52:25.432442 7f3946fff6c0 Manual compaction at level-1 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end) 2026/04/12-11:08:03.415431 7f1e4ffff6c0 Manual compaction at level-1 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!x5gLtqlW4sdDmHTd' @ 0 : 0; will stop at (end)

View File

@@ -1 +1 @@
MANIFEST-000541 MANIFEST-000561

View File

@@ -1,8 +1,8 @@
2026/02/06-21:03:10.101791 7f71b77fe6c0 Recovering log #539 2026/04/14-20:54:14.156150 7fc1d97bc6c0 Recovering log #559
2026/02/06-21:03:10.111914 7f71b77fe6c0 Delete type=3 #537 2026/04/14-20:54:14.166976 7fc1d97bc6c0 Delete type=3 #557
2026/02/06-21:03:10.111991 7f71b77fe6c0 Delete type=0 #539 2026/04/14-20:54:14.167099 7fc1d97bc6c0 Delete type=0 #559
2026/02/06-21:51:23.251285 7f71b67fc6c0 Level-0 table #544: started 2026/04/14-21:31:09.203242 7fc1d8fbb6c0 Level-0 table #564: started
2026/02/06-21:51:23.251325 7f71b67fc6c0 Level-0 table #544: 0 bytes OK 2026/04/14-21:31:09.203283 7fc1d8fbb6c0 Level-0 table #564: 0 bytes OK
2026/02/06-21:51:23.291180 7f71b67fc6c0 Delete type=0 #542 2026/04/14-21:31:09.239957 7fc1d8fbb6c0 Delete type=0 #562
2026/02/06-21:51:23.327724 7f71b67fc6c0 Manual compaction at level-0 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end) 2026/04/14-21:31:09.274032 7fc1d8fbb6c0 Manual compaction at level-0 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)
2026/02/06-21:51:23.327764 7f71b67fc6c0 Manual compaction at level-1 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end) 2026/04/14-21:31:09.274121 7fc1d8fbb6c0 Manual compaction at level-1 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)

View File

@@ -1,8 +1,8 @@
2026/02/04-08:49:16.723698 7f3bdcbfd6c0 Recovering log #535 2026/04/12-10:10:03.838632 7f20ee3ff6c0 Recovering log #555
2026/02/04-08:49:16.780187 7f3bdcbfd6c0 Delete type=3 #533 2026/04/12-10:10:03.848360 7f20ee3ff6c0 Delete type=3 #553
2026/02/04-08:49:16.780329 7f3bdcbfd6c0 Delete type=0 #535 2026/04/12-10:10:03.848406 7f20ee3ff6c0 Delete type=0 #555
2026/02/04-08:52:25.375521 7f3946fff6c0 Level-0 table #540: started 2026/04/12-11:08:03.402029 7f1e4ffff6c0 Level-0 table #560: started
2026/02/04-08:52:25.375622 7f3946fff6c0 Level-0 table #540: 0 bytes OK 2026/04/12-11:08:03.402048 7f1e4ffff6c0 Level-0 table #560: 0 bytes OK
2026/02/04-08:52:25.382202 7f3946fff6c0 Delete type=0 #538 2026/04/12-11:08:03.408790 7f1e4ffff6c0 Delete type=0 #558
2026/02/04-08:52:25.403638 7f3946fff6c0 Manual compaction at level-0 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end) 2026/04/12-11:08:03.415414 7f1e4ffff6c0 Manual compaction at level-0 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)
2026/02/04-08:52:25.403738 7f3946fff6c0 Manual compaction at level-1 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end) 2026/04/12-11:08:03.415454 7f1e4ffff6c0 Manual compaction at level-1 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)

View File

@@ -1 +1 @@
MANIFEST-000236 MANIFEST-000256

View File

@@ -1,8 +1,8 @@
2026/02/06-21:03:10.160494 7f71b6ffd6c0 Recovering log #234 2026/04/14-20:54:14.216969 7fc1d97bc6c0 Recovering log #254
2026/02/06-21:03:10.170771 7f71b6ffd6c0 Delete type=3 #232 2026/04/14-20:54:14.226830 7fc1d97bc6c0 Delete type=3 #252
2026/02/06-21:03:10.170846 7f71b6ffd6c0 Delete type=0 #234 2026/04/14-20:54:14.226876 7fc1d97bc6c0 Delete type=0 #254
2026/02/06-21:51:23.435610 7f71b67fc6c0 Level-0 table #239: started 2026/04/14-21:31:09.316377 7fc1d8fbb6c0 Level-0 table #259: started
2026/02/06-21:51:23.435649 7f71b67fc6c0 Level-0 table #239: 0 bytes OK 2026/04/14-21:31:09.316424 7fc1d8fbb6c0 Level-0 table #259: 0 bytes OK
2026/02/06-21:51:23.473038 7f71b67fc6c0 Delete type=0 #237 2026/04/14-21:31:09.353574 7fc1d8fbb6c0 Delete type=0 #257
2026/02/06-21:51:23.473211 7f71b67fc6c0 Manual compaction at level-0 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end) 2026/04/14-21:31:09.426120 7fc1d8fbb6c0 Manual compaction at level-0 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end)
2026/02/06-21:51:23.473250 7f71b67fc6c0 Manual compaction at level-1 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end) 2026/04/14-21:31:09.426154 7fc1d8fbb6c0 Manual compaction at level-1 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end)

View File

@@ -1,8 +1,8 @@
2026/02/04-08:49:17.043224 7f3bc7fff6c0 Recovering log #230 2026/04/12-10:10:03.889781 7f20ed3fd6c0 Recovering log #250
2026/02/04-08:49:17.105842 7f3bc7fff6c0 Delete type=3 #228 2026/04/12-10:10:03.899549 7f20ed3fd6c0 Delete type=3 #248
2026/02/04-08:49:17.106088 7f3bc7fff6c0 Delete type=0 #230 2026/04/12-10:10:03.899595 7f20ed3fd6c0 Delete type=0 #250
2026/02/04-08:52:25.396931 7f3946fff6c0 Level-0 table #235: started 2026/04/12-11:08:03.421462 7f1e4ffff6c0 Level-0 table #255: started
2026/02/04-08:52:25.396997 7f3946fff6c0 Level-0 table #235: 0 bytes OK 2026/04/12-11:08:03.421486 7f1e4ffff6c0 Level-0 table #255: 0 bytes OK
2026/02/04-08:52:25.403390 7f3946fff6c0 Delete type=0 #233 2026/04/12-11:08:03.427527 7f1e4ffff6c0 Delete type=0 #253
2026/02/04-08:52:25.403717 7f3946fff6c0 Manual compaction at level-0 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end) 2026/04/12-11:08:03.443589 7f1e4ffff6c0 Manual compaction at level-0 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end)
2026/02/04-08:52:25.403823 7f3946fff6c0 Manual compaction at level-1 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end) 2026/04/12-11:08:03.443624 7f1e4ffff6c0 Manual compaction at level-1 from '!folders!37mu4dxsSuftlnmP' @ 72057594037927935 : 1 .. '!items!zKOpU34oLziGJW6y' @ 0 : 0; will stop at (end)

View File

@@ -1 +1 @@
MANIFEST-000535 MANIFEST-000555

View File

@@ -1,8 +1,8 @@
2026/02/06-21:03:10.146976 7f71b77fe6c0 Recovering log #533 2026/04/14-20:54:14.202677 7fc1da7be6c0 Recovering log #553
2026/02/06-21:03:10.156549 7f71b77fe6c0 Delete type=3 #531 2026/04/14-20:54:14.213358 7fc1da7be6c0 Delete type=3 #551
2026/02/06-21:03:10.156610 7f71b77fe6c0 Delete type=0 #533 2026/04/14-20:54:14.213482 7fc1da7be6c0 Delete type=0 #553
2026/02/06-21:51:23.327858 7f71b67fc6c0 Level-0 table #538: started 2026/04/14-21:31:09.160202 7fc1d8fbb6c0 Level-0 table #558: started
2026/02/06-21:51:23.327892 7f71b67fc6c0 Level-0 table #538: 0 bytes OK 2026/04/14-21:31:09.160283 7fc1d8fbb6c0 Level-0 table #558: 0 bytes OK
2026/02/06-21:51:23.359727 7f71b67fc6c0 Delete type=0 #536 2026/04/14-21:31:09.203034 7fc1d8fbb6c0 Delete type=0 #556
2026/02/06-21:51:23.473179 7f71b67fc6c0 Manual compaction at level-0 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end) 2026/04/14-21:31:09.274014 7fc1d8fbb6c0 Manual compaction at level-0 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)
2026/02/06-21:51:23.473221 7f71b67fc6c0 Manual compaction at level-1 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end) 2026/04/14-21:31:09.274091 7fc1d8fbb6c0 Manual compaction at level-1 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)

View File

@@ -1,8 +1,8 @@
2026/02/04-08:49:16.956252 7f3bdcbfd6c0 Recovering log #529 2026/04/12-10:10:03.877445 7f20ee3ff6c0 Recovering log #549
2026/02/04-08:49:17.018344 7f3bdcbfd6c0 Delete type=3 #527 2026/04/12-10:10:03.887615 7f20ee3ff6c0 Delete type=3 #547
2026/02/04-08:49:17.018475 7f3bdcbfd6c0 Delete type=0 #529 2026/04/12-10:10:03.887678 7f20ee3ff6c0 Delete type=0 #549
2026/02/04-08:52:25.390221 7f3946fff6c0 Level-0 table #534: started 2026/04/12-11:08:03.408913 7f1e4ffff6c0 Level-0 table #554: started
2026/02/04-08:52:25.390273 7f3946fff6c0 Level-0 table #534: 0 bytes OK 2026/04/12-11:08:03.408942 7f1e4ffff6c0 Level-0 table #554: 0 bytes OK
2026/02/04-08:52:25.396704 7f3946fff6c0 Delete type=0 #532 2026/04/12-11:08:03.415303 7f1e4ffff6c0 Delete type=0 #552
2026/02/04-08:52:25.403694 7f3946fff6c0 Manual compaction at level-0 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end) 2026/04/12-11:08:03.415422 7f1e4ffff6c0 Manual compaction at level-0 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)
2026/02/04-08:52:25.403801 7f3946fff6c0 Manual compaction at level-1 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end) 2026/04/12-11:08:03.415446 7f1e4ffff6c0 Manual compaction at level-1 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)

View File

@@ -21,6 +21,11 @@
<a data-action="armorHitPointsMinus"><i class="fa-solid fa-hexagon-minus"></i></a> <a data-action="armorHitPointsMinus"><i class="fa-solid fa-hexagon-minus"></i></a>
</div> </div>
<div class="flexrow armor-hp">
<span class="name" data-tooltip="{{localize 'LETHALFANTASY.Tooltip.combatProgressionStart'}}">{{localize "LETHALFANTASY.Label.combatProgressionStart"}}</span>
{{formInput systemFields.combat.fields.combatProgressionStart value=system.combat.combatProgressionStart disabled=isPlayMode }}
</div>
<div class="flexrow granted"> <div class="flexrow granted">
<span class="">{{localize <span class="">{{localize
"LETHALFANTASY.Label.grantedAttackDice"}}</a></span> "LETHALFANTASY.Label.grantedAttackDice"}}</a></span>

View File

@@ -239,7 +239,7 @@
<div class="damage-result auto-applied"> <div class="damage-result auto-applied">
<div class="auto-damage-notice"> <div class="auto-damage-notice">
<i class="fa-solid fa-check-circle"></i> <i class="fa-solid fa-check-circle"></i>
<span>Damage automatically applied to defender (with Armor DR)</span> <span>Damage automatically applied to defender (with damage reduction)</span>
</div> </div>
</div> </div>
{{else}} {{else}}

View File

@@ -3,7 +3,7 @@
{{!-- GM Controls --}} {{!-- GM Controls --}}
{{#if user.isGM}} {{#if user.isGM}}
{{#if combat.round}} {{#if (or combat.round (eq combat.turn 0))}}
<!-- <button type="button" class="inline-control combat-control icon fa-solid fa-backward-step" <!-- <button type="button" class="inline-control combat-control icon fa-solid fa-backward-step"
data-action="previousRound" data-tooltip aria-label="{{ localize "COMBAT.RoundPrev" }}"></button> data-action="previousRound" data-tooltip aria-label="{{ localize "COMBAT.RoundPrev" }}"></button>
<button type="button" class="inline-control combat-control icon fa-solid fa-arrow-left" data-action="previousTurn" <button type="button" class="inline-control combat-control icon fa-solid fa-arrow-left" data-action="previousTurn"

View File

@@ -70,7 +70,7 @@
{{!-- Combat Status --}} {{!-- Combat Status --}}
<strong class="encounter-title"> <strong class="encounter-title">
{{#if combats.length}} {{#if combats.length}}
{{#if combat.round}} {{#if (or combat.round (eq combat.turn 0))}}
{{ localize "COMBAT.Round" round=combat.round }} {{ localize "COMBAT.Round" round=combat.round }}
{{else}} {{else}}
{{ localize "COMBAT.NotStarted" }} {{ localize "COMBAT.NotStarted" }}

View File

@@ -30,6 +30,7 @@
{{formField systemFields.savingThrow value=system.savingThrow}} {{formField systemFields.savingThrow value=system.savingThrow}}
{{formField systemFields.extraAetherPoints value=system.extraAetherPoints}} {{formField systemFields.extraAetherPoints value=system.extraAetherPoints}}
{{formField systemFields.criticalType value=system.criticalType}} {{formField systemFields.criticalType value=system.criticalType}}
{{formField systemFields.damageDice value=system.damageDice}}
<fieldset> <fieldset>