Skip to content

Commit 1a29a92

Browse files
mb-baboulfyex
authored andcommitted
Improved Poffin Cooker (PokemonAutomation#520)
The bot shouldn't be overflowing while cooking anymore, improving the quality of the poffins obtained.
1 parent e4cff8b commit 1a29a92

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

SerialPrograms/Source/PokemonBDSP/Programs/Farming/PokemonBDSP_PoffinCooker.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,16 @@ bool turn = true; // True to turn clockwise, false to turn counter-clockwise
6464
ImageFloatBox box(0.56, 0.724, 0.012, 0.024); // Create a box that contains both green and blue arrows that need to be detected
6565

6666
void TurnClockwiseSlow(BotBaseContext& context){ // One turn of stiring poffin at slow speed (clockwise)
67-
pbf_move_right_joystick(context, 128, 255, 4, 0);
68-
pbf_move_right_joystick(context, 53, 231, 4, 0);
69-
pbf_move_right_joystick(context, 6, 167, 4, 0);
70-
pbf_move_right_joystick(context, 6, 88, 4, 0);
71-
pbf_move_right_joystick(context, 53, 24, 4, 0);
72-
pbf_move_right_joystick(context, 128, 0, 4, 0);
73-
pbf_move_right_joystick(context, 202, 24, 4, 0);
74-
pbf_move_right_joystick(context, 249, 88, 4, 0);
75-
pbf_move_right_joystick(context, 249, 167, 4, 0);
76-
pbf_move_right_joystick(context, 202, 231, 4, 0);
67+
pbf_move_right_joystick(context, 128, 255, 5, 0);
68+
pbf_move_right_joystick(context, 53, 231, 5, 0);
69+
pbf_move_right_joystick(context, 6, 167, 5, 0);
70+
pbf_move_right_joystick(context, 6, 88, 5, 0);
71+
pbf_move_right_joystick(context, 53, 24, 5, 0);
72+
pbf_move_right_joystick(context, 128, 0, 5, 0);
73+
pbf_move_right_joystick(context, 202, 24, 5, 0);
74+
pbf_move_right_joystick(context, 249, 88, 5, 0);
75+
pbf_move_right_joystick(context, 249, 167, 5, 0);
76+
pbf_move_right_joystick(context, 202, 231, 5, 0);
7777
}
7878

7979
void TurnClockwiseFast(BotBaseContext& context){ // Same as above, but faster for the end of the cooking session
@@ -89,16 +89,16 @@ void TurnClockwiseFast(BotBaseContext& context){ // Same as above, but faster fo
8989

9090

9191
void TurnCounterClockwiseSlow(BotBaseContext& context){ // One turn of stiring poffin (counter-clockwise)
92-
pbf_move_right_joystick(context, 128, 255, 4, 0);
93-
pbf_move_right_joystick(context, 202, 231, 4, 0);
94-
pbf_move_right_joystick(context, 249, 167, 4, 0);
95-
pbf_move_right_joystick(context, 249, 88, 4, 0);
96-
pbf_move_right_joystick(context, 202, 24, 4, 0);
97-
pbf_move_right_joystick(context, 128, 0, 4, 0);
98-
pbf_move_right_joystick(context, 53, 24, 4, 0);
99-
pbf_move_right_joystick(context, 6, 88, 4, 0);
100-
pbf_move_right_joystick(context, 6, 167, 4, 0);
101-
pbf_move_right_joystick(context, 53, 231, 4, 0);
92+
pbf_move_right_joystick(context, 128, 255, 5, 0);
93+
pbf_move_right_joystick(context, 202, 231, 5, 0);
94+
pbf_move_right_joystick(context, 249, 167, 5, 0);
95+
pbf_move_right_joystick(context, 249, 88, 5, 0);
96+
pbf_move_right_joystick(context, 202, 24, 5, 0);
97+
pbf_move_right_joystick(context, 128, 0, 5, 0);
98+
pbf_move_right_joystick(context, 53, 24, 5, 0);
99+
pbf_move_right_joystick(context, 6, 88, 5, 0);
100+
pbf_move_right_joystick(context, 6, 167, 5, 0);
101+
pbf_move_right_joystick(context, 53, 231, 5, 0);
102102
}
103103

104104
void TurnCounterClockwiseFast(BotBaseContext& context){ // Same as above, but faster for the end of the cooking session
@@ -146,17 +146,17 @@ void PoffinCooker::program(SingleSwitchProgramEnvironment& env, BotBaseContext&
146146
pbf_wait(context, 1050);
147147
context.wait_for_all_requests();
148148

149-
env.log("Stir slowly for the first half");
150-
for (uint16_t d = 0; d < 85; d++){
149+
env.log("Stir slowly for the first part");
150+
for (uint16_t d = 0; d < 79; d++){
151151
// Capture the image on the screen
152152
VideoSnapshot screen = env.console.video().snapshot();
153153

154154
// Get the stats of the screen's image
155155
ImageStats IMGstats = image_stats(extract_box_reference(screen, box));
156-
if (IMGstats.average.g > 200 && IMGstats.average.r < 100) { // Looking for the green arrow
156+
if (IMGstats.average.g > 170 && IMGstats.average.r < 125) { // Looking for the green arrow
157157
turn = true;
158158
}
159-
if (IMGstats.average.b > 200 && IMGstats.average.r < 100) { // Looking for the blue arrow
159+
if (IMGstats.average.b > 170 && IMGstats.average.r < 125) { // Looking for the blue arrow
160160
turn = false;
161161
}
162162
if (turn){
@@ -173,10 +173,10 @@ void PoffinCooker::program(SingleSwitchProgramEnvironment& env, BotBaseContext&
173173

174174
// Get the stats of the screen's image
175175
ImageStats IMGstats = image_stats(extract_box_reference(screen, box));
176-
if (IMGstats.average.g > 200 && IMGstats.average.r < 100) { // Looking for the green arrow
176+
if (IMGstats.average.g > 170 && IMGstats.average.r < 125) { // Looking for the green arrow
177177
turn = true;
178178
}
179-
if (IMGstats.average.b > 200 && IMGstats.average.r < 100) { // Looking for the blue arrow
179+
if (IMGstats.average.b > 170 && IMGstats.average.r < 125) { // Looking for the blue arrow
180180
turn = false;
181181
}
182182
if (turn){

0 commit comments

Comments
 (0)