From 245cb603fc4ec2fee5f6bb50bfd0de5acab676cc Mon Sep 17 00:00:00 2001 From: Mashy Date: Thu, 17 Oct 2019 09:33:26 +1000 Subject: [PATCH] improve check --- client/src/components/vbox.component.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/components/vbox.component.jsx b/client/src/components/vbox.component.jsx index 02551acc..8152aad6 100644 --- a/client/src/components/vbox.component.jsx +++ b/client/src/components/vbox.component.jsx @@ -177,12 +177,13 @@ function Vbox(args) { } const combinerItems = combiner.map(j => vbox.bound[j]); + const combinerCount = countBy(combinerItems, co => co); + const comboHighlight = combinerItems.length > 0 && itemInfo.combos.some(combo => { if (combo.components.includes(v)) { return combinerItems.every(c => { if (!combo.components.includes(c)) return false; const comboCount = countBy(combo.components, co => co); - const combinerCount = countBy(combinerItems, co => co); if (combinerCount[c] > comboCount[c]) return false; if (c === v && combinerCount[c] + 1 > comboCount[c]) return false; return true; @@ -264,12 +265,13 @@ function Vbox(args) { } const combinerItems = combiner.map(j => vbox.bound[j]); + const combinerCount = countBy(combinerItems, co => co); + const comboHighlight = combinerItems.length > 0 && itemInfo.combos.some(combo => { if (combo.components.includes(v)) { return combinerItems.every(c => { if (!combo.components.includes(c)) return false; const comboCount = countBy(combo.components, co => co); - const combinerCount = countBy(combinerItems, co => co); if (combinerCount[c] > comboCount[c]) return false; if (c === v && combinerCount[c] + 1 > comboCount[c]) return false; return true;