From 84975237c90c24b91139ac6e6c76e3c0c4630864 Mon Sep 17 00:00:00 2001 From: Nymphea <87930564+NympheaR@users.noreply.github.com> Date: Tue, 17 Oct 2023 20:46:47 +0900 Subject: [PATCH] Increase red tolerance for let's go kill icon & add tests --- .../Overworld/PokemonSV_LetsGoKillDetector.cpp | 4 ++-- SerialPrograms/Source/Tests/PokemonSV_Tests.cpp | 10 ++++++++++ SerialPrograms/Source/Tests/PokemonSV_Tests.h | 2 ++ SerialPrograms/Source/Tests/TestMap.cpp | 3 ++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/SerialPrograms/Source/PokemonSV/Inference/Overworld/PokemonSV_LetsGoKillDetector.cpp b/SerialPrograms/Source/PokemonSV/Inference/Overworld/PokemonSV_LetsGoKillDetector.cpp index 7fe36bf08..9a663ed57 100644 --- a/SerialPrograms/Source/PokemonSV/Inference/Overworld/PokemonSV_LetsGoKillDetector.cpp +++ b/SerialPrograms/Source/PokemonSV/Inference/Overworld/PokemonSV_LetsGoKillDetector.cpp @@ -99,8 +99,8 @@ bool LetsGoKillDetector::detect(const ImageViewRGB32& screen) const{ std::vector matrices = compress_rgb32_to_binary_range( region, { - {0xff802020, 0xffff7f7f}, - {0xffc02020, 0xffff7f7f}, + {0xff801e1e, 0xffff7f7f}, + {0xffb31e1e, 0xffff7f7f}, } ); // size_t c = 0; diff --git a/SerialPrograms/Source/Tests/PokemonSV_Tests.cpp b/SerialPrograms/Source/Tests/PokemonSV_Tests.cpp index 5592dce43..8e436d3dd 100644 --- a/SerialPrograms/Source/Tests/PokemonSV_Tests.cpp +++ b/SerialPrograms/Source/Tests/PokemonSV_Tests.cpp @@ -26,6 +26,7 @@ #include "PokemonSV/Inference/Picnics/PokemonSV_SandwichHandDetector.h" #include "PokemonSV/Inference/Picnics/PokemonSV_SandwichIngredientDetector.h" #include "PokemonSV/Inference/Picnics/PokemonSV_SandwichPlateDetector.h" +#include "PokemonSV/Inference/Overworld/PokemonSV_LetsGoKillDetector.h" #include "PokemonSV/Inference/Overworld/PokemonSV_OverworldDetector.h" #include "PokemonSV/Inference/Dialogs/PokemonSV_DialogDetector.h" #include "PokemonSV/Inference/PokemonSV_ESPEmotionDetector.h" @@ -533,4 +534,13 @@ int test_pokemonSV_SandwichPlateDetector(const ImageViewRGB32& image, const std: return 0; } +int test_pokemonSV_RecentlyBattledDetector(const ImageViewRGB32& image, bool target){ + LetsGoKillDetector detector(COLOR_RED, {0.23, 0.23, 0.04, 0.20}); + + const bool result = detector.detect(image); + TEST_RESULT_EQUAL(result, target); + + return 0; +} + } diff --git a/SerialPrograms/Source/Tests/PokemonSV_Tests.h b/SerialPrograms/Source/Tests/PokemonSV_Tests.h index 14cdbf3ae..a861e86a2 100644 --- a/SerialPrograms/Source/Tests/PokemonSV_Tests.h +++ b/SerialPrograms/Source/Tests/PokemonSV_Tests.h @@ -62,6 +62,8 @@ int test_pokemonSV_MapFlyMenuDetector(const ImageViewRGB32& image, bool target); int test_pokemonSV_SandwichPlateDetector(const ImageViewRGB32& image, const std::vector& words); +int test_pokemonSV_RecentlyBattledDetector(const ImageViewRGB32& image, bool target); + } #endif diff --git a/SerialPrograms/Source/Tests/TestMap.cpp b/SerialPrograms/Source/Tests/TestMap.cpp index d928b6351..6426f53c4 100644 --- a/SerialPrograms/Source/Tests/TestMap.cpp +++ b/SerialPrograms/Source/Tests/TestMap.cpp @@ -277,7 +277,8 @@ const std::map TEST_MAP = { {"PokemonSV_MapPokeCenterIconDetector", std::bind(image_int_detector_helper, test_pokemonSV_MapPokeCenterIconDetector, _1)}, {"PokemonSV_ESPPressedEmotionDetector", std::bind(image_bool_detector_helper, test_pokemonSV_ESPPressedEmotionDetector, _1)}, {"PokemonSV_MapFlyMenuDetector", std::bind(image_bool_detector_helper, test_pokemonSV_MapFlyMenuDetector, _1)}, - {"PokemonSV_SandwichPlateDetector", std::bind(image_words_detector_helper, test_pokemonSV_SandwichPlateDetector, _1)} + {"PokemonSV_SandwichPlateDetector", std::bind(image_words_detector_helper, test_pokemonSV_SandwichPlateDetector, _1)}, + {"PokemonSV_RecentlyBattledDetector", std::bind(image_bool_detector_helper, test_pokemonSV_RecentlyBattledDetector, _1)} }; TestFunction find_test_function(const std::string& test_space, const std::string& test_name){