mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 14:36:13 +01:00
.
This commit is contained in:
parent
c65294a7d3
commit
f950460098
2 changed files with 8 additions and 10 deletions
|
|
@ -296,7 +296,7 @@ Hooks.on('chatMessage', (_, message) => {
|
||||||
? CONFIG.DH.ACTIONS.advantageState.disadvantage.value
|
? CONFIG.DH.ACTIONS.advantageState.disadvantage.value
|
||||||
: undefined;
|
: undefined;
|
||||||
const difficulty = rollCommand.difficulty;
|
const difficulty = rollCommand.difficulty;
|
||||||
const noResources = Boolean(rollCommand.noResources);
|
const grantResources = Boolean(rollCommand.grantResources);
|
||||||
|
|
||||||
const target = getCommandTarget({ allowNull: true });
|
const target = getCommandTarget({ allowNull: true });
|
||||||
const title = traitValue
|
const title = traitValue
|
||||||
|
|
@ -314,7 +314,7 @@ Hooks.on('chatMessage', (_, message) => {
|
||||||
label: game.i18n.localize('DAGGERHEART.GENERAL.dualityRoll'),
|
label: game.i18n.localize('DAGGERHEART.GENERAL.dualityRoll'),
|
||||||
actionType: null,
|
actionType: null,
|
||||||
advantage,
|
advantage,
|
||||||
noResources
|
grantResources
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,6 @@ function getDualityMessage(roll, flavor) {
|
||||||
? 'Disadvantage'
|
? 'Disadvantage'
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
const noResources = Boolean(roll?.noResources);
|
|
||||||
|
|
||||||
const dualityElement = document.createElement('span');
|
const dualityElement = document.createElement('span');
|
||||||
dualityElement.innerHTML = `
|
dualityElement.innerHTML = `
|
||||||
<button type="button" class="duality-roll-button${roll?.inline ? ' inline' : ''}"
|
<button type="button" class="duality-roll-button${roll?.inline ? ' inline' : ''}"
|
||||||
|
|
@ -49,7 +47,7 @@ function getDualityMessage(roll, flavor) {
|
||||||
${roll?.trait && abilities[roll.trait] ? `data-trait="${roll.trait}"` : ''}
|
${roll?.trait && abilities[roll.trait] ? `data-trait="${roll.trait}"` : ''}
|
||||||
${roll?.advantage ? 'data-advantage="true"' : ''}
|
${roll?.advantage ? 'data-advantage="true"' : ''}
|
||||||
${roll?.disadvantage ? 'data-disadvantage="true"' : ''}
|
${roll?.disadvantage ? 'data-disadvantage="true"' : ''}
|
||||||
data-no-resources="${noResources}"
|
${roll?.grantResources ? 'data-grant-resources="true"' : ''}
|
||||||
>
|
>
|
||||||
${roll?.reaction ? '<i class="fa-solid fa-reply"></i>' : '<i class="fa-solid fa-circle-half-stroke"></i>'}
|
${roll?.reaction ? '<i class="fa-solid fa-reply"></i>' : '<i class="fa-solid fa-circle-half-stroke"></i>'}
|
||||||
${label}
|
${label}
|
||||||
|
|
@ -67,7 +65,7 @@ export const renderDualityButton = async event => {
|
||||||
target = getCommandTarget({ allowNull: true }),
|
target = getCommandTarget({ allowNull: true }),
|
||||||
difficulty = button.dataset.difficulty,
|
difficulty = button.dataset.difficulty,
|
||||||
advantage = button.dataset.advantage ? Number(button.dataset.advantage) : undefined,
|
advantage = button.dataset.advantage ? Number(button.dataset.advantage) : undefined,
|
||||||
noResources = button.dataset.noResources === 'true';
|
grantResources = Boolean(button.dataset?.grantResources);
|
||||||
|
|
||||||
await enrichedDualityRoll(
|
await enrichedDualityRoll(
|
||||||
{
|
{
|
||||||
|
|
@ -78,14 +76,14 @@ export const renderDualityButton = async event => {
|
||||||
title: button.dataset.title,
|
title: button.dataset.title,
|
||||||
label: button.dataset.label,
|
label: button.dataset.label,
|
||||||
advantage,
|
advantage,
|
||||||
noResources
|
grantResources
|
||||||
},
|
},
|
||||||
event
|
event
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const enrichedDualityRoll = async (
|
export const enrichedDualityRoll = async (
|
||||||
{ reaction, traitValue, target, difficulty, title, label, advantage, noResources },
|
{ reaction, traitValue, target, difficulty, title, label, advantage, grantResources },
|
||||||
event
|
event
|
||||||
) => {
|
) => {
|
||||||
const config = {
|
const config = {
|
||||||
|
|
@ -99,8 +97,8 @@ export const enrichedDualityRoll = async (
|
||||||
type: reaction ? 'reaction' : null
|
type: reaction ? 'reaction' : null
|
||||||
},
|
},
|
||||||
skips: {
|
skips: {
|
||||||
resources: noResources,
|
resources: !grantResources,
|
||||||
triggers: noResources
|
triggers: !grantResources
|
||||||
},
|
},
|
||||||
type: 'trait',
|
type: 'trait',
|
||||||
hasRoll: true
|
hasRoll: true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue