@jeremyckahn/farmhand
Version:
A farming game
18 lines (15 loc) • 375 B
text/typescript
import { recipesMap } from '../../data/maps.js'
export const updateLearnedRecipes = (
state: farmhand.state
): farmhand.state => ({
...state,
learnedRecipes: Object.keys(recipesMap).reduce(
(acc: Record<string, boolean>, recipeId) => {
if (recipesMap[recipeId].condition(state)) {
acc[recipeId] = true
}
return acc
},
{}
),
})