@@ -105,6 +105,26 @@ class DialogTealArrowMatcher : public ImageMatch::WaterfillTemplateMatcher{
105105 }
106106};
107107
108+ class DialogBlueArrowMatcher : public ImageMatch ::WaterfillTemplateMatcher{
109+ public:
110+ DialogBlueArrowMatcher ()
111+ : WaterfillTemplateMatcher(
112+ " PokemonLZA/DialogBox/DialogBoxBlueArrow-Template.png" ,
113+ Color (0xff005460 ), Color(0xff6BBEC9 ), 50
114+ )
115+ {
116+ m_aspect_ratio_lower = 0.9 ;
117+ m_aspect_ratio_upper = 1.1 ;
118+ m_area_ratio_lower = 0.8 ;
119+ m_area_ratio_upper = 1.1 ;
120+ }
121+
122+ static const ImageMatch::WaterfillTemplateMatcher& instance () {
123+ static DialogBlueArrowMatcher matcher;
124+ return matcher;
125+ }
126+ };
127+
108128
109129namespace {
110130
@@ -143,6 +163,33 @@ bool detect_white_arrow(const ImageViewRGB32& screen, PokemonAutomation::ImageFl
143163 return found;
144164}
145165
166+ bool detect_blue_arrow (const ImageViewRGB32& screen, PokemonAutomation::ImageFloatBox& found_box){
167+ double screen_rel_size = (screen.height () / 1080.0 );
168+ double screen_rel_size_2 = screen_rel_size * screen_rel_size;
169+
170+ double min_area_1080p = 150.0 ;
171+ double rmsd_threshold = 120.0 ;
172+ size_t min_area = size_t (screen_rel_size_2 * min_area_1080p);
173+
174+ const std::vector<std::pair<uint32_t , uint32_t >> FILTERS = {
175+ {0x005460 , 0xff7FC0C9 },
176+ };
177+
178+ bool found = match_template_by_waterfill (
179+ screen.size (),
180+ extract_box_reference (screen, DIALOG_ARROW_BOX),
181+ DialogBlueArrowMatcher::instance (),
182+ FILTERS,
183+ {min_area, SIZE_MAX},
184+ rmsd_threshold,
185+ [&](Kernels::Waterfill::WaterfillObject& object) -> bool {
186+ found_box = translate_to_parent (screen, DIALOG_ARROW_BOX, object);
187+ return true ;
188+ }
189+ );
190+ return found;
191+ }
192+
146193} // end anonymous namespace
147194
148195
@@ -486,6 +533,43 @@ bool TransparentBattleDialogDetector::detect(const ImageViewRGB32& screen){
486533}
487534
488535
536+ LightBlueDialogDetector::LightBlueDialogDetector (Color color, VideoOverlay* overlay)
537+ : m_color(color)
538+ , m_overlay(overlay)
539+ , m_corner(0.765093 , 0.933594 , 0.006586 , 0.013672 )
540+ {}
541+ void LightBlueDialogDetector::make_overlays (VideoOverlaySet& items) const {
542+ items.add (m_color, m_corner);
543+ items.add (m_color, DIALOG_ARROW_BOX);
544+ }
545+ bool LightBlueDialogDetector::detect (const ImageViewRGB32& screen){
546+ do {
547+ if (is_solid (
548+ extract_box_reference (screen, m_corner),
549+ {0.108317 , 0.462282 , 0.429400 },
550+ 0.25
551+ )){
552+ break ;
553+ }
554+ m_last_detected_box_scope.reset ();
555+ // cout << "not solid" << endl;
556+ return false ;
557+ }while (false );
558+
559+ const bool found = detect_blue_arrow (screen, m_last_detected_box);
560+
561+ if (m_overlay){
562+ if (found){
563+ m_last_detected_box_scope.emplace (*m_overlay, m_last_detected_box, COLOR_GREEN);
564+ }else {
565+ m_last_detected_box_scope.reset ();
566+ }
567+ }
568+
569+ return found;
570+ }
571+
572+
489573
490574}
491575}
0 commit comments