Added tag targeted toggles
May God have mercy on us all
This commit is contained in:
@@ -6,6 +6,7 @@ import pointBuy from './computeByType/computePointBuy.js';
|
||||
import propertySlot from './computeByType/computeSlot.js';
|
||||
import container from './computeByType/computeContainer.js';
|
||||
import spellList from './computeByType/computeSpellList.js';
|
||||
import toggle from './computeByType/computeToggle.js';
|
||||
import _calculation from './computeByType/computeCalculation.js';
|
||||
|
||||
export default Object.freeze({
|
||||
@@ -19,4 +20,5 @@ export default Object.freeze({
|
||||
propertySlot,
|
||||
spell: action,
|
||||
spellList,
|
||||
toggle,
|
||||
});
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
export default function computeToggle(computation, node) {
|
||||
const prop = node.data;
|
||||
if (!prop.enabled && !prop.disabled && prop.condition && !prop.condition.value) {
|
||||
prop.inactive = true;
|
||||
prop.deactivatedBySelf = true;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,16 @@
|
||||
export default function evaluateToggles(computation, node){
|
||||
export default function evaluateToggles(computation, node) {
|
||||
let prop = node.data;
|
||||
if (!prop) return;
|
||||
let toggles = prop._computationDetails?.toggleAncestors;
|
||||
if (!toggles) return;
|
||||
toggles.forEach(toggle => {
|
||||
if (!toggle.condition) return;
|
||||
if (!toggle.condition.value){
|
||||
if (
|
||||
(!toggle.enabled && !toggle.disabled && toggle.condition && !toggle.condition.value)
|
||||
|| (toggle.disabled)
|
||||
) {
|
||||
prop.inactive = true;
|
||||
prop.deactivatedByToggle = true;
|
||||
prop.deactivatingToggleId = toggle._id;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user