This commit is contained in:
WBHarry 2026-02-21 13:49:30 +01:00
parent 4aab5d315a
commit bafc53488f
11 changed files with 270 additions and 4 deletions

View file

@ -538,7 +538,7 @@ export function getIconVisibleActiveEffects(effects) {
const alwaysShown = effect.showIcon === CONST.ACTIVE_EFFECT_SHOW_ICON.ALWAYS;
const conditionalShown = effect.showIcon === CONST.ACTIVE_EFFECT_SHOW_ICON.CONDITIONAL && !effect.transfer; // TODO: system specific logic
return !effect.disabled && (alwaysShown || conditionalShown);
return !effect.active && (alwaysShown || conditionalShown);
});
}
@ -587,3 +587,25 @@ export function calculateExpectedValue(formulaOrTerms) {
: [formulaOrTerms];
return terms.reduce((r, t) => r + (t.bonus ?? 0) + (t.diceQuantity ? (t.diceQuantity * (t.faces + 1)) / 2 : 0), 0);
}
/**
*
* @param {Number} valA The number being compared to a second one
* @param {Number} valB The number the first is being compared to
* @param {Comparator} comparator The type of comparison
* @returns { Boolean } Whether valA passes the comparison
*/
export function compareValues(valA, valB, comparator) {
switch (comparator) {
case CONFIG.DH.GENERAL.comparator.eq.id:
return valA === valB;
case CONFIG.DH.GENERAL.comparator.gt.id:
return valA > valB;
case CONFIG.DH.GENERAL.comparator.gte.id:
return valA >= valB;
case CONFIG.DH.GENERAL.comparator.lt.id:
return valA < valB;
case CONFIG.DH.GENERAL.comparator.lte.id:
return valA <= valB;
}
}