mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
Temp
This commit is contained in:
parent
2599d1287d
commit
f9c30b583c
4 changed files with 72 additions and 4 deletions
38
module/enrichers/DualityRollEnricher.mjs
Normal file
38
module/enrichers/DualityRollEnricher.mjs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import { abilities } from '../config/actorConfig.mjs';
|
||||
|
||||
export async function dualityRollEnricher(match, _options) {
|
||||
try {
|
||||
const {
|
||||
hope = 'd12',
|
||||
fear = 'd12',
|
||||
attribute,
|
||||
advantage,
|
||||
disadvantage
|
||||
} = JSON.parse(`{${match[1].replace(' ', ',').replace(/(\w+(?==))(=)/g, '"$1":')}}`);
|
||||
const dualityElement = document.createElement('span');
|
||||
|
||||
const attributeLabel =
|
||||
attribute && abilities[attribute]
|
||||
? game.i18n.format('DAGGERHEART.General.Check', {
|
||||
check: game.i18n.localize(abilities[attribute].label)
|
||||
})
|
||||
: null;
|
||||
const label = attributeLabel ?? game.i18n.localize('DAGGERHEART.General.Duality');
|
||||
dualityElement.innerHTML = `
|
||||
<button class="duality-roll-button"
|
||||
data-hope="${hope}"
|
||||
data-fear="${fear}"
|
||||
${attribute ? `data-attribute="${attribute}"` : ''}
|
||||
${advantage ? 'data-advantage="true"' : ''}
|
||||
${disadvantage ? 'data-disadvantage="true"' : ''}
|
||||
>
|
||||
<i class="fa-solid fa-circle-half-stroke"></i>
|
||||
${label}
|
||||
</button>
|
||||
`;
|
||||
|
||||
return dualityElement;
|
||||
} catch (_) {
|
||||
return match[0];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue