Improve init for monsters and some fixwes around shields
Release Creation / build (release) Successful in 48s
Release Creation / build (release) Successful in 48s
This commit is contained in:
+16
-9
@@ -401,7 +401,7 @@ export default class LethalFantasyUtils {
|
||||
defenderTokenId,
|
||||
isRanged: true
|
||||
}
|
||||
await roll.toMessage({}, { rollMode: roll.options.rollMode })
|
||||
await roll.toMessage({}, { messageMode: roll.options.rollMode })
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -1092,25 +1092,32 @@ export default class LethalFantasyUtils {
|
||||
static async applyDamage(message, event) {
|
||||
// Récupérer les données du message
|
||||
let combatantId = event.currentTarget.dataset.combatantId
|
||||
if (!combatantId || !game.combat) {
|
||||
if (!combatantId) {
|
||||
ui.notifications.error("No combatant selected")
|
||||
return
|
||||
}
|
||||
|
||||
let combatant = game.combat.combatants.get(combatantId)
|
||||
if (!combatant) {
|
||||
ui.notifications.error("Combatant not found")
|
||||
return
|
||||
// Try to find the target: first as a combat combatant, then as a scene token
|
||||
let targetActor = null
|
||||
if (game.combat) {
|
||||
const combatant = game.combat.combatants.get(combatantId)
|
||||
if (combatant) {
|
||||
targetActor = combatant.token?.actor || game.actors.get(combatant.actorId)
|
||||
}
|
||||
}
|
||||
if (!targetActor) {
|
||||
// Fall back to scene token lookup (non-combat tokens use tokenId as their combatantId)
|
||||
const token = canvas.tokens?.placeables?.find(t => t.id === combatantId)
|
||||
targetActor = token?.actor
|
||||
}
|
||||
|
||||
let targetActor = combatant.token?.actor || game.actors.get(combatant.actorId)
|
||||
if (!targetActor) {
|
||||
ui.notifications.error("Target actor not found")
|
||||
return
|
||||
}
|
||||
|
||||
// Récupérer les données de dégâts du message
|
||||
let damageTotal = message.rolls[0]?.total || 0
|
||||
// Use options.rollTotal (includes weapon modifier bonus) rather than roll.total (dice formula only)
|
||||
let damageTotal = message.rolls[0]?.options?.rollTotal ?? message.rolls[0]?.total ?? 0
|
||||
let weaponName = message.rolls[0]?.options?.rollName || "Unknown Weapon"
|
||||
|
||||
// Calculer les DR
|
||||
|
||||
Reference in New Issue
Block a user