</div>
<div className="item">
<ToggleIcon controller={ToggleIcon.medallionController} icons={['bombos']} />
+ {state['mm-medallion'] === 'bombos' ?
+ <span className="med-display bottom-left">MM</span>
+ : null}
+ {state['tr-medallion'] === 'bombos' ?
+ <span className="med-display bottom-right">TR</span>
+ : null}
</div>
<div className="item">
<ToggleIcon controller={ToggleIcon.medallionController} icons={['ether']} />
+ {state['mm-medallion'] === 'ether' ?
+ <span className="med-display bottom-left">MM</span>
+ : null}
+ {state['tr-medallion'] === 'ether' ?
+ <span className="med-display bottom-right">TR</span>
+ : null}
</div>
<div className="item">
<ToggleIcon controller={ToggleIcon.medallionController} icons={['quake']} />
+ {state['mm-medallion'] === 'quake' ?
+ <span className="med-display bottom-left">MM</span>
+ : null}
+ {state['tr-medallion'] === 'quake' ?
+ <span className="med-display bottom-right">TR</span>
+ : null}
</div>
<div className="item">
<ToggleIcon controller={ToggleIcon.simpleController} icons={['lamp']} />
getActive: highestActive,
getDefault: firstIcon,
handlePrimary: nextIcon,
- handleSecondary: doNothing,
+ handleSecondary: (state, setState, icons) => {
+ const mm = state['mm-medallion'];
+ const tr = state['tr-medallion'];
+ const isMM = mm === icons[0];
+ const isTR = tr === icons[0];
+ console.log({ mm, isMM, tr, isTR });
+ if (!isMM && !isTR) {
+ // empty: set as MM if mire is unset, else set as TR if TR is unset
+ if (!mm) {
+ setState(s => ({ ...s, 'mm-medallion': icons[0] }));
+ } else if (!tr) {
+ setState(s => ({ ...s, 'tr-medallion': icons[0] }));
+ }
+ } else if (isMM && !isTR) {
+ // MM: if TR is free, switch to TR, otherwise remove MM
+ if (!tr) {
+ setState(s => ({ ...s, 'mm-medallion': null, 'tr-medallion': icons[0] }));
+ } else {
+ setState(s => ({ ...s, 'mm-medallion': null }));
+ }
+ } else if (!isMM && isTR) {
+ // TR: if MM is free, switch to both, otherwise remove TR
+ if (!mm) {
+ setState(s => ({ ...s, 'mm-medallion': icons[0] }));
+ } else {
+ setState(s => ({ ...s, 'tr-medallion': null }));
+ }
+ } else {
+ // both: remove both
+ setState(s => ({ ...s, 'mm-medallion': null, 'tr-medallion': null }));
+ }
+ },
};
ToggleIcon.modulusController = ctrl => ({
state[`${dungeon.id}-prize-acquired`] = false;
}
});
+ OVERWORLD_LOCATIONS.forEach(location => {
+ state[location.id] = false;
+ });
+ UNDERWORLD_LOCATIONS.forEach(location => {
+ state[location.id] = false;
+ });
+ state['mm-medallion'] = null;
+ state['tr-medallion'] = null;
return state;
};