@@ -674,15 +674,7 @@ std::set<std::string> OutbreakFinder::enter_region_and_read_MMO(
674674}
675675
676676
677- // Run one iteration of the outbreak finder loop and return true when one desired outbreak is found.
678- // The iteration includes:
679- // 1. Starting at Jubilife Village gate, go to check the map for outbreaks.
680- // 2. If found desired outbreaks, stop.
681- // 3. If need to check MMOs, save in front of gate, then go to each region with MMO and talk to Mai to
682- // reveal MMO pokemon. Reset if no desired MMO to conserve Aguav Berries.
683- // 4. If found desired MMO pokemon, stop.
684- // 5. No desired outbreak in this iteration, go to an arbitrary region and return to village to refresh outbreaks.
685- bool OutbreakFinder::run_iteration (
677+ std::vector<std::string> OutbreakFinder::run_iteration (
686678 SingleSwitchProgramEnvironment& env, ProControllerContext& context,
687679 const std::set<std::string>& desired_hisui_map_events,
688680 const std::set<std::string>& desired_outbreaks,
@@ -720,14 +712,14 @@ bool OutbreakFinder::run_iteration(
720712 os << " Found following desired outbreak" << (desired_outbreaks_found.size () > 1 ? " s: " : " : " );
721713 for (const auto & outbreak: desired_outbreaks_found){
722714 os << outbreak << " , " ;
723- env.console .overlay ().add_log (" Found " + outbreak);
715+ env.console .overlay ().add_log (" Found " + outbreak, COLOR_GREEN );
724716 }
725- env.log (os.str ());
717+ env.log (os.str (), COLOR_GREEN );
726718
727- return true ;
728- }else {
729- env.log (" No desired outbreak." );
719+ return desired_outbreaks_found;
730720 }
721+
722+ env.log (" No desired outbreak." );
731723 }
732724
733725 // What we found is MMO symbols for MMO pokemon.
@@ -750,10 +742,10 @@ bool OutbreakFinder::run_iteration(
750742 os << " Found desired MMO pokemon (including desired MMO pokemon with star symbols): " ;
751743 for (const auto & pokemon : found_pokemon){
752744 os << pokemon << " , " ;
753- env.console .overlay ().add_log (" Found " + pokemon);
745+ env.console .overlay ().add_log (" Found " + pokemon, COLOR_GREEN );
754746 }
755- env.log (os.str ());
756- return true ;
747+ env.log (os.str (), COLOR_GREEN );
748+ return std::vector<std::string>(found_pokemon. begin (), found_pokemon. end ()) ;
757749 }
758750
759751 env.log (" No target MMO sprite found. Reset game..." );
@@ -769,7 +761,7 @@ bool OutbreakFinder::run_iteration(
769761 // Go to an arbitrary region and return to refresh outbreaks.
770762 goto_region_and_return (env, context, inside_travel_map);
771763
772- return false ;
764+ return std::vector<std::string>() ;
773765}
774766
775767
@@ -849,21 +841,30 @@ void OutbreakFinder::program(SingleSwitchProgramEnvironment& env, ProControllerC
849841 desired_hisui_map_events.insert (p.first );
850842 }
851843
844+ std::vector<std::string> found_outbreaks;
852845 while (true ){
853- if (run_iteration (env, context, desired_hisui_map_events, desired_outbreaks, desired_MMO_pokemon,
854- desired_star_MMO_pokemon))
846+ found_outbreaks = run_iteration (
847+ env, context, desired_hisui_map_events, desired_outbreaks, desired_MMO_pokemon,
848+ desired_star_MMO_pokemon);
849+ if (found_outbreaks.size () > 0 )
855850 {
856851 break ;
857852 }
858853 }
859854
860855 env.update_stats ();
861856
862- send_program_notification (
857+ os.str (" " ); // clear ostringstream
858+ os << " Found " ;
859+ for (size_t i = 0 ; i < found_outbreaks.size (); i++){
860+ os << found_outbreaks[i];
861+ if (i + 1 != found_outbreaks.size ()){
862+ os << " , " ;
863+ }
864+ }
865+ send_program_finished_notification (
863866 env, NOTIFICATION_MATCHED,
864- COLOR_GREEN,
865- " Found Outbreak" ,
866- {}, " " ,
867+ os.str (),
867868 env.console .video ().snapshot ()
868869 );
869870
0 commit comments