vbox highlight for combiner

This commit is contained in:
Mashy 2019-10-16 18:27:06 +10:00
parent 03a0953b46
commit ea5d908893

View File

@ -169,12 +169,28 @@ function Vbox(args) {
function onClick(e) {
e.stopPropagation();
setItemEquip(null);
setCombiner([]);
if (selected) return clearVboxSelected();
return setVboxSelected([group, index]);
}
const classes = `${v.toLowerCase()} ${selected ? 'highlight' : ''}`;
const combinerItems = combiner.map(j => vbox.bound[j]);
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;
});
} return false;
}) ? 'combo-border' : '';
const classes = `${v.toLowerCase()} ${selected ? 'highlight' : ''} ${comboHighlight}`;
if (shapes[v]) {
return (