Skip to content

Commit 88da1f6

Browse files
committed
move fix to after each batch is done, some sw2 fixes
1 parent d64aa4c commit 88da1f6

File tree

3 files changed

+41
-51
lines changed

3 files changed

+41
-51
lines changed

SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BBQSoloFarmer.cpp

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,24 +71,29 @@ BBQSoloFarmer::BBQSoloFarmer()
7171
void BBQSoloFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
7272
assert_16_9_720p_min(env.logger(), env.console);
7373
BBQSoloFarmer_Descriptor::Stats& stats = env.current_stats<BBQSoloFarmer_Descriptor::Stats>();
74+
75+
//Make sure console type is set
76+
if (env.console.state().console_type() == ConsoleType::Unknown) {
77+
throw UserSetupError(env.console, "Console Type (Switch 1 or 2) must be specified.");
78+
}
7479

7580
//Fly to plaza
76-
open_map_from_overworld(env.program_info(), env.console, context);
77-
fly_to_overworld_from_map(env.program_info(), env.console, context);
81+
//open_map_from_overworld(env.program_info(), env.console, context);
82+
//fly_to_overworld_from_map(env.program_info(), env.console, context);
7883

7984
std::vector<BBQuests> quest_list; //all quests
8085
std::vector<BBQuests> quests_to_do; //do-able quests
8186
uint8_t eggs_hatched = 0; //Track eggs
8287
uint64_t num_completed_quests = 0;
8388

8489
//Test a specific quest
85-
/*
86-
BBQuests test_quest = BBQuests::catch_bug;
90+
91+
BBQuests test_quest = BBQuests::tera_raid;
8792
bool questTest = process_and_do_quest(env, env.console, context, BBQ_OPTIONS, test_quest, eggs_hatched);
8893
if (questTest){
8994
env.log("Finished quest.");
9095
}
91-
*/
96+
9297

9398
while (num_completed_quests < BBQ_OPTIONS.NUM_QUESTS){
9499
if (BBQ_OPTIONS.OUT_OF_EGGS == BBQOption::OOEggs::Stop && eggs_hatched >= BBQ_OPTIONS.NUM_EGGS){
@@ -131,6 +136,16 @@ void BBQSoloFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerCo
131136
//Clear out the todo list
132137
quests_to_do.clear();
133138

139+
//Fix the time to prevent running out of years
140+
pbf_wait(context, 250);
141+
context.wait_for_all_requests();
142+
pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1);
143+
home_to_date_time(console, context, false);
144+
pbf_press_button(context, BUTTON_A, 20, 105);
145+
pbf_press_button(context, BUTTON_A, 20, 105);
146+
pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0);
147+
resume_game_from_home(console, context);
148+
134149
uint64_t temp_save_num_option = BBQ_OPTIONS.SAVE_NUM_QUESTS;
135150
if (temp_save_num_option != 0 && num_completed_quests % temp_save_num_option == 0){
136151
env.log("Saving and resetting.");

SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -918,16 +918,6 @@ void quest_catch(
918918
pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0);
919919
resume_game_from_home(console, context);
920920

921-
//Wait a bit and then fix the time to prevent running out of years
922-
pbf_wait(context, 250);
923-
context.wait_for_all_requests();
924-
pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1);
925-
home_to_date_time(console, context, false);
926-
pbf_press_button(context, BUTTON_A, 20, 105);
927-
pbf_press_button(context, BUTTON_A, 20, 105);
928-
pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0);
929-
resume_game_from_home(console, context);
930-
931921
//Heal up and then reset position again.
932922
OverworldWatcher done_healing(console.logger(), COLOR_BLUE);
933923
pbf_move_left_joystick(context, 128, 0, 100, 20);

SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp

Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,12 @@ void quest_tera_self_defeat(
658658
pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105);
659659

660660
//Drop on top of Kleavor (plenty of Scyther in the area as well)
661-
jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1000, 1650, 300);
661+
if (console.state().console_type() == ConsoleType::Switch1) {
662+
jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1000, 1650, 300);
663+
}
664+
else { //All switch 2s
665+
jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1000, 1600, 300);
666+
}
662667

663668
ssf_press_button(context, BUTTON_ZR, 0, 200);
664669
ssf_press_button(context, BUTTON_ZL, 100, 50);
@@ -707,16 +712,6 @@ void quest_tera_self_defeat(
707712
pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0);
708713
resume_game_from_home(console, context);
709714

710-
//Wait a bit and then fix the time to prevent running out of years
711-
pbf_wait(context, 250);
712-
context.wait_for_all_requests();
713-
pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1);
714-
home_to_date_time(console, context, false);
715-
pbf_press_button(context, BUTTON_A, 20, 105);
716-
pbf_press_button(context, BUTTON_A, 20, 105);
717-
pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0);
718-
resume_game_from_home(console, context);
719-
720715
//Heal up and then reset position again.
721716
OverworldWatcher done_healing(console.logger(), COLOR_BLUE);
722717
pbf_move_left_joystick(context, 128, 0, 100, 20);
@@ -763,8 +758,12 @@ void quest_sneak_up(
763758

764759
pbf_press_button(context, BUTTON_L, 20, 50);
765760
pbf_move_left_joystick(context, 128, 0, 100, 50);
766-
pbf_move_left_joystick(context, 0, 0, 20, 50);
767-
pbf_press_button(context, BUTTON_L, 20, 50);
761+
762+
//Turn slightly for switch 1
763+
if (console.state().console_type() == ConsoleType::Switch1) {
764+
pbf_move_left_joystick(context, 0, 0, 20, 50);
765+
pbf_press_button(context, BUTTON_L, 20, 50);
766+
}
768767

769768
ssf_press_button(context, BUTTON_ZR, 0, 200);
770769
ssf_press_button(context, BUTTON_ZL, 100, 50);
@@ -853,16 +852,6 @@ void quest_sneak_up(
853852
pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0);
854853
resume_game_from_home(console, context);
855854
context.wait_for_all_requests();
856-
857-
//Wait a bit and then fix the time to prevent running out of years
858-
pbf_wait(context, 250);
859-
context.wait_for_all_requests();
860-
pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1);
861-
home_to_date_time(console, context, false);
862-
pbf_press_button(context, BUTTON_A, 20, 105);
863-
pbf_press_button(context, BUTTON_A, 20, 105);
864-
pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0);
865-
resume_game_from_home(console, context);
866855
}
867856

868857
void quest_wild_tera(
@@ -887,9 +876,15 @@ void quest_wild_tera(
887876
//Skarmory is likely to attack but sometimes there is a different pokemon
888877
pbf_press_button(context, BUTTON_PLUS, 20, 105);
889878

890-
pbf_move_left_joystick(context, 50, 0, 20, 105);
891-
pbf_press_button(context, BUTTON_L, 20, 50);
892-
pbf_move_left_joystick(context, 128, 0, 100, 50);
879+
if (console.state().console_type() == ConsoleType::Switch1) {
880+
pbf_move_left_joystick(context, 50, 0, 20, 105);
881+
pbf_press_button(context, BUTTON_L, 20, 50);
882+
pbf_move_left_joystick(context, 128, 0, 100, 50);
883+
}
884+
else { //Switch 2
885+
pbf_move_left_joystick(context, 20, 0, 20, 105);
886+
pbf_press_button(context, BUTTON_L, 20, 50);
887+
}
893888

894889
ssf_press_button(context, BUTTON_ZR, 0, 200);
895890
ssf_press_button(context, BUTTON_ZL, 100, 50);
@@ -937,16 +932,6 @@ void quest_wild_tera(
937932
pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0);
938933
resume_game_from_home(console, context);
939934

940-
//Wait a bit and then fix the time to prevent running out of years
941-
pbf_wait(context, 250);
942-
context.wait_for_all_requests();
943-
pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1);
944-
home_to_date_time(console, context, false);
945-
pbf_press_button(context, BUTTON_A, 20, 105);
946-
pbf_press_button(context, BUTTON_A, 20, 105);
947-
pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0);
948-
resume_game_from_home(console, context);
949-
950935
//Heal up and then reset position again.
951936
OverworldWatcher done_healing(console.logger(), COLOR_BLUE);
952937
pbf_move_left_joystick(context, 128, 0, 100, 20);

0 commit comments

Comments
 (0)