Skip to content

Commit

Permalink
Farm: Add new Snover berry strategy (issue #316)
Browse files Browse the repository at this point in the history
The v0.10.15 added a new 4th gen berry.
The unlock strategy is now registered for this berry. It will be
performed right after the Babiri berry unlock.
  • Loading branch information
Farigh committed Aug 30, 2023
2 parents fdbdc44 + 7267c85 commit 2cd4682
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 99 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 19
node-version: 20

- name: Install jest
run: yarn --cwd "tst" add --dev jest
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Pokeclicker-automation aims at automating some recurring tasks that can be a bit
This script collection does not aim at cheating.
It will never perform actions that the game would not allow.

Last known compatible pokeclicker version: 0.10.14
Last known compatible pokeclicker version: 0.10.15

For more details, please refer to the [wiki](../../wiki)

Expand Down
39 changes: 22 additions & 17 deletions src/lib/Farm.js
Original file line number Diff line number Diff line change
Expand Up @@ -1288,11 +1288,16 @@ class AutomationFarm
chartiConfig[BerryType.Cornn] = allSlotIndexes;
this.__internal__addUnlockMutationStrategy(BerryType.Charti, chartiConfig, 1, OakItemType.Cell_Battery);

// #52 Unlock at least one Babiri berry through mutation
// #52 Unlock at least 20 Babiri berries through mutation
const babiriConfig = {};
babiriConfig[BerryType.Shuca] = [ 0, 1, 2, 3, 4, 7, 17, 20, 21, 22, 23, 24 ];
babiriConfig[BerryType.Charti] = [ 5, 9, 10, 11, 12, 13, 14, 15, 19 ];
this.__internal__addUnlockMutationStrategy(BerryType.Babiri, babiriConfig);
this.__internal__addUnlockMutationStrategy(BerryType.Babiri, babiriConfig, 20);

// #55 Unlock at least one Snover berry through mutation
const snoverConfig = {};
snoverConfig[BerryType.Babiri] = App.game.farming.plotList.map((_, index) => index).filter(index => ![ 18, 19, 22, 23, 24 ].includes(index));
this.__internal__addUnlockMutationStrategy(BerryType.Snover, snoverConfig, 1, null, [], "Snover");

// #42 Unlock at least one Chople berry through mutation (moved this far to avoid any problem, since it uses Oak items)
const chopleConfig = {};
Expand Down Expand Up @@ -1380,34 +1385,34 @@ class AutomationFarm
|* Gen 5 berries unlocks *|
\*********************************/

// #55 Unlock at least one Micle berry through mutation
// #56 Unlock at least one Micle berry through mutation
this.__internal__addUnlockMutationStrategy(
BerryType.Micle,
this.__internal__plantABerryForMutationRequiringOver600PointsConfig(BerryType.Pamtre),
1,
null,
[ OakItemType.Rocky_Helmet ]);

// #56 Unlock at least one Custap berry through mutation
// #57 Unlock at least one Custap berry through mutation
this.__internal__addUnlockMutationStrategy(
BerryType.Custap,
this.__internal__plantABerryForMutationRequiringOver600PointsConfig(BerryType.Watmel),
1,
null,
[ OakItemType.Sprinklotad ]);

// #57 Unlock at least one Jaboca berry through mutation
// #58 Unlock at least one Jaboca berry through mutation
this.__internal__addUnlockMutationStrategy(
BerryType.Jaboca, this.__internal__plantABerryForMutationRequiringOver600PointsConfig(BerryType.Durin));

// #58 Unlock at least one Rowap berry through mutation
// #59 Unlock at least one Rowap berry through mutation
this.__internal__addUnlockMutationStrategy(
BerryType.Rowap, this.__internal__plantABerryForMutationRequiringOver600PointsConfig(BerryType.Belue));

//////
// The following mutations require the player to have caught legendary pokemons

// #61 Unlock at least four Liechi berry through mutation
// #62 Unlock at least four Liechi berry through mutation
this.__internal__addUnlockMutationStrategy(
BerryType.Liechi,
this.__internal__plantABerryForMutationRequiring23BerriesConfig(BerryType.Passho),
Expand All @@ -1418,7 +1423,7 @@ class AutomationFarm

this.__internal__increaseHarvestRateStrategy(BerryType.Liechi, 4);

// #62 Unlock at least four Ganlon berry through mutation
// #63 Unlock at least four Ganlon berry through mutation
this.__internal__addUnlockMutationStrategy(
BerryType.Ganlon,
this.__internal__plantABerryForMutationRequiring23BerriesConfig(BerryType.Shuca),
Expand All @@ -1429,11 +1434,11 @@ class AutomationFarm

this.__internal__increaseHarvestRateStrategy(BerryType.Ganlon, 4);

// #59 Unlock at least one Kee berry through mutation
// #60 Unlock at least one Kee berry through mutation
this.__internal__addUnlockMutationStrategy(
BerryType.Kee, this.__internal__plantTwoBerriesForMutationConfig(BerryType.Liechi, BerryType.Ganlon));

// #63 Unlock at least four Salac berries through mutation
// #64 Unlock at least four Salac berries through mutation
this.__internal__addUnlockMutationStrategy(
BerryType.Salac,
this.__internal__plantABerryForMutationRequiring23BerriesConfig(BerryType.Coba),
Expand All @@ -1444,7 +1449,7 @@ class AutomationFarm

this.__internal__increaseHarvestRateStrategy(BerryType.Salac, 4);

// #64 Unlock at least four Petaya berries through mutation
// #65 Unlock at least four Petaya berries through mutation
const petayaConfig = {};
petayaConfig[BerryType.Kasib] = [ 0 ];
petayaConfig[BerryType.Payapa] = [ 2 ];
Expand All @@ -1468,11 +1473,11 @@ class AutomationFarm

this.__internal__increaseHarvestRateStrategy(BerryType.Petaya, 4);

// #60 Unlock at least one Maranga berry through mutation
// #61 Unlock at least one Maranga berry through mutation
this.__internal__addUnlockMutationStrategy(
BerryType.Maranga, this.__internal__plantTwoBerriesForMutationConfig(BerryType.Salac, BerryType.Petaya));

// #65 Unlock at least one Apicot berry through mutation
// #66 Unlock at least one Apicot berry through mutation
this.__internal__addUnlockMutationStrategy(
BerryType.Apicot,
this.__internal__plantABerryForMutationRequiring23BerriesConfig(BerryType.Chilan),
Expand All @@ -1481,7 +1486,7 @@ class AutomationFarm
[],
"Palkia");

// #66 Unlock at least one Lansat berry through mutation
// #67 Unlock at least one Lansat berry through mutation
this.__internal__addUnlockMutationStrategy(
BerryType.Lansat,
this.__internal__plantABerryForMutationRequiring23BerriesConfig(BerryType.Roseli),
Expand All @@ -1490,7 +1495,7 @@ class AutomationFarm
[],
"Dialga");

// #67 Unlock at least one Starf berry through mutation
// #68 Unlock at least one Starf berry through mutation
const starfConfig = {};
starfConfig[BerryType.Roseli] = App.game.farming.plotList.map((_, index) => index).filter(index => ![ 11, 12, 13 ].includes(index));
this.__internal__addUnlockMutationStrategy(BerryType.Starf, starfConfig);
Expand Down Expand Up @@ -1541,7 +1546,7 @@ class AutomationFarm
enigmaConfig[neededBerries[2]] = [ 7, 19 ];
enigmaConfig[neededBerries[3]] = [ 11, 23 ];

// #68 Unlock and gather at least 24 Lum berry through mutation
// #69 Unlock and gather at least 24 Lum berry through mutation
this.__internal__addUnlockMutationStrategy(BerryType.Enigma, enigmaConfig);
this.__internal__unlockStrategySelection.at(-1).requiresDiscord = true;
}
Expand Down Expand Up @@ -1736,7 +1741,7 @@ class AutomationFarm
*/
static __internal__increaseHarvestRateStrategy(berryType, minimumRequiredBerry)
{
let strategy =
const strategy =
{
// Check if the berry is unlocked and the player has enough of them in stock or planted
isNeeded: function()
Expand Down
60 changes: 32 additions & 28 deletions tst/stubs/Farming/BerryType.pokeclicker.stub.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,24 @@ let BerryType =
51: "Babiri",
52: "Chilan",
53: "Roseli",
54: "Micle",
55: "Custap",
56: "Jaboca",
57: "Rowap",
58: "Kee",
59: "Maranga",
60: "Liechi",
61: "Ganlon",
62: "Salac",
63: "Petaya",
64: "Apicot",
65: "Lansat",
66: "Starf",
67: "Enigma",
54: "Snover",
55: "Micle",
56: "Custap",
57: "Jaboca",
58: "Rowap",
59: "Kee",
60: "Maranga",
61: "Liechi",
62: "Ganlon",
63: "Salac",
64: "Petaya",
65: "Apicot",
66: "Lansat",
67: "Starf",
68: "Enigma",
69: "Hopo",
Aguav: 17,
Apicot: 64,
Apicot: 65,
Aspear: 4,
Babiri: 51,
Belue: 34,
Expand All @@ -84,28 +86,29 @@ let BerryType =
Coba: 44,
Colbur: 50,
Cornn: 26,
Custap: 55,
Custap: 56,
Durin: 33,
Enigma: 67,
Enigma: 68,
Figy: 14,
Ganlon: 61,
Ganlon: 62,
Grepa: 24,
Haban: 49,
Hondew: 23,
Hopo: 69,
Iapapa: 18,
Jaboca: 56,
Jaboca: 57,
Kasib: 48,
Kebia: 42,
Kee: 58,
Kee: 59,
Kelpsy: 21,
Lansat: 65,
Lansat: 66,
Leppa: 5,
Liechi: 60,
Liechi: 61,
Lum: 19,
Mago: 16,
Magost: 27,
Maranga: 59,
Micle: 54,
Maranga: 60,
Micle: 55,
Nanab: 11,
Nomel: 29,
None: -1,
Expand All @@ -116,7 +119,7 @@ let BerryType =
Payapa: 45,
Pecha: 2,
Persim: 8,
Petaya: 63,
Petaya: 64,
Pinap: 13,
Pinkan: 35,
Pomeg: 20,
Expand All @@ -126,12 +129,13 @@ let BerryType =
Razz: 9,
Rindo: 39,
Roseli: 53,
Rowap: 57,
Salac: 62,
Rowap: 58,
Salac: 63,
Shuca: 43,
Sitrus: 7,
Snover: 54,
Spelon: 30,
Starf: 66,
Starf: 67,
Tamato: 25,
Tanga: 46,
Wacan: 38,
Expand Down
3 changes: 2 additions & 1 deletion tst/stubs/Farming/Farming.pokeclicker.stub.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class Farming
|* Test-only interface *|
\***************************/

// From: https://github.com/pokeclicker/pokeclicker/blob/c61223cdc8db0bd9f8a7fc7927ec17edc7bd2605/src/scripts/farming/Farming.ts#L77
// From: https://github.com/pokeclicker/pokeclicker/blob/1277c32c2567d57dfa7700c46b22d816cc0b74a4/src/scripts/farming/Farming.ts#L74
__initBerryData()
{
// First Generation
Expand Down Expand Up @@ -198,6 +198,7 @@ class Farming
this.berryData[BerryType.Babiri] = new Berry(BerryType.Babiri, [7200, 16200, 32400, 64800, 129600], 36);
this.berryData[BerryType.Chilan] = new Berry(BerryType.Chilan, [240, 1430, 2970, 7200, 14400], 10);
this.berryData[BerryType.Roseli] = new Berry(BerryType.Roseli, [2410, 5040, 12600, 25200, 50400], 38);
this.berryData[BerryType.Snover] = new Berry(BerryType.Snover, [3600, 7200, 10800, 14400, 28800], 5);

// Fifth Generation
this.berryData[BerryType.Micle] = new Berry(BerryType.Micle, [3960, 7920, 15840, 31680, 63360], 1);
Expand Down
Loading

0 comments on commit 2cd4682

Please sign in to comment.