]> git.localhorst.tv Git - alttp.git/blobdiff - resources/js/helpers/tracker.js
better dungeon cleared check
[alttp.git] / resources / js / helpers / tracker.js
index c299e5c8e625734b32085deb22982a3eb5f4c291..92508d46f1bc9434b97e641c8132a4fd94f0a095 100644 (file)
@@ -948,7 +948,7 @@ export const UNDERWORLD_LOCATIONS = [
        {
                id: 'hype-cave-bottom',
                room: 0x11E,
-               chest: 4,
+               chest: 3,
        },
        {
                id: 'hype-cave-npc',
@@ -1607,6 +1607,15 @@ export const hasDungeonPrize = (state, dungeon) => !!state[`${dungeon.id}-prize-
 
 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 => {