Added the ability for effects to automatically activate/deactivate depending on range between tokens

This commit is contained in:
WBHarry 2025-07-29 14:50:14 +02:00
parent 4defe69c21
commit b80f598625
13 changed files with 218 additions and 30 deletions

View file

@ -321,3 +321,18 @@ export const arraysEqual = (a, b) =>
[...new Set([...a, ...b])].every(v => a.filter(e => e === v).length === b.filter(e => e === v).length);
export const setsEqual = (a, b) => a.size === b.size && [...a].every(value => b.has(value));
export function compareValues(a, b, compare) {
switch (compare) {
case CONFIG.DH.GENERAL.compareOperator.lessThan.id:
return a < b;
case CONFIG.DH.GENERAL.compareOperator.lessThanEqual.id:
return a <= b;
case CONFIG.DH.GENERAL.compareOperator.equal.id:
return a === b;
case CONFIG.DH.GENERAL.compareOperator.moreThanEqual.id:
return a >= b;
case CONFIG.DH.GENERAL.compareOperator.moreThan.id:
return a > b;
}
}