mask: DUNGEON_MASKS.HC,
checks: [
'dark-cross',
- 'hc-map',
+ 'hc-map-chest',
'hc-boom',
'hc-cell',
'sanc',
chest: 0,
},
{
- id: 'hc-map',
+ id: 'hc-map-chest',
area: 'hc',
room: 0x72,
chest: 0,
{
id: 'hype-cave-bottom',
room: 0x11E,
- chest: 4,
+ chest: 3,
},
{
id: 'hype-cave-npc',
{
id: 'paradox-lower-far-right',
room: 0xEF,
- chest: 4,
+ chest: 3,
},
{
id: 'paradox-lower-mid',
room: 0xEF,
- chest: 5,
+ chest: 4,
},
{
id: 'paradox-upper-left',
{
id: 'waterfall-fairy-left',
room: 0x114,
- chest: 4,
+ chest: 0,
},
{
id: 'waterfall-fairy-right',
room: 0x114,
- chest: 5,
+ chest: 1,
},
];
return null;
};
+export const clearAll = names => state => {
+ const changes = names.reduce((acc, cur) => ({ ...acc, [cur]: true }), {});
+ return { ...state, ...changes };
+};
+
+export const unclearAll = names => state => {
+ const changes = names.reduce((acc, cur) => ({ ...acc, [cur]: false }), {});
+ return { ...state, ...changes };
+};
+
export const hasDungeonBoss = (state, dungeon) => !!state[`${dungeon.id}-boss-defeated`];
export const getDungeonBoss = (state, dungeon) =>
export const getDungeonPrize = (state, dungeon) => state[`${dungeon.id}-prize`] || null;
+export const isDungeonCleared = (state, dungeon) => {
+ const cleared = state[`${dungeon.id}-checks`] || 0;
+ const total = dungeon.items;
+ const hasItems = cleared >= total;
+ const hasBoss = !dungeon.boss || hasDungeonBoss(state, dungeon);
+ const hasPrize = !dungeon.porize || hasDungeonPrize(state, dungeon);
+ return hasItems && hasBoss && hasPrize;
+};
+
export const makeEmptyState = () => {
const state = {};
BOOLEAN_STATES.forEach(p => {
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;
};