mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 07:59:03 +01:00
Merge branch 'main' into bug/103-enrich-htmlfield-content-before-its-used-in-applications
This commit is contained in:
commit
d26ed22e74
69 changed files with 1781 additions and 446 deletions
|
|
@ -245,10 +245,10 @@ export const getDamageLabel = damage => {
|
|||
|
||||
export const damageKeyToNumber = key => {
|
||||
return {
|
||||
'none': 0,
|
||||
'minor': 1,
|
||||
'major': 2,
|
||||
'severe': 3
|
||||
none: 0,
|
||||
minor: 1,
|
||||
major: 2,
|
||||
severe: 3
|
||||
}[key];
|
||||
};
|
||||
|
||||
|
|
@ -311,3 +311,15 @@ export function getDocFromElement(element) {
|
|||
return foundry.utils.fromUuidSync(target.dataset.itemUuid) ?? null;
|
||||
}
|
||||
|
||||
|
||||
export const itemAbleRollParse = (value, actor, item) => {
|
||||
if (!value) return value;
|
||||
|
||||
const isItemTarget = value.toLowerCase().startsWith('item.');
|
||||
const slicedValue = isItemTarget ? value.slice(5) : value;
|
||||
try {
|
||||
return Roll.safeEval(Roll.replaceFormulaData(slicedValue, isItemTarget ? item : actor));
|
||||
} catch (_) {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue