Add logic helpers for sanity
This commit is contained in:
parent
c95a09aa6e
commit
f974f260b3
2 changed files with 16 additions and 2 deletions
|
|
@ -5,11 +5,25 @@ import { objectValue } from "./objectValue.mjs";
|
||||||
import { toFriendlyDuration } from "./toFriendlyDuration.mjs";
|
import { toFriendlyDuration } from "./toFriendlyDuration.mjs";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
|
// Complex helpers
|
||||||
"dd-schemaOptions": schemaOptions,
|
"dd-schemaOptions": schemaOptions,
|
||||||
"dd-array": createArray,
|
"dd-array": createArray,
|
||||||
"dd-toFriendlyDuration": toFriendlyDuration,
|
"dd-toFriendlyDuration": toFriendlyDuration,
|
||||||
"dd-objectValue": objectValue,
|
"dd-objectValue": objectValue,
|
||||||
"dd-expanded": detailsExpanded,
|
"dd-expanded": detailsExpanded,
|
||||||
|
|
||||||
|
// Simple helpers
|
||||||
"dd-stringify": v => JSON.stringify(v, null, ` `),
|
"dd-stringify": v => JSON.stringify(v, null, ` `),
|
||||||
"dd-negate": v => !v,
|
|
||||||
|
// Logic helpers
|
||||||
|
"eq": (a, b) => a == b,
|
||||||
|
"neq": (a, b) => a != b,
|
||||||
|
"not": v => !v,
|
||||||
|
"or": (a, b) => a || b,
|
||||||
|
"and": (a, b) => a && b,
|
||||||
|
"nor": (a, b) => !(a || b),
|
||||||
|
"nand": (a, b) => !(a && b),
|
||||||
|
"xor": (a, b) => (a || b) && !(a && b),
|
||||||
|
"xnor": (a, b) => !((a || b) && !(a && b))
|
||||||
};
|
};
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
data-stat="{{name}}"
|
data-stat="{{name}}"
|
||||||
data-roll-formula="1{{value}}"
|
data-roll-formula="1{{value}}"
|
||||||
data-roll-label="dotdungeon.rolls.stats.{{name}}"
|
data-roll-label="dotdungeon.rolls.stats.{{name}}"
|
||||||
{{disabled (dd-negate (dd-objectValue system (concat "stats." name)))}}
|
{{disabled (not (dd-objectValue system (concat "stats." name)))}}
|
||||||
>
|
>
|
||||||
{{localize (concat "dotdungeon.actor.pc.stat." name)}}
|
{{localize (concat "dotdungeon.actor.pc.stat." name)}}
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue