rm free and bound
This commit is contained in:
parent
33ad4db8f5
commit
4920821ec2
@ -98,7 +98,7 @@ function Construct(props) {
|
||||
const duplicateSkill = construct.skills.length !== 0 && construct.skills.every(sk => {
|
||||
if (!itemEquip && itemEquip !== 0) return false;
|
||||
if (!sk) return false;
|
||||
return sk.skill === vbox.bound[itemEquip];
|
||||
return sk.skill === vbox.stash[itemEquip];
|
||||
});
|
||||
const tutorialDisableEquip = tutorialShouldDisableEquip(tutorial, iter, instance, construct);
|
||||
function onClick(e) {
|
||||
@ -136,7 +136,7 @@ function Construct(props) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const equipping = skillList.includes(vbox.bound[itemEquip]) && !skill
|
||||
const equipping = skillList.includes(vbox.stash[itemEquip]) && !skill
|
||||
&& !tutorialDisableEquip && !duplicateSkill && i === construct.skills.length;
|
||||
const border = () => {
|
||||
if (!skill) return '';
|
||||
@ -169,7 +169,7 @@ function Construct(props) {
|
||||
const s = construct.specs[i];
|
||||
|
||||
if (!s) {
|
||||
const equipping = specList.includes(vbox.bound[itemEquip]) && i === construct.specs.length;
|
||||
const equipping = specList.includes(vbox.stash[itemEquip]) && i === construct.specs.length;
|
||||
const classes = `${equipping ? 'equipping' : 'gray'} empty`;
|
||||
return (
|
||||
<button key={i} class={classes} disabled={!equipping} >
|
||||
|
||||
@ -48,7 +48,7 @@ class Combiner extends preact.Component {
|
||||
class='combiner vbox-btn'
|
||||
onClick={e => e.stopPropagation()}
|
||||
onMouseDown={vboxBuySelected}>
|
||||
{`Buy ${vbox.free[item[0]][item[1]]} ${item[0] + 1}b`}
|
||||
{`Buy ${vbox.store[item[0]][item[1]]} ${item[0] + 1}b`}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ class Vbox extends preact.Component {
|
||||
|
||||
function stashHdr() {
|
||||
const refund = storeSelect.length === 0 && stashSelect.length === 1
|
||||
? itemInfo.items.find(i => i.item === vbox.bound[stashSelect[0]]).cost
|
||||
? itemInfo.items.find(i => i.item === vbox.stash[stashSelect[0]]).cost
|
||||
: 0;
|
||||
const tutorialDisabled = tutorial && tutorial < 8
|
||||
&& instance.time_control === 'Practice' && instance.rounds.length === 1;
|
||||
|
||||
@ -81,7 +81,7 @@ class stashElement extends preact.Component {
|
||||
}
|
||||
|
||||
if (notValidCombo) {
|
||||
setInfo(vbox.bound[i]);
|
||||
setInfo(vbox.stash[i]);
|
||||
return setVboxSelected({ storeSelect: [], stashSelect: [i] });
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ class stashElement extends preact.Component {
|
||||
onDragOver={ev => ev.preventDefault()}
|
||||
onDrop={stashClick}
|
||||
>
|
||||
{range(0, 6).map(i => stashBtn(vbox.bound[i], i))}
|
||||
{range(0, 6).map(i => stashBtn(vbox.stash[i], i.toString()))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ class storeElement extends preact.Component {
|
||||
const { storeSelect, stashSelect } = vboxSelected;
|
||||
|
||||
function availableBtn(v, group, index) {
|
||||
if (!v) return <button disabled class='empty' key={(group * 10) + index} > </button>;
|
||||
if (!v) return <button disabled class='empty' key={group + index} > </button>;
|
||||
const selected = storeSelect.length && storeSelect.some(vs => vs[0] === group && vs[1] === index);
|
||||
|
||||
const notValidCombo = vboxHighlight && !vboxHighlight.includes(v);
|
||||
@ -63,7 +63,7 @@ class storeElement extends preact.Component {
|
||||
const disabled = vbox.bits <= group;
|
||||
return (
|
||||
<label
|
||||
key={group * 10 + index}
|
||||
key={group + index}
|
||||
onDragEnd={clearVboxSelected}>
|
||||
<button
|
||||
class={classes}
|
||||
@ -81,11 +81,11 @@ class storeElement extends preact.Component {
|
||||
<div class='store'
|
||||
onClick={e => e.stopPropagation()}>
|
||||
<div class="vbox-colours">
|
||||
{range(0, 6).map(i => availableBtn(vbox.free[0][i], 0, i))}
|
||||
{range(0, 6).map(i => availableBtn(vbox.store['Colours'][i], 'Colours', i.toString()))}
|
||||
</div>
|
||||
<div class="vbox-items">
|
||||
{range(0, 3).map(i => availableBtn(vbox.free[1][i], 1, i))}
|
||||
{range(0, 3).map(i => availableBtn(vbox.free[2][i], 2, i))}
|
||||
{range(0, 3).map(i => availableBtn(vbox.store['Skills'][i], 'Skills', i.toString()))}
|
||||
{range(0, 3).map(i => availableBtn(vbox.store['Specs'][i], 'Specs', i.toString()))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@ -23,8 +23,8 @@ function setVboxState(dispatch, vboxSelected, state) {
|
||||
|
||||
if (!(storeSelect.length === 0 && stashSelect.length === 0)) {
|
||||
vboxHighlight = [];
|
||||
const stashItems = stashSelect.map(j => vbox.bound[j]);
|
||||
const shopItems = storeSelect.map(j => vbox.free[j[0]][j[1]]);
|
||||
const stashItems = stashSelect.map(j => vbox.stash[j]);
|
||||
const shopItems = storeSelect.map(j => vbox.store[j[0]][j[1]]);
|
||||
|
||||
const selectedItems = stashItems.concat(shopItems);
|
||||
const itemCount = countBy(selectedItems, co => co);
|
||||
@ -55,12 +55,12 @@ function setVboxState(dispatch, vboxSelected, state) {
|
||||
const vboxInfo = () => {
|
||||
if (vboxCombiner) return vboxCombiner;
|
||||
if (itemUnequip.length) return itemUnequip[1];
|
||||
const stashBase = stashSelect.find(i => !(['Red', 'Blue', 'Green'].includes(vbox.bound[i])));
|
||||
if (stashBase > -1) return vbox.bound[stashBase];
|
||||
const storeBase = storeSelect.find(j => !(['Red', 'Blue', 'Green'].includes(vbox.free[j[0]][j[1]])));
|
||||
if (storeBase) return vbox.free[storeBase[0]][storeBase[1]];
|
||||
if (stashSelect.length > 0) return vbox.bound[stashSelect[0]];
|
||||
if (storeSelect.length > 0) return vbox.free[storeSelect[0][0]][storeSelect[0][1]];
|
||||
const stashBase = stashSelect.find(i => !(['Red', 'Blue', 'Green'].includes(vbox.stash[i])));
|
||||
if (stashBase > -1) return vbox.stash[stashBase];
|
||||
const storeBase = storeSelect.find(j => !(['Red', 'Blue', 'Green'].includes(vbox.store[j[0]][j[1]])));
|
||||
if (storeBase) return vbox.store[storeBase[0]][storeBase[1]];
|
||||
if (stashSelect.length > 0) return vbox.stash[stashSelect[0]];
|
||||
if (storeSelect.length > 0) return vbox.store[storeSelect[0][0]][storeSelect[0][1]];
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
@ -24,21 +24,21 @@ function tutorialVbox(player, store, tutorial) {
|
||||
if (vbox.bits < 29) {
|
||||
stage += 1;
|
||||
} else {
|
||||
vbox.free[0] = vbox.free[0].slice(0, 2);
|
||||
vbox.free[1] = [];
|
||||
vbox.free[2] = [];
|
||||
vbox.bound.fill(null, 0, 3);
|
||||
vbox.store[0] = vbox.store[0].slice(0, 2);
|
||||
vbox.store[1] = [];
|
||||
vbox.store[2] = [];
|
||||
vbox.stash.fill(null, 0, 3);
|
||||
}
|
||||
}
|
||||
|
||||
if (stage === 2) {
|
||||
if (!(vbox.bound.slice(0, 3).every(i => i === 'Attack') && vbox.bound.length >= 3)) {
|
||||
if (!(vbox.stash.slice(0, 3).every(i => i === 'Attack') && vbox.stash.length >= 3)) {
|
||||
stage += 1;
|
||||
} else {
|
||||
vbox.free[0] = vbox.free[0].slice(0, 2);
|
||||
vbox.free[1] = [];
|
||||
vbox.free[2] = [];
|
||||
vbox.bound.fill(null, 1, 3);
|
||||
vbox.store[0] = vbox.store[0].slice(0, 2);
|
||||
vbox.store[1] = [];
|
||||
vbox.store[2] = [];
|
||||
vbox.stash.fill(null, 1, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,21 +46,21 @@ function tutorialVbox(player, store, tutorial) {
|
||||
if (player.constructs[0].skills.length !== 0) {
|
||||
stage += 1;
|
||||
} else {
|
||||
vbox.free[0] = vbox.free[0].slice(0, 2);
|
||||
vbox.free[1] = [];
|
||||
vbox.free[2] = [];
|
||||
vbox.bound.fill(null, 0, 2);
|
||||
vbox.store[0] = vbox.store[0].slice(0, 2);
|
||||
vbox.store[1] = [];
|
||||
vbox.store[2] = [];
|
||||
vbox.stash.fill(null, 0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
if (stage === 4) {
|
||||
if (!vbox.free[2][0] || vbox.bits < 24) {
|
||||
if (!vbox.store[2][0] || vbox.bits < 24) {
|
||||
stage += 1;
|
||||
} else {
|
||||
vbox.free[0] = [];
|
||||
vbox.free[1] = [];
|
||||
vbox.free[2] = vbox.free[2].slice(0, 1);
|
||||
vbox.bound.fill(null, 0, 2);
|
||||
vbox.store[0] = [];
|
||||
vbox.store[1] = [];
|
||||
vbox.store[2] = vbox.store[2].slice(0, 1);
|
||||
vbox.stash.fill(null, 0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,10 +68,10 @@ function tutorialVbox(player, store, tutorial) {
|
||||
if (player.constructs[0].specs.length !== 0) {
|
||||
stage += 1;
|
||||
} else {
|
||||
vbox.free[0] = [];
|
||||
vbox.free[1] = [];
|
||||
vbox.free[2] = vbox.free[2].slice(0, 1);
|
||||
vbox.bound.fill(null, 0, 2);
|
||||
vbox.store[0] = [];
|
||||
vbox.store[1] = [];
|
||||
vbox.store[2] = vbox.store[2].slice(0, 1);
|
||||
vbox.stash.fill(null, 0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,9 +79,9 @@ function tutorialVbox(player, store, tutorial) {
|
||||
if (player.constructs.every(c => c.skills.length !== 0)) {
|
||||
stage += 1;
|
||||
} else {
|
||||
vbox.free[0] = [];
|
||||
vbox.free[1] = [];
|
||||
vbox.free[2] = [];
|
||||
vbox.store[0] = [];
|
||||
vbox.store[1] = [];
|
||||
vbox.store[2] = [];
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,9 +89,9 @@ function tutorialVbox(player, store, tutorial) {
|
||||
if (vbox.bits < 25) {
|
||||
stage += 1;
|
||||
} else {
|
||||
vbox.free[0] = [];
|
||||
vbox.free[1] = [];
|
||||
vbox.free[2] = [];
|
||||
vbox.store[0] = [];
|
||||
vbox.store[1] = [];
|
||||
vbox.store[2] = [];
|
||||
}
|
||||
}
|
||||
store.dispatch(actions.setTutorial(stage));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user