-
Notifications
You must be signed in to change notification settings - Fork 30
feat: add weeds and compost #311
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
Changes from 5 commits
0d5e470
c92808e
6e95990
724f4c4
172722a
5a27de1
159e671
b4eed15
dac5556
2583b13
6b7d09e
c03b15b
a42cf79
d572730
140c9e0
5a02753
b0878a6
9b82a13
1f493b1
c0d7d8f
64a5675
6d96ae6
54086a5
3235c17
33d7d91
99fdcaa
760bcb4
ba36404
06a5b1f
e8f48b4
e7908c4
e830fad
8cf4ccd
bc9e211
e7aef69
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,11 @@ export const getBackgroundStyles = plotContent => { | |
|
|
||
| const backgroundImages = [] | ||
|
|
||
| if (plotContent.fertilizerType === fertilizerType.STANDARD) { | ||
| if ( | ||
| [fertilizerType.STANDARD, fertilizerType.COMPOST].includes( | ||
|
||
| plotContent.fertilizerType | ||
| ) | ||
| ) { | ||
| backgroundImages.push(`url(${plotStates['fertilized-plot']})`) | ||
| } else if (plotContent.fertilizerType === fertilizerType.RAINBOW) { | ||
| backgroundImages.push(`url(${plotStates['rainbow-fertilized-plot']})`) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ const { | |
| MILK, | ||
| SCARECROW, | ||
| SPRINKLER, | ||
| WEEDS, | ||
| } = itemType | ||
|
|
||
| export { | ||
|
|
@@ -50,6 +51,16 @@ export { | |
| wheatSeed, | ||
| } from './crops' | ||
|
|
||
| const weeds = freeze({ | ||
| id: 'weeds', | ||
| name: 'Weeds', | ||
|
||
| value: 0.1, | ||
| doesPriceFluctuate: false, | ||
| type: WEEDS, | ||
| }) | ||
|
|
||
| export { weeds } | ||
|
||
|
|
||
| export { bronzeOre, coal, goldOre, ironOre, silverOre, stone } from './ores' | ||
|
|
||
| //////////////////////////////////////// | ||
|
|
@@ -58,19 +69,6 @@ export { bronzeOre, coal, goldOre, ironOre, silverOre, stone } from './ores' | |
| // | ||
| //////////////////////////////////////// | ||
|
|
||
| /** | ||
| * @property farmhand.module:items.fertilizer | ||
| * @type {farmhand.item} | ||
| */ | ||
| export const fertilizer = freeze({ | ||
| description: 'Helps crops grow and mature a little faster.', | ||
| enablesFieldMode: fieldMode.FERTILIZE, | ||
| id: 'fertilizer', | ||
| name: 'Fertilizer', | ||
| type: FERTILIZER, | ||
| value: 25, | ||
| }) | ||
|
|
||
| /** | ||
| * @property farmhand.module:items.rainbowFertilizer | ||
| * @type {farmhand.item} | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,7 +1,7 @@ | ||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * @module farmhand.recipes | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| import { itemType, recipeType } from '../enums' | ||||||||||||||||||||||
| import { itemType, fieldMode, recipeType } from '../enums' | ||||||||||||||||||||||
| import { RECIPE_INGREDIENT_VALUE_MULTIPLIER } from '../constants' | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| import * as items from './items' | ||||||||||||||||||||||
|
|
@@ -11,7 +11,6 @@ const itemsMap = { ...baseItemsMap } | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| const itemify = recipe => { | ||||||||||||||||||||||
| const item = Object.freeze({ | ||||||||||||||||||||||
| ...recipe, | ||||||||||||||||||||||
| type: itemType.CRAFTED_ITEM, | ||||||||||||||||||||||
| value: Object.keys(recipe.ingredients).reduce( | ||||||||||||||||||||||
| (sum, itemId) => | ||||||||||||||||||||||
|
|
@@ -21,6 +20,7 @@ const itemify = recipe => { | |||||||||||||||||||||
| recipe.ingredients[itemId], | ||||||||||||||||||||||
| 0 | ||||||||||||||||||||||
| ), | ||||||||||||||||||||||
| ...recipe, | ||||||||||||||||||||||
| }) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| itemsMap[recipe.id] = item | ||||||||||||||||||||||
|
|
@@ -392,3 +392,34 @@ export const goldIngot = itemify({ | |||||||||||||||||||||
| state.purchasedSmelter && state.itemsSold[items.goldOre.id] >= 50, | ||||||||||||||||||||||
| recipeType: recipeType.FORGE, | ||||||||||||||||||||||
| }) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| export const compost = itemify({ | ||||||||||||||||||||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The purpose of this item may not be obvious to players, so we might want to add a
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah yeah. added, but where does that show up in the UI?
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That... is an excellent question! It looks like they only show in the Shop screen: farmhand/src/components/Item/Item.js Lines 267 to 276 in 3235c17
We should tweak that in a follow up PR, and I've opened #313 do get this done later. Thanks for adding this in the meantime! |
||||||||||||||||||||||
| id: 'compost', | ||||||||||||||||||||||
| name: 'Compost', | ||||||||||||||||||||||
| ingredients: { | ||||||||||||||||||||||
| [items.weeds.id]: 100, | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| condition: state => | ||||||||||||||||||||||
| state.purchasedComposter && state.itemsSold[items.weeds.id] >= 100, | ||||||||||||||||||||||
| recipeType: recipeType.KITCHEN, | ||||||||||||||||||||||
jeremyckahn marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||
| type: itemType.CRAFTED_ITEM, | ||||||||||||||||||||||
| }) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * @property farmhand.module:recipes.fertilizer | ||||||||||||||||||||||
| * @type {farmhand.item} | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| export const fertilizer = itemify({ | ||||||||||||||||||||||
| id: 'fertilizer', | ||||||||||||||||||||||
| name: 'Fertilizer', | ||||||||||||||||||||||
| ingredients: { | ||||||||||||||||||||||
| [compost.id]: 10, | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| condition: state => | ||||||||||||||||||||||
| state.purchasedComposter && state.itemsSold[compost.id] >= 10, | ||||||||||||||||||||||
| description: 'Helps crops grow and mature a little faster.', | ||||||||||||||||||||||
| enablesFieldMode: fieldMode.FERTILIZE, | ||||||||||||||||||||||
| recipeType: recipeType.KITCHEN, | ||||||||||||||||||||||
| type: itemType.FERTILIZER, | ||||||||||||||||||||||
| value: 25, | ||||||||||||||||||||||
| }) | ||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,7 @@ export const cropType = enumify([ | |
| 'TOMATO', | ||
| 'WATERMELON', | ||
| 'WHEAT', | ||
| 'WEEDS', | ||
|
||
| ]) | ||
|
|
||
| /** | ||
|
|
@@ -90,13 +91,19 @@ export const itemType = enumify([ | |
| 'SPRINKLER', | ||
| 'STONE', | ||
| 'TOOL_UPGRADE', | ||
| 'WEEDS', | ||
| ]) | ||
|
|
||
| /** | ||
| * @property farmhand.module:enums.fertilizerType | ||
| * @enum {string} | ||
| */ | ||
| export const fertilizerType = enumify(['NONE', 'STANDARD', 'RAINBOW']) | ||
| export const fertilizerType = enumify([ | ||
| 'NONE', | ||
| 'STANDARD', | ||
| 'RAINBOW', | ||
| 'COMPOST', | ||
|
||
| ]) | ||
|
|
||
| /** | ||
| * @property farmhand.module:enums.genders | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.