Skip to content

Commit

Permalink
Safari: Implement Safari automation (issue #49)
Browse files Browse the repository at this point in the history
The auto-hunt panel is displayed on the right side of the in-game safari
zone modal.

The auto-hunt feature will seek two neighbor Grass or Water tiles, 
moves the player to the first one, and then alternate between both until 
an encounter occurs.
When an encounter occurs, the automation will throw a rock at the
pokémon and then try to catch it with a pokéball.
  • Loading branch information
Farigh committed Nov 10, 2023
2 parents 5551dee + f02a825 commit 104dcda
Show file tree
Hide file tree
Showing 7 changed files with 480 additions and 9 deletions.
11 changes: 7 additions & 4 deletions src/Automation.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ class Automation
{
// Aliases on the other classes so every calls in the code can use the `Automation.<Alias>` form
static BattleCafe = AutomationBattleCafe;
static Click = AutomationClick;
static BattleFrontier = AutomationBattleFrontier;
static Dungeon = AutomationDungeon;
static Gym = AutomationGym;
static Safari = AutomationSafari;

static Click = AutomationClick;
static Farm = AutomationFarm;
static Focus = AutomationFocus;
static Gym = AutomationGym;
static BattleFrontier = AutomationBattleFrontier;
static Hatchery = AutomationHatchery;
static Items = AutomationItems;
static Notifications = AutomationNotifications;
Expand Down Expand Up @@ -74,10 +76,11 @@ class Automation
// 'Trivia' panel
this.Trivia.initialize(initStep);

// 'Gym', 'Dungeon' and 'Battle Frontier' panels
// 'Gym', 'Dungeon', 'Battle Frontier' and 'Safari' instances panels
this.Gym.initialize(initStep);
this.Dungeon.initialize(initStep);
this.BattleFrontier.initialize(initStep);
this.Safari.initialize(initStep);

// Floating panel
this.BattleCafe.initialize(initStep);
Expand Down
10 changes: 6 additions & 4 deletions src/ComponentLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ class AutomationComponentLoader
this.__addScript("src/lib/Utils/Route.js");

this.__loadingOrder += 1;
this.__addScript("src/lib/BattleCafe.js");
this.__addScript("src/lib/Instances/BattleCafe.js");
this.__addScript("src/lib/Instances/BattleFrontier.js");
this.__addScript("src/lib/Instances/Dungeon.js");
this.__addScript("src/lib/Instances/Gym.js");
this.__addScript("src/lib/Instances/Safari.js");

this.__addScript("src/lib/Click.js");
this.__addScript("src/lib/Dungeon.js");
this.__addScript("src/lib/Farm.js");
this.__addScript("src/lib/Focus.js");
this.__addScript("src/lib/Gym.js");
this.__addScript("src/lib/BattleFrontier.js");
this.__addScript("src/lib/Hatchery.js");
this.__addScript("src/lib/Items.js");
this.__addScript("src/lib/Menu.js");
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/lib/Dungeon.js → src/lib/Instances/Dungeon.js
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ class AutomationDungeon
disableReason += "pokémons are already caught,\nand the option to stop in this case is enabled";
}

// The player does not have enough dugeon token
// The player does not have enough dungeon token
if (App.game.wallet.currencies[GameConstants.Currency.dungeonToken]() < player.town().dungeon.tokenCost)
{
disableNeeded = true;
Expand Down
File renamed without changes.
Loading

0 comments on commit 104dcda

Please sign in to comment.