Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(closes #491): Winemaking #497

Merged
merged 91 commits into from
Jun 9, 2024
Merged

feat(closes #491): Winemaking #497

merged 91 commits into from
Jun 9, 2024

Conversation

jeremyckahn
Copy link
Owner

What this PR does

For #491, this PR implements Winemaking. Wine works similarly to fermented crop recipes: Once the player purchases a cellar, they can combine Yeast and Grapes to produce a Wine keg. Wine kegs compound in value but top out at 100 days after maturity. Unlike fermented crops, wines do not spoil.

This PR also changes how Bread-related recipes work. Previously, Wheat could be made directly into Bread. Now, Wheat must be made into Flour which can then be made into Bread. This was changed to allow Flour to be made into Yeast, which is a new ingredient of Bread but also Wine. This has the downstream effect of raising the value of all Bread-derived recipes.

This PR also makes a few small tweaks throughout the UX. Specifically, the Items Sold list under Farm Stats is ordered alphabetically by name, and the Quantity Input UX has been improved to work more consistently.

This PR also updates and improves various type annotations throughout the project.

How this change can be validated

I recommend modifying the game state to give yourself a lot of money, grape items, and wheat. Here's a save file that can be used to get a head start.

  • Validate that Wheat can be made into Flour
  • Validate that Flour can be made into Yeast
  • Validate that Flour and Yeast can be made into Bread
  • Validate that the "Winemaking" tab appears on the Cellar screen after a Cellar is purchased
  • Validate that various wines can be created according to their indicated ingredient requirements (different wines require different amounts of Yeast, but always 50 of their respective grape)
  • Validate that wines take several days to mature (different wines take different amounts of time)
  • Validate that wine kegs in the Cellar increase in value for up to 100 days and then stop
  • Validate that wine kegs do not spoil
  • Validate the wine kegs can be sold (each wine has a different value)

Additional information

This is just the first iteration of this feature and I'm sure it will be improved and expanded over time.

This PR introduces a lot of commented-out wine recipes. These will be enabled in a future update.

Screenshot of wine recipes

Screenshot of wine kegs at peak maturity

@jeremyckahn jeremyckahn added the enhancement New feature or request label May 26, 2024
@jeremyckahn jeremyckahn requested a review from lstebner May 26, 2024 21:35
Copy link

vercel bot commented May 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
farmhand ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 9, 2024 3:17pm

Copy link
Collaborator

@lstebner lstebner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the stub savestate, it was quite helpful. i ended up with just a few comments and i wouldn't consider any required to change so i'll go ahead and approve as well. this is a huge feature so i also want to say nice work!

src/components/Cellar/Keg.js Outdated Show resolved Hide resolved
src/components/Cellar/Keg.js Show resolved Hide resolved
src/data/crops/grape.js Outdated Show resolved Hide resolved
src/services/wine.js Outdated Show resolved Hide resolved
[yeast.id]: getYeastRequiredForWine(grape.variety),
},
recipeType: recipeType.WINE,
// NOTE: This prevents wines from appearing in the Learned Recipes list in the Workshop
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also (or maybe instead?) update the workshop to filter out recipeType === recipeType.WINE recipes?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem that the additional filtering logic would change the behavior caused by this, and I don't think it's worth introducing code that isn't necessary.

Taking the filtering approach in the Workshop rendering logic would also be good solution, but condition is a required property of farmhand.recipe, so I figure we might at well use it to solve this specific problem (even if it's a bit of an unusual use of the mechanism):

farmhand/src/index.js

Lines 158 to 165 in cc2b3c0

/**
* @typedef {farmhand.item & {
* recipeType: recipeType, // The type of recipe of recipe this is.
* ingredients: Record<string, number>, // An object where each key is the id of a farmhand.item and the value is the quantity of that item.
* condition: farmhand.recipeCondition, // This must return `true` for the recipe to be made available to the player.
* }} farmhand.recipe
* @readonly
*/

Copy link
Owner Author

@jeremyckahn jeremyckahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the excellent review, @lstebner! I think the code is in much better shape with your suggestions. I'll merge and ship this!

[yeast.id]: getYeastRequiredForWine(grape.variety),
},
recipeType: recipeType.WINE,
// NOTE: This prevents wines from appearing in the Learned Recipes list in the Workshop
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem that the additional filtering logic would change the behavior caused by this, and I don't think it's worth introducing code that isn't necessary.

Taking the filtering approach in the Workshop rendering logic would also be good solution, but condition is a required property of farmhand.recipe, so I figure we might at well use it to solve this specific problem (even if it's a bit of an unusual use of the mechanism):

farmhand/src/index.js

Lines 158 to 165 in cc2b3c0

/**
* @typedef {farmhand.item & {
* recipeType: recipeType, // The type of recipe of recipe this is.
* ingredients: Record<string, number>, // An object where each key is the id of a farmhand.item and the value is the quantity of that item.
* condition: farmhand.recipeCondition, // This must return `true` for the recipe to be made available to the player.
* }} farmhand.recipe
* @readonly
*/

src/services/wine.js Outdated Show resolved Hide resolved
src/data/crops/grape.js Outdated Show resolved Hide resolved
src/components/Cellar/Keg.js Show resolved Hide resolved
src/components/Cellar/Keg.js Outdated Show resolved Hide resolved
@jeremyckahn jeremyckahn merged commit 1c061ce into develop Jun 9, 2024
6 checks passed
@jeremyckahn jeremyckahn deleted the feature/491__winemaking branch June 9, 2024 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants