Skip to content

Commit 0966f26

Browse files
author
Gin
committed
rewriting wild zone entrance
1 parent 22e0443 commit 0966f26

File tree

7 files changed

+341
-78
lines changed

7 files changed

+341
-78
lines changed

SerialPrograms/Source/PokemonLZA/Inference/PokemonLZA_ButtonDetector.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class ButtonDetector : public StaticScreenDetector{
4747
virtual void make_overlays(VideoOverlaySet& items) const override;
4848
virtual bool detect(const ImageViewRGB32& screen) override;
4949

50+
virtual void reset_state() override { m_last_detected_box.reset(); }
51+
5052
private:
5153
Color m_color;
5254
const ButtonMatcher& m_matcher;

SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.cpp

Lines changed: 74 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,17 @@ void open_map(ConsoleHandle& console, ProControllerContext& context){
6262

6363
FastTravelState fly_from_map(ConsoleHandle& console, ProControllerContext& context){
6464
console.log("Flying from map...");
65-
65+
context.wait_for_all_requests();
6666
{
6767
BlackScreenWatcher start_flying(COLOR_RED);
68-
BlueDialogWatcher blue_dialog(COLOR_BLUE, &console.overlay());
68+
BlueDialogWatcher blue_dialog(COLOR_BLUE, &console.overlay(), 50ms);
6969
int ret = run_until<ProControllerContext>(
7070
console, context,
71-
[](ProControllerContext& context){
72-
for(int i = 0; i < 5; i++){
73-
pbf_press_button(context, BUTTON_A, 50ms, 2s);
71+
[&](ProControllerContext& context){
72+
pbf_mash_button(context, BUTTON_A, 1000ms);
73+
context.wait_for_all_requests();
74+
for(int i = 0; i < 10; i++){
75+
pbf_press_button(context, BUTTON_A, 30ms, 200ms);
7476
}
7577
},
7678
{start_flying, blue_dialog,}
@@ -121,6 +123,73 @@ FastTravelState fly_from_map(ConsoleHandle& console, ProControllerContext& conte
121123
}
122124

123125

126+
void move_map_cursor_from_entrance_to_zone(ConsoleHandle& console, ProControllerContext& context, WildZone zone){
127+
pbf_wait(context, 300ms);
128+
switch(zone){
129+
case WildZone::WILD_ZONE_1:
130+
pbf_move_left_joystick(context, 0, 150, 230ms, 0ms);
131+
break;
132+
case WildZone::WILD_ZONE_2:
133+
pbf_move_left_joystick(context, 120, 0, 100ms, 0ms);
134+
break;
135+
case WildZone::WILD_ZONE_3:
136+
pbf_move_left_joystick(context, 128, 0, 100ms, 0ms);
137+
break;
138+
case WildZone::WILD_ZONE_4:
139+
pbf_move_left_joystick(context, 255, 128, 100ms, 0ms);
140+
break;
141+
case WildZone::WILD_ZONE_5:
142+
pbf_move_left_joystick(context, 170, 0, 100ms, 0ms);
143+
break;
144+
case WildZone::WILD_ZONE_6:
145+
pbf_move_left_joystick(context, 80, 0, 100ms, 0ms);
146+
break;
147+
case WildZone::WILD_ZONE_7:
148+
pbf_move_left_joystick(context, 0, 100, 100ms, 0ms);
149+
break;
150+
case WildZone::WILD_ZONE_8:
151+
pbf_move_left_joystick(context, 0, 160, 100ms, 0ms);
152+
break;
153+
case WildZone::WILD_ZONE_9:
154+
pbf_move_left_joystick(context, 70, 0, 100ms, 0ms);
155+
break;
156+
case WildZone::WILD_ZONE_10:
157+
pbf_move_left_joystick(context, 255, 90, 100ms, 0ms);
158+
break;
159+
case WildZone::WILD_ZONE_11:
160+
pbf_move_left_joystick(context, 0, 40, 100ms, 0ms);
161+
break;
162+
case WildZone::WILD_ZONE_12:
163+
pbf_move_left_joystick(context, 20, 0, 150ms, 0ms);
164+
break;
165+
case WildZone::WILD_ZONE_13:
166+
pbf_move_left_joystick(context, 0, 160, 100ms, 0ms);
167+
break;
168+
case WildZone::WILD_ZONE_14:
169+
pbf_move_left_joystick(context, 110, 255, 100ms, 0ms);
170+
break;
171+
case WildZone::WILD_ZONE_15:
172+
pbf_move_left_joystick(context, 0, 0, 100ms, 0ms);
173+
break;
174+
case WildZone::WILD_ZONE_16:
175+
pbf_move_left_joystick(context, 220, 0, 100ms, 0ms);
176+
break;
177+
case WildZone::WILD_ZONE_17:
178+
pbf_move_left_joystick(context, 210, 0, 100ms, 0ms);
179+
break;
180+
case WildZone::WILD_ZONE_18:
181+
pbf_move_left_joystick(context, 20, 255, 100ms, 0ms);
182+
break;
183+
case WildZone::WILD_ZONE_19:
184+
pbf_move_left_joystick(context, 80, 255, 100ms, 0ms);
185+
break;
186+
case WildZone::WILD_ZONE_20:
187+
pbf_move_left_joystick(context, 0, 90, 140ms, 0ms);
188+
break;
189+
}
190+
pbf_wait(context, 300ms);
191+
}
192+
124193

125194

126195
void sit_on_bench(ConsoleHandle& console, ProControllerContext& context){

SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#ifndef PokemonAutomation_PokemonLZA_BasicNavigation_H
88
#define PokemonAutomation_PokemonLZA_BasicNavigation_H
99

10+
#include "PokemonLZA/Programs/PokemonLZA_Locations.h"
11+
1012
namespace PokemonAutomation{
1113

1214
template <typename Type> class ControllerContext;
@@ -43,9 +45,11 @@ void open_map(ConsoleHandle& console, ProControllerContext& context);
4345
// returns, the game is in fly map.
4446
FastTravelState fly_from_map(ConsoleHandle& console, ProControllerContext& context);
4547

46-
void sit_on_bench(ConsoleHandle& console, ProControllerContext& context);
48+
// Blind movement of map cursor from zone entrance to that zone fast travel icon on map
49+
void move_map_cursor_from_entrance_to_zone(ConsoleHandle& console, ProControllerContext& context, WildZone zone);
4750

4851

52+
void sit_on_bench(ConsoleHandle& console, ProControllerContext& context);
4953

5054
}
5155
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/* Pokemon Legends Z-A Locations
2+
*
3+
* From: https://github.com/PokemonAutomation/
4+
*
5+
*/
6+
7+
#ifndef PokemonAutomation_PokemonLZA_Locations_H
8+
#define PokemonAutomation_PokemonLZA_Locations_H
9+
10+
namespace PokemonAutomation{
11+
namespace NintendoSwitch{
12+
namespace PokemonLZA{
13+
14+
enum class WildZone{
15+
WILD_ZONE_1,
16+
WILD_ZONE_2,
17+
WILD_ZONE_3,
18+
WILD_ZONE_4,
19+
WILD_ZONE_5,
20+
WILD_ZONE_6,
21+
WILD_ZONE_7,
22+
WILD_ZONE_8,
23+
WILD_ZONE_9,
24+
WILD_ZONE_10,
25+
WILD_ZONE_11,
26+
WILD_ZONE_12,
27+
WILD_ZONE_13,
28+
WILD_ZONE_14,
29+
WILD_ZONE_15,
30+
WILD_ZONE_16,
31+
WILD_ZONE_17,
32+
WILD_ZONE_18,
33+
WILD_ZONE_19,
34+
WILD_ZONE_20,
35+
};
36+
37+
38+
}
39+
}
40+
}
41+
#endif

0 commit comments

Comments
 (0)