From 70feaf72aa8bd14c9e3264090be8a7ec77b662d1 Mon Sep 17 00:00:00 2001 From: Dapoolp Date: Wed, 13 Aug 2025 15:50:03 +0200 Subject: [PATCH] Fix targeting --- module/data/action/baseAction.mjs | 2 +- module/data/chat-message/adversaryRoll.mjs | 2 ++ module/documents/chatMessage.mjs | 4 ++-- templates/ui/chat/parts/roll-part.hbs | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/module/data/action/baseAction.mjs b/module/data/action/baseAction.mjs index a886bf49..9db3ed23 100644 --- a/module/data/action/baseAction.mjs +++ b/module/data/action/baseAction.mjs @@ -114,7 +114,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel async use(event, options = {}) { if (!this.actor) throw new Error("An Action can't be used outside of an Actor context."); - if (this.chatDisplay) await this.toChat(); + // if (this.chatDisplay) await this.toChat(); let { byPassRoll } = options, config = this.prepareConfig(event, byPassRoll); for (let i = 0; i < this.constructor.extraSchemas.length; i++) { diff --git a/module/data/chat-message/adversaryRoll.mjs b/module/data/chat-message/adversaryRoll.mjs index 337acf5b..cbc3e089 100644 --- a/module/data/chat-message/adversaryRoll.mjs +++ b/module/data/chat-message/adversaryRoll.mjs @@ -110,6 +110,8 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel { if (this.hasTarget) { this.hasHitTarget = this.targets.filter(t => t.hit === true).length > 0; this.currentTargets = this.getTargetList(); + console.log(this.targetMode, this.parent.targetHook) + this.registerTargetHook(); if (this.targetMode === true && this.hasRoll) { this.targetShort = this.targets.reduce( diff --git a/module/documents/chatMessage.mjs b/module/documents/chatMessage.mjs index 398bfcbe..631ee50f 100644 --- a/module/documents/chatMessage.mjs +++ b/module/documents/chatMessage.mjs @@ -1,6 +1,6 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage { targetHook = null; - targetSelection = null; + // targetSelection = null; async renderHTML() { const actor = game.actors.get(this.speaker.actor); @@ -24,7 +24,7 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage { /** @inheritDoc */ prepareData() { - if (this.isAuthor && this.targetSelection === null) this.targetSelection = this.system.targets?.length > 0; + if (this.isAuthor && this.targetSelection === undefined) this.targetSelection = this.system.targets?.length > 0; super.prepareData(); } diff --git a/templates/ui/chat/parts/roll-part.hbs b/templates/ui/chat/parts/roll-part.hbs index d702db91..8e88015f 100644 --- a/templates/ui/chat/parts/roll-part.hbs +++ b/templates/ui/chat/parts/roll-part.hbs @@ -6,7 +6,7 @@ {{#if roll.isCritical}} {{localize "DAGGERHEART.GENERAL.criticalShort"}} {{else}} - {{#if (and roll.result (not roll.type "reaction"))}} + {{#if (and roll.result (not (eq roll.type "reaction")))}} {{localize "DAGGERHEART.GENERAL.withThing" thing=roll.result.label}} {{/if}} {{/if}}