diff --git a/daggerheart.mjs b/daggerheart.mjs index 56ad3e3d..7e744571 100644 --- a/daggerheart.mjs +++ b/daggerheart.mjs @@ -193,6 +193,7 @@ Hooks.on('chatMessage', (_, message) => { return false; } + const reaction = rollCommand.reaction; const traitValue = rollCommand.trait?.toLowerCase(); const advantage = rollCommand.advantage ? CONFIG.DH.ACTIONS.advantageState.advantage.value @@ -208,7 +209,16 @@ Hooks.on('chatMessage', (_, message) => { }) : game.i18n.localize('DAGGERHEART.GENERAL.duality'); - enrichedDualityRoll({ traitValue, target, difficulty, title, label: 'test', actionType: null, advantage }); + enrichedDualityRoll({ + reaction, + traitValue, + target, + difficulty, + title, + label: 'test', + actionType: null, + advantage + }); return false; } }); diff --git a/lang/en.json b/lang/en.json index be761dab..93130f31 100755 --- a/lang/en.json +++ b/lang/en.json @@ -1348,7 +1348,6 @@ "basics": "Basics", "bonus": "Bonus", "burden": "Burden", - "check": "{check} Check", "continue": "Continue", "criticalSuccess": "Critical Success", "damage": "Damage", @@ -1401,6 +1400,7 @@ "roll": "Roll", "rollAll": "Roll All", "rollDamage": "Roll Damage", + "rollWith": "{roll} Roll", "save": "Save", "scalable": "Scalable", "situationalBonus": "Situational Bonus", diff --git a/module/applications/dialogs/d20RollDialog.mjs b/module/applications/dialogs/d20RollDialog.mjs index 75253215..9075c454 100644 --- a/module/applications/dialogs/d20RollDialog.mjs +++ b/module/applications/dialogs/d20RollDialog.mjs @@ -7,7 +7,7 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio this.roll = roll; this.config = config; this.config.experiences = []; - this.reactionOverride = false; + this.reactionOverride = config.roll.type === 'reaction'; if (config.source?.action) { this.item = config.data.parent.items.get(config.source.item) ?? config.data.parent; @@ -105,6 +105,8 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio context.isLite = this.config.roll?.lite; context.extraFormula = this.config.extraFormula; context.formula = this.roll.constructFormula(this.config); + + context.showReaction = !context.rollConfig.type && context.rollType === 'DualityRoll'; context.reactionOverride = this.reactionOverride; } return context; @@ -152,7 +154,11 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio } static async submitRoll() { - this.config.roll.type = this.reactionOverride ? CONFIG.DH.ITEM.actionTypes.reaction.id : this.config.roll.type; + this.config.roll.type = this.reactionOverride + ? CONFIG.DH.ITEM.actionTypes.reaction.id + : this.config.roll.type === CONFIG.DH.ITEM.actionTypes.reaction.id + ? null + : this.config.roll.type; await this.close({ submitted: true }); } diff --git a/module/enrichers/DualityRollEnricher.mjs b/module/enrichers/DualityRollEnricher.mjs index 24dd0602..275adcf7 100644 --- a/module/enrichers/DualityRollEnricher.mjs +++ b/module/enrichers/DualityRollEnricher.mjs @@ -9,15 +9,14 @@ export default function DhDualityRollEnricher(match, _options) { } function getDualityMessage(roll) { - const traitLabel = - roll.trait && abilities[roll.trait] - ? game.i18n.format('DAGGERHEART.GENERAL.check', { - check: game.i18n.localize(abilities[roll.trait].label) - }) - : null; + const trait = roll.trait && abilities[roll.trait] ? game.i18n.localize(abilities[roll.trait].label) : null; + const label = roll.trait + ? game.i18n.format('DAGGERHEART.GENERAL.rollWith', { roll: trait }) + : roll.reaction + ? game.i18n.localize('DAGGERHEART.GENERAL.reactionRoll') + : game.i18n.localize('DAGGERHEART.GENERAL.duality'); - const label = traitLabel ?? game.i18n.localize('DAGGERHEART.GENERAL.duality'); - const dataLabel = traitLabel + const dataLabel = trait ? game.i18n.localize(abilities[roll.trait].label) : game.i18n.localize('DAGGERHEART.GENERAL.duality'); @@ -38,6 +37,7 @@ function getDualityMessage(roll) { @@ -57,6 +57,7 @@ function getDualityMessage(roll) { export const renderDualityButton = async event => { const button = event.currentTarget, + reaction = button.dataset.reaction === 'true', traitValue = button.dataset.trait?.toLowerCase(), target = getCommandTarget({ allowNull: true }), difficulty = button.dataset.difficulty, @@ -64,12 +65,12 @@ export const renderDualityButton = async event => { await enrichedDualityRoll( { + reaction, traitValue, target, difficulty, title: button.dataset.title, label: button.dataset.label, - actionType: button.dataset.actionType, advantage }, event @@ -77,7 +78,7 @@ export const renderDualityButton = async event => { }; export const enrichedDualityRoll = async ( - { traitValue, target, difficulty, title, label, actionType, advantage }, + { reaction, traitValue, target, difficulty, title, label, advantage }, event ) => { const config = { @@ -88,7 +89,7 @@ export const enrichedDualityRoll = async ( label: label, difficulty: difficulty, advantage, - type: actionType ?? null // Need check, + type: reaction ? 'reaction' : null }, chatMessage: { template: 'systems/daggerheart/templates/ui/chat/duality-roll.hbs' diff --git a/templates/dialogs/dice-roll/header.hbs b/templates/dialogs/dice-roll/header.hbs index eceb8c89..cea07209 100644 --- a/templates/dialogs/dice-roll/header.hbs +++ b/templates/dialogs/dice-roll/header.hbs @@ -1,8 +1,10 @@

{{ifThen rollConfig.headerTitle rollConfig.headerTitle rollConfig.title}} - + {{#if showReaction}} + + {{/if}}

\ No newline at end of file