Skip to content

Commit

Permalink
Merge patch commit
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jan 16, 2024
2 parents 81665a9 + de83ce7 commit 5b48165
Show file tree
Hide file tree
Showing 173 changed files with 411 additions and 348 deletions.
13 changes: 8 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jeremyckahn/farmhand",
"version": "1.18.7",
"version": "1.18.8",
"publishConfig": {
"access": "public"
},
Expand Down
11 changes: 11 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
* @ignore
*/

/**
* @typedef {import('./index').farmhand.purchaseableFieldSize} farmhand.purchaseableFieldSize
*/

import { cowColors, fieldMode, stageFocusType, toolLevel } from './enums'

const { freeze } = Object
Expand Down Expand Up @@ -34,6 +38,9 @@ export const STORAGE_EXPANSION_SCALE_PREMIUM = 50
export const INITIAL_FIELD_WIDTH = 6
export const INITIAL_FIELD_HEIGHT = 10

/**
* @type Map<number, farmhand.purchaseableFieldSize>
*/
export const PURCHASEABLE_FIELD_SIZES = freeze(
new Map([
[1, { columns: 8, rows: 12, price: 1_000 }],
Expand All @@ -42,6 +49,10 @@ export const PURCHASEABLE_FIELD_SIZES = freeze(
])
)

export const LARGEST_PURCHASABLE_FIELD_SIZE = /** @type {farmhand.purchaseableFieldSize} */ (PURCHASEABLE_FIELD_SIZES.get(
PURCHASEABLE_FIELD_SIZES.size
))

export const PURCHASEABLE_COMBINES = freeze(
new Map([[1, { type: 'Basic', price: 500_000 }]])
)
Expand Down
19 changes: 4 additions & 15 deletions src/data/__mocks__/items.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { testItem } from '../../test-utils'
import { cropLifeStage, itemType } from '../../enums'

const { SEED, GROWING } = cropLifeStage
import { itemType } from '../../enums'

// Patch the original items data into the mock. This has the potential to break
// with future versions of Webpack (keep an eye on
Expand Down Expand Up @@ -87,10 +85,7 @@ export const sampleCropItem1 = testItem({
name: 'Sample Crop Item 1',
type: itemType.CROP,
value: 2,
cropTimetable: {
[SEED]: 1,
[GROWING]: 2,
},
cropTimeline: [1, 2],
})

export const sampleCropSeedsItem2 = testItem({
Expand All @@ -111,10 +106,7 @@ export const sampleCropItem2 = testItem({
name: 'Sample Crop Item 2',
type: itemType.CROP,
value: 3,
cropTimetable: {
[SEED]: 2,
[GROWING]: 3,
},
cropTimeline: [2, 3],
})

export const sampleCropSeedsItem3 = testItem({
Expand All @@ -134,10 +126,7 @@ export const sampleCropItem3 = testItem({
name: 'Sample Crop Item 3',
type: itemType.CROP,
value: 4,
cropTimetable: {
[SEED]: 5,
[GROWING]: 5,
},
cropTimeline: [5, 5],
})

export const sampleFieldTool1 = testItem({
Expand Down
12 changes: 6 additions & 6 deletions src/data/crop.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ const { freeze } = Object
* @returns {farmhand.item}
*/
export const crop = ({
cropTimetable,
cropTimeline,
growsInto,
tier,

isSeed = Boolean(growsInto),
cropLifecycleDuration = getCropLifecycleDuration({ cropTimetable }),
cropLifecycleDuration = getCropLifecycleDuration({ cropTimeline }),

...rest
}) =>
freeze({
cropTimetable,
cropTimeline,
doesPriceFluctuate: true,
tier,
type: itemType.CROP,
Expand All @@ -41,20 +41,20 @@ export const crop = ({
* @returns {farmhand.item}
*/
export const fromSeed = (
{ cropTimetable, cropType, growsInto, tier },
{ cropTimeline, cropType, growsInto, tier },
{ variantIdx = 0, canBeFermented = false } = {}
) => {
const variants = Array.isArray(growsInto) ? growsInto : [growsInto]

return {
cropTimetable,
cropTimeline,
cropType,
doesPriceFluctuate: true,
id: variants[variantIdx],
tier,
type: itemType.CROP,
...(canBeFermented && {
daysToFerment: getCropLifecycleDuration({ cropTimetable }) * tier,
daysToFerment: getCropLifecycleDuration({ cropTimeline }) * tier,
}),
}
}
11 changes: 4 additions & 7 deletions src/data/crops/asparagus.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { crop, fromSeed } from '../crop'
import { cropLifeStage, cropType } from '../../enums'
/** @typedef {import('../../components/Farmhand/Farmhand').farmhand.item} farmhand.item */

const { SEED, GROWING } = cropLifeStage
import { crop, fromSeed } from '../crop'
import { cropType } from '../../enums'

/**
* @property farmhand.module:items.asparagusSeed
* @type {farmhand.item}
*/
export const asparagusSeed = crop({
cropType: cropType.ASPARAGUS,
cropTimetable: {
[SEED]: 4,
[GROWING]: 5,
},
cropTimeline: [4, 2, 2, 1],
growsInto: 'asparagus',
id: 'asparagus-seed',
name: 'Asparagus Seed',
Expand Down
9 changes: 2 additions & 7 deletions src/data/crops/carrot.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
/** @typedef {import("../../index").farmhand.item} item */

import { crop, fromSeed } from '../crop'
import { cropLifeStage, cropType } from '../../enums'

const { SEED, GROWING } = cropLifeStage
import { cropType } from '../../enums'

/**
* @property farmhand.module:items.carrotSeed
* @type {item}
*/
export const carrotSeed = crop({
cropType: cropType.CARROT,
cropTimetable: {
[SEED]: 2,
[GROWING]: 3,
},
cropTimeline: [2, 1, 1, 1],
growsInto: 'carrot',
id: 'carrot-seed',
name: 'Carrot Seed',
Expand Down
11 changes: 4 additions & 7 deletions src/data/crops/corn.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { crop, fromSeed } from '../crop'
import { cropLifeStage, cropType } from '../../enums'
/** @typedef {import('../../components/Farmhand/Farmhand').farmhand.item} farmhand.item */

const { SEED, GROWING } = cropLifeStage
import { crop, fromSeed } from '../crop'
import { cropType } from '../../enums'

/**
* @property farmhand.module:items.cornSeed
* @type {farmhand.item}
*/
export const cornSeed = crop({
cropType: cropType.CORN,
cropTimetable: {
[SEED]: 3,
[GROWING]: 7,
},
cropTimeline: [3, 1, 1, 1, 2, 2],
growsInto: 'corn',
id: 'corn-seed',
name: 'Corn Kernels',
Expand Down
11 changes: 4 additions & 7 deletions src/data/crops/garlic.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { crop, fromSeed } from '../crop'
import { cropLifeStage, cropType } from '../../enums'
/** @typedef {import('../../components/Farmhand/Farmhand').farmhand.item} farmhand.item */

const { SEED, GROWING } = cropLifeStage
import { crop, fromSeed } from '../crop'
import { cropType } from '../../enums'

/**
* @property farmhand.module:items.garlicSeed
* @type {farmhand.item}
*/
export const garlicSeed = crop({
cropType: cropType.GARLIC,
cropTimetable: {
[SEED]: 2,
[GROWING]: 3,
},
cropTimeline: [2, 1, 1, 1],
growsInto: 'garlic',
id: 'garlic-seed',
name: 'Garlic Bulb',
Expand Down
9 changes: 2 additions & 7 deletions src/data/crops/grape.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,15 @@
/** @typedef {import("../../index").farmhand.cropVariety} farmhand.cropVariety */

import { crop, fromSeed } from '../crop'
import { cropLifeStage, cropType } from '../../enums'

const { SEED, GROWING } = cropLifeStage
import { cropType } from '../../enums'

/**
* @property farmhand.module:items.grapeSeed
* @type {farmhand.item}
*/
export const grapeSeed = crop({
cropType: cropType.GRAPE,
cropTimetable: {
[SEED]: 3,
[GROWING]: 4,
},
cropTimeline: [3, 4],
growsInto: [
'grape-chardonnay',
'grape-sauvignon-blanc',
Expand Down
11 changes: 4 additions & 7 deletions src/data/crops/jalapeno.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { crop, fromSeed } from '../crop'
import { cropLifeStage, cropType } from '../../enums'
/** @typedef {import('../../components/Farmhand/Farmhand').farmhand.item} farmhand.item */

const { SEED, GROWING } = cropLifeStage
import { crop, fromSeed } from '../crop'
import { cropType } from '../../enums'

/**
* @property farmhand.module:items.jalapenoSeed
* @type {farmhand.item}
*/
export const jalapenoSeed = crop({
cropType: cropType.JALAPENO,
cropTimetable: {
[SEED]: 2,
[GROWING]: 3,
},
cropTimeline: [2, 1, 1, 1],
growsInto: 'jalapeno',
id: 'jalapeno-seed',
name: 'Jalapeño Seed',
Expand Down
11 changes: 4 additions & 7 deletions src/data/crops/olive.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { crop, fromSeed } from '../crop'
import { cropLifeStage, cropType } from '../../enums'
/** @typedef {import('../../components/Farmhand/Farmhand').farmhand.item} farmhand.item */

const { SEED, GROWING } = cropLifeStage
import { crop, fromSeed } from '../crop'
import { cropType } from '../../enums'

/**
* @property farmhand.module:items.oliveSeed
* @type {farmhand.item}
*/
export const oliveSeed = crop({
cropType: cropType.OLIVE,
cropTimetable: {
[SEED]: 3,
[GROWING]: 6,
},
cropTimeline: [3, 6],
growsInto: 'olive',
id: 'olive-seed',
name: 'Olive Seed',
Expand Down
11 changes: 4 additions & 7 deletions src/data/crops/onion.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { crop, fromSeed } from '../crop'
import { cropLifeStage, cropType } from '../../enums'
/** @typedef {import('../../components/Farmhand/Farmhand').farmhand.item} farmhand.item */

const { SEED, GROWING } = cropLifeStage
import { crop, fromSeed } from '../crop'
import { cropType } from '../../enums'

/**
* @property farmhand.module:items.onionSeed
* @type {farmhand.item}
*/
export const onionSeed = crop({
cropType: cropType.ONION,
cropTimetable: {
[SEED]: 3,
[GROWING]: 4,
},
cropTimeline: [3, 1, 2, 1],
growsInto: 'onion',
id: 'onion-seed',
name: 'Onion Seeds',
Expand Down
11 changes: 4 additions & 7 deletions src/data/crops/pea.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { crop, fromSeed } from '../crop'
import { cropLifeStage, cropType } from '../../enums'
/** @typedef {import("../../index").farmhand.item} farmhand.item */

const { SEED, GROWING } = cropLifeStage
import { crop, fromSeed } from '../crop'
import { cropType } from '../../enums'

/**
* @property farmhand.module:items.peaSeed
* @type {farmhand.item}
*/
export const peaSeed = crop({
cropType: cropType.PEA,
cropTimetable: {
[SEED]: 2,
[GROWING]: 3,
},
cropTimeline: [2, 3],
growsInto: 'pea',
id: 'pea-seed',
name: 'Pea Seed',
Expand Down
Loading

1 comment on commit 5b48165

@vercel
Copy link

@vercel vercel bot commented on 5b48165 Jan 16, 2024

Choose a reason for hiding this comment

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

Please sign in to comment.