Fix targeting

This commit is contained in:
Dapoolp 2025-08-13 15:50:03 +02:00
parent b5642db2cd
commit 70feaf72aa
4 changed files with 6 additions and 4 deletions

View file

@ -114,7 +114,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
async use(event, options = {}) { async use(event, options = {}) {
if (!this.actor) throw new Error("An Action can't be used outside of an Actor context."); 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, let { byPassRoll } = options,
config = this.prepareConfig(event, byPassRoll); config = this.prepareConfig(event, byPassRoll);
for (let i = 0; i < this.constructor.extraSchemas.length; i++) { for (let i = 0; i < this.constructor.extraSchemas.length; i++) {

View file

@ -110,6 +110,8 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
if (this.hasTarget) { if (this.hasTarget) {
this.hasHitTarget = this.targets.filter(t => t.hit === true).length > 0; this.hasHitTarget = this.targets.filter(t => t.hit === true).length > 0;
this.currentTargets = this.getTargetList(); this.currentTargets = this.getTargetList();
console.log(this.targetMode, this.parent.targetHook)
this.registerTargetHook();
if (this.targetMode === true && this.hasRoll) { if (this.targetMode === true && this.hasRoll) {
this.targetShort = this.targets.reduce( this.targetShort = this.targets.reduce(

View file

@ -1,6 +1,6 @@
export default class DhpChatMessage extends foundry.documents.ChatMessage { export default class DhpChatMessage extends foundry.documents.ChatMessage {
targetHook = null; targetHook = null;
targetSelection = null; // targetSelection = null;
async renderHTML() { async renderHTML() {
const actor = game.actors.get(this.speaker.actor); const actor = game.actors.get(this.speaker.actor);
@ -24,7 +24,7 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
/** @inheritDoc */ /** @inheritDoc */
prepareData() { 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(); super.prepareData();
} }

View file

@ -6,7 +6,7 @@
{{#if roll.isCritical}} {{#if roll.isCritical}}
<span>{{localize "DAGGERHEART.GENERAL.criticalShort"}}</span> <span>{{localize "DAGGERHEART.GENERAL.criticalShort"}}</span>
{{else}} {{else}}
{{#if (and roll.result (not roll.type "reaction"))}} {{#if (and roll.result (not (eq roll.type "reaction")))}}
<span>{{localize "DAGGERHEART.GENERAL.withThing" thing=roll.result.label}}</span> <span>{{localize "DAGGERHEART.GENERAL.withThing" thing=roll.result.label}}</span>
{{/if}} {{/if}}
{{/if}} {{/if}}