diff --git a/daggerheart.mjs b/daggerheart.mjs index ae93253c..23f153dd 100644 --- a/daggerheart.mjs +++ b/daggerheart.mjs @@ -300,8 +300,8 @@ Hooks.on('chatMessage', (_, message) => { const difficulty = rollCommand.difficulty; const target = getCommandTarget({ allowNull: true }); - const title = traitValue - ? game.i18n.format('DAGGERHEART.UI.Chat.dualityRoll.abilityCheckTitle', { + const title = flavor ?? + traitValue ? game.i18n.format('DAGGERHEART.UI.Chat.dualityRoll.abilityCheckTitle', { ability: game.i18n.localize(SYSTEM.ACTOR.abilities[traitValue].label) }) : game.i18n.localize('DAGGERHEART.GENERAL.duality'); diff --git a/module/applications/dialogs/deathMove.mjs b/module/applications/dialogs/deathMove.mjs index 18ebf104..01df6057 100644 --- a/module/applications/dialogs/deathMove.mjs +++ b/module/applications/dialogs/deathMove.mjs @@ -180,7 +180,8 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV 'systems/daggerheart/templates/ui/chat/deathMove.hbs', { player: this.actor.name, - actor: { name: this.actor.name, img: this.actor.img }, + actor: this.actor, + actorId: this.actor._id, author: game.users.get(game.user.id), title: game.i18n.localize(this.selectedMove.name), img: this.selectedMove.img, diff --git a/module/applications/ui/chatLog.mjs b/module/applications/ui/chatLog.mjs index f0c7288c..2b489f58 100644 --- a/module/applications/ui/chatLog.mjs +++ b/module/applications/ui/chatLog.mjs @@ -391,6 +391,7 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo async riskItAllClearStressAndHitPoints(event, data) { const resourceValue = event.target.dataset.resourceValue; - new game.system.api.applications.dialogs.RiskItAllDialog(data.actor, resourceValue).render({ force: true }); + const actor = game.actors.get(event.target.dataset.actorId); + new game.system.api.applications.dialogs.RiskItAllDialog(actor, resourceValue).render({ force: true }); } } diff --git a/module/enrichers/DualityRollEnricher.mjs b/module/enrichers/DualityRollEnricher.mjs index 1ba4c792..f6f022f9 100644 --- a/module/enrichers/DualityRollEnricher.mjs +++ b/module/enrichers/DualityRollEnricher.mjs @@ -2,7 +2,7 @@ import { abilities } from '../config/actorConfig.mjs'; import { getCommandTarget, rollCommandToJSON } from '../helpers/utils.mjs'; export default function DhDualityRollEnricher(match, _options) { - const roll = rollCommandToJSON(match[1], match[0]); + const roll = rollCommandToJSON(match[0]); if (!roll) return match[0]; return getDualityMessage(roll.result, roll.flavor); diff --git a/module/enrichers/FateRollEnricher.mjs b/module/enrichers/FateRollEnricher.mjs index 0cafd4b6..c82bbcb2 100644 --- a/module/enrichers/FateRollEnricher.mjs +++ b/module/enrichers/FateRollEnricher.mjs @@ -1,7 +1,7 @@ import { getCommandTarget, rollCommandToJSON } from '../helpers/utils.mjs'; export default function DhFateRollEnricher(match, _options) { - const roll = rollCommandToJSON(match[1], match[0]); + const roll = rollCommandToJSON(match[0]); if (!roll) return match[0]; return getFateMessage(roll.result, roll?.flavor); diff --git a/module/helpers/utils.mjs b/module/helpers/utils.mjs index 234b68b4..1cce581a 100644 --- a/module/helpers/utils.mjs +++ b/module/helpers/utils.mjs @@ -5,10 +5,10 @@ export const capitalize = string => { return string.charAt(0).toUpperCase() + string.slice(1); }; -export function rollCommandToJSON(text, raw) { +export function rollCommandToJSON(text) { if (!text) return {}; - const flavorMatch = raw?.match(/{(.*)}$/); + const flavorMatch = text?.match(/{(.*)}$/); const flavor = flavorMatch ? flavorMatch[1] : null; // Match key="quoted string" OR key=unquotedValue @@ -31,7 +31,7 @@ export function rollCommandToJSON(text, raw) { } result[key] = value; } - return Object.keys(result).length > 0 ? { result, flavor } : null; + return { result, flavor }; } export const getCommandTarget = (options = {}) => { diff --git a/templates/ui/chat/deathMove.hbs b/templates/ui/chat/deathMove.hbs index 02691c7c..7c677fe3 100644 --- a/templates/ui/chat/deathMove.hbs +++ b/templates/ui/chat/deathMove.hbs @@ -19,13 +19,14 @@ {{#if this.showRiskItAllButton}}