Skip to content

Commit

Permalink
add Wipeout detector (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
jw098 authored Sep 2, 2024
1 parent 2f17b07 commit 0cbaccd
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,28 @@ bool SwapMenuDetector::move_to_slot(ConsoleHandle& console, BotBaseContext& cont
}
}

WipeoutDetector::WipeoutDetector(Color color)
: m_blackscreen(COLOR_RED, {0.1, 0.1, 0.8, 0.6})
, m_dialog(color, true, DialogType::DIALOG_WHITE)
, m_arrow_detector(COLOR_BLUE, {0.710, 0.850, 0.030, 0.042})
{}
void WipeoutDetector::make_overlays(VideoOverlaySet& items) const{
m_blackscreen.make_overlays(items);
m_dialog.make_overlays(items);
m_arrow_detector.make_overlays(items);
}
bool WipeoutDetector::detect(const ImageViewRGB32& screen) const{
if (!m_blackscreen.detect(screen)){
return false;
}

if(!m_dialog.detect(screen)){
return false;
}

return m_arrow_detector.detect(screen);
}


}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@

#include "CommonFramework/Language.h"
#include "CommonFramework/Inference/VisualDetector.h"
#include "CommonFramework/Inference/BlackScreenDetector.h"
#include "PokemonSV/Inference/PokemonSV_WhiteButtonDetector.h"
#include "PokemonSV/Inference/Dialogs/PokemonSV_GradientArrowDetector.h"
#include "PokemonSV/Inference/Dialogs/PokemonSV_DialogDetector.h"
#include "PokemonSV/Inference/Dialogs/PokemonSV_DialogArrowDetector.h"


namespace PokemonAutomation{
class ConsoleHandle;
Expand Down Expand Up @@ -109,6 +113,27 @@ class SwapMenuWatcher : public DetectorToFinder<SwapMenuDetector>{
{}
};

class WipeoutDetector : public StaticScreenDetector{
public:
WipeoutDetector(Color color = COLOR_CYAN);

virtual void make_overlays(VideoOverlaySet& items) const override;

// return true if detects a black screen, black dialog box, and dialog arrow.
virtual bool detect(const ImageViewRGB32& screen) const override;

private:
BlackScreenDetector m_blackscreen;
DialogBoxDetector m_dialog;
DialogArrowDetector m_arrow_detector;
};
class WipeoutWatcher : public DetectorToFinder<WipeoutDetector>{
public:
WipeoutWatcher(Color color = COLOR_CYAN)
: DetectorToFinder("WipeoutWatcher", std::chrono::milliseconds(250), color)
{}
};




Expand Down

0 comments on commit 0cbaccd

Please sign in to comment.