Made baseEffect.stacking nullable instead of having an enabled property

This commit is contained in:
WBHarry 2026-03-25 13:40:40 +01:00
parent 0fbe027d7d
commit 5ff1d0c71f
14 changed files with 70 additions and 43 deletions

View file

@ -89,12 +89,12 @@ export default class DhEffectsDisplay extends HandlebarsApplicationMixin(Applica
const element = event.target.closest('.effect-container');
const effects = DhEffectsDisplay.getTokenEffects();
const effect = effects.find(x => x.id === element.dataset.effectId);
if (!effect || (delta >= 0 && !effect.system.stacking?.enabled)) {
if (!effect || (delta >= 0 && !effect.system.stacking)) {
return;
}
const maxValue = effect.system.stacking.max ?? Infinity;
const newValue = Math.clamp((effect.system.stacking.value ?? 1) + delta, 0, maxValue);
const maxValue = effect.system.stacking?.max ?? Infinity;
const newValue = Math.clamp((effect.system.stacking?.value ?? 1) + delta, 0, maxValue);
if (newValue > 0) {
await effect.update({ 'system.stacking.value': newValue });
} else {