Skip to content

Commit

Permalink
fix: Prevent accessing Shovel via keyboard shortcut when it is unavai…
Browse files Browse the repository at this point in the history
…lable (#333)

* fix: prevent accessing the shovel via keybinding when it is not available
* refactor: resuse isOctober util in play-during-october achievement
  • Loading branch information
jeremyckahn authored Oct 7, 2022
1 parent 0533205 commit 16ad0fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/components/Farmhand/Farmhand.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,11 @@ export default class Farmhand extends Component {
selectHoe: () => this.handlers.handleFieldModeSelect(CLEANUP),
selectScythe: () => this.handlers.handleFieldModeSelect(HARVEST),
selectWateringCan: () => this.handlers.handleFieldModeSelect(WATER),
selectShovel: () => this.handlers.handleFieldModeSelect(MINE),
selectShovel: () => {
if (this.state.toolLevels[toolType.SHOVEL] !== toolLevel.UNAVAILABLE) {
this.handlers.handleFieldModeSelect(MINE)
}
},
toggleMenu: () => this.handlers.handleMenuToggle(),
}

Expand Down
3 changes: 2 additions & 1 deletion src/data/achievements.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
getCropLifeStage,
getProfitRecord,
integerString,
isOctober,
memoize,
moneyTotal,
percentageString,
Expand Down Expand Up @@ -109,7 +110,7 @@ const achievements = [
name: 'Halloween Harvest',
description: 'Play Farmhand in October and get the gift of the season.',
rewardDescription: `${reward} units of ${itemsMap.jackolantern.name}`,
condition: () => new Date().getMonth() === 9,
condition: () => isOctober(),
reward: state =>
addItemToInventory(state, itemsMap.jackolantern, reward, true),
}))(),
Expand Down

0 comments on commit 16ad0fd

Please sign in to comment.