[Feature] 460 - Reaction Rolls (#481)

* Added a toggle in D20RollDialog for ReactionRolls

* DualityRollEnrichment can now use reaction

* Added flavor for DualityRollEnrichment
This commit is contained in:
WBHarry 2025-07-31 03:27:48 +02:00 committed by GitHub
parent 243630878b
commit e168e3e7ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 103 additions and 31 deletions

View file

@ -187,12 +187,15 @@ Hooks.on('renderHandlebarsApplication', (_, element) => {
Hooks.on('chatMessage', (_, message) => {
if (message.startsWith('/dr')) {
const rollCommand = rollCommandToJSON(message.replace(/\/dr\s?/, ''));
if (!rollCommand) {
const result = rollCommandToJSON(message.replace(/\/dr\s?/, ''));
if (!result) {
ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.dualityParsing'));
return false;
}
const { result: rollCommand, flavor } = result;
const reaction = rollCommand.reaction;
const traitValue = rollCommand.trait?.toLowerCase();
const advantage = rollCommand.advantage
? CONFIG.DH.ACTIONS.advantageState.advantage.value
@ -208,7 +211,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;
}
});