diff --git a/SerialPrograms/Source/PokemonSV/Inference/Battles/PokemonSV_NormalBattleMenus.cpp b/SerialPrograms/Source/PokemonSV/Inference/Battles/PokemonSV_NormalBattleMenus.cpp index 8ce0b213c..5ecb01e67 100644 --- a/SerialPrograms/Source/PokemonSV/Inference/Battles/PokemonSV_NormalBattleMenus.cpp +++ b/SerialPrograms/Source/PokemonSV/Inference/Battles/PokemonSV_NormalBattleMenus.cpp @@ -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); +} + } } diff --git a/SerialPrograms/Source/PokemonSV/Inference/Battles/PokemonSV_NormalBattleMenus.h b/SerialPrograms/Source/PokemonSV/Inference/Battles/PokemonSV_NormalBattleMenus.h index eb890ea83..9110edacd 100644 --- a/SerialPrograms/Source/PokemonSV/Inference/Battles/PokemonSV_NormalBattleMenus.h +++ b/SerialPrograms/Source/PokemonSV/Inference/Battles/PokemonSV_NormalBattleMenus.h @@ -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; @@ -109,6 +113,27 @@ class SwapMenuWatcher : public DetectorToFinder{ {} }; +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{ +public: + WipeoutWatcher(Color color = COLOR_CYAN) + : DetectorToFinder("WipeoutWatcher", std::chrono::milliseconds(250), color) + {} +}; +