Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc5d38deff |
@@ -161,11 +161,15 @@ export default class LethalFantasyRoll extends Roll {
|
||||
let isAttack = this.type === "weapon-attack" || this.type === "monster-attack" || this.type === "spell-attack" || this.type === "miracle-attack"
|
||||
if (this.rollData?.isDamage || isAttack) {
|
||||
// D'abord, ajouter les combattants du combat actif
|
||||
const defeatedTokenIds = new Set()
|
||||
if (game?.combat?.combatants) {
|
||||
for (let c of game.combat.combatants) {
|
||||
if (c.actorId !== this.actorId && !c.isDefeated) {
|
||||
combatants.push({ id: c.id, name: c.name, tokenId: c.token.id })
|
||||
}
|
||||
if (c.isDefeated && c.token?.id) {
|
||||
defeatedTokenIds.add(c.token.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,9 +177,9 @@ export default class LethalFantasyRoll extends Roll {
|
||||
if (canvas?.scene?.tokens) {
|
||||
const existingTokenIds = new Set(combatants.map(c => c.tokenId))
|
||||
for (let token of canvas.scene.tokens) {
|
||||
if (token.actorId !== this.actorId && !existingTokenIds.has(token.id)) {
|
||||
// Skip dead tokens: monsters at 0 HP are dead; characters use the defeated flag
|
||||
const tokenActor = game.actors.get(token.actorId)
|
||||
if (token.actorId !== this.actorId && !existingTokenIds.has(token.id) && !defeatedTokenIds.has(token.id)) {
|
||||
// Skip dead monsters (0 HP). Use token.actor for unlinked tokens.
|
||||
const tokenActor = token.actor ?? game.actors.get(token.actorId)
|
||||
if (tokenActor?.type === "monster" && (Number(tokenActor?.system?.hp?.value) || 0) <= 0) continue
|
||||
combatants.push({
|
||||
id: token.id,
|
||||
|
||||
Reference in New Issue
Block a user