highlight potential inv combos

This commit is contained in:
Mashy
2019-10-16 14:20:44 +10:00
parent 1abe4ed08e
commit 5dbdc3762f
2 changed files with 27 additions and 1 deletions
+14 -1
View File
@@ -283,9 +283,22 @@ function Vbox(args) {
return combinerChange(combiner);
}
const combinerItems = combiner.map(j => vbox.bound[j]);
const comboHighlight = combinerItems.length > 0 && itemInfo.combos.some(combo => {
if (combo.components.includes(v) && combinerItems.every(c => combo.components.includes(c))) {
return combinerItems.every(c => {
if (c !== v) return true;
const comboCount = countBy(combo.components, co => co);
const combinerCounts = countBy(combinerItems, co => co);
if (comboCount[c] > combinerCounts[c]) return true;
return false;
});
} return false;
}) ? 'combo-border' : '';
const highlighted = combiner.indexOf(i) > -1;
const border = buttons[removeTier(v)] ? buttons[removeTier(v)]() : '';
const classes = `${highlighted ? 'highlight' : border}`;
const classes = `${highlighted ? 'highlight' : border} ${comboHighlight}`;
if (shapes[v]) {
return (
<button