Skip to content

Commit

Permalink
Fixed bug yannprada#14
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoretsu committed Feb 13, 2021
1 parent 5d8692f commit 826582e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion cookie-garden-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ class Garden {
return (this.minigame.nextStep - Date.now()) / 1000;
}

static hasHarvestBenefit(plant) {
return typeof plant.onHarvest === 'function';
}

static get selectedSeed() {
return this.minigame.seedSelected;
}
Expand Down Expand Up @@ -167,7 +171,11 @@ class Garden {
static handleMature(config, plant, x, y) {
if (!plant.unlocked && config.autoHarvestNewSeeds) {
this.harvest(x, y);
} else if (config.autoHarvestCheckCpSMult && this.CpSMult >= config.autoHarvestMiniCpSMult.value) {
} else if (
config.autoHarvestCheckCpSMult &&
this.hasHarvestBenefit(plant) &&
this.CpSMult >= config.autoHarvestMiniCpSMult.value
) {
this.harvest(x, y);
}
}
Expand Down
10 changes: 9 additions & 1 deletion src/Garden.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ class Garden {
return (this.minigame.nextStep - Date.now()) / 1000;
}

static hasHarvestBenefit(plant) {
return typeof plant.onHarvest === 'function';
}

static get selectedSeed() {
return this.minigame.seedSelected;
}
Expand Down Expand Up @@ -117,7 +121,11 @@ class Garden {
static handleMature(config, plant, x, y) {
if (!plant.unlocked && config.autoHarvestNewSeeds) {
this.harvest(x, y);
} else if (config.autoHarvestCheckCpSMult && this.CpSMult >= config.autoHarvestMiniCpSMult.value) {
} else if (
config.autoHarvestCheckCpSMult &&
this.hasHarvestBenefit(plant) &&
this.CpSMult >= config.autoHarvestMiniCpSMult.value
) {
this.harvest(x, y);
}
}
Expand Down

0 comments on commit 826582e

Please sign in to comment.