]> git.localhorst.tv Git - alttp.git/blobdiff - resources/js/hooks/tracker.js
base logic test cases
[alttp.git] / resources / js / hooks / tracker.js
index 30bf2426a7a125781f2aa5579e9e9a389f74511e..ce01c4b94079dd646e17f9263882a85544bc3153 100644 (file)
@@ -5,6 +5,7 @@ import {
        CONFIG,
        DUNGEONS,
        applyLogic,
+       configureDungeons,
        makeEmptyState,
        mergeStates,
 } from '../helpers/tracker';
@@ -37,25 +38,7 @@ export const TrackerProvider = ({ children }) => {
        }, []);
 
        React.useEffect(() => {
-               const newDungeons = DUNGEONS.map(dungeon => {
-                       const newDungeon = JSON.parse(JSON.stringify(dungeon));
-                       if (config.wildMap && dungeon.map) {
-                               ++newDungeon.items;
-                       }
-                       if (config.wildCompass && dungeon.compass) {
-                               ++newDungeon.items;
-                       }
-                       if (config.wildSmall) {
-                               newDungeon.items += dungeon.sk;
-                       }
-                       if (config.wildBig && dungeon.bk && !dungeon.dropBk) {
-                               ++newDungeon.items;
-                       }
-                       if (!config.bossShuffle && dungeon.boss) {
-                               newDungeon.bosses = [dungeon.boss];
-                       }
-                       return newDungeon;
-               });
+               const newDungeons = configureDungeons(config);
                setDungeons(newDungeons);
        }, [config]);
 
@@ -68,7 +51,6 @@ export const TrackerProvider = ({ children }) => {
        }, [config, dungeons, state]);
 
        const value = React.useMemo(() => {
-               console.log(logic);
                return { config, dungeons, logic, saveConfig, setAutoState, setManualState, state };
        }, [config, dungeons, logic, state]);