Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,83 @@ const MapIconMatcher& MapIcon_BattleZone(){
return ret;
}

const MapIconMatcher& MapIcon_HyperspaceBattleZone(){
static MapIconMatcher ret(
"PokemonLZA/MapIcons/HyperspaceBattleZone.png",
"HyperspaceBattleZone",
Color(0xff000000),
Color(0xffFB257D),
100,
100.0,
{
{0xff000000, 0xffFB257D},
}
);
return ret;
}

const MapIconMatcher& MapIcon_HyperspaceWildZone(){
static MapIconMatcher ret(
"PokemonLZA/MapIcons/HyperspaceWildZone.png",
"HyperspaceWildZone",
Color(0xff000000),
Color(0xffAED635),
100,
100.0,
{
{0xff000000, 0xffAED635},
}
);
return ret;
}

/*
const MapIconMatcher& MapIcon_HyperspaceEntryQuest(){
static MapIconMatcher ret(
"PokemonLZA/MapIcons/HyperspaceEntryQuest.png",
"HyperspaceEntryWild",
Color(0xff000000),
Color(0xffFFFFDD),
100,
100.0,
{
{0xff000000, 0xffFFFFDD},
}
);
return ret;
}
*/

const MapIconMatcher& MapIcon_HyperspaceEntryWild(){
static MapIconMatcher ret(
"PokemonLZA/MapIcons/HyperspaceEntryWild.png",
"HyperspaceEntryWild",
Color(0xff000000),
Color(0xffAED635),
100,
100.0,
{
{0xff000000, 0xffAED635},
}
);
return ret;
}

const MapIconMatcher& MapIcon_HyperspaceEntryBattle(){
static MapIconMatcher ret(
"PokemonLZA/MapIcons/HyperspaceEntryBattle.png",
"HyperspaceEntryWild",
Color(0xff000000),
Color(0xffFB257D),
100,
100.0,
{
{0xff000000, 0xffFB257D},
}
);
return ret;
}

const MapIconMatcher& get_map_icon_matcher(MapIconType icon){
switch (icon){
case MapIconType::PokemonCenter:
Expand All @@ -177,6 +254,14 @@ const MapIconMatcher& get_map_icon_matcher(MapIconType icon){
return MapIcon_WildZoneFlyable();
case MapIconType::BattleZone:
return MapIcon_BattleZone();
case MapIconType::HyperspaceBattleZone:
return MapIcon_HyperspaceBattleZone();
case MapIconType::HyperspaceWildZone:
return MapIcon_HyperspaceWildZone();
case MapIconType::HyperspaceEntryWild:
return MapIcon_HyperspaceEntryWild();
case MapIconType::HyperspaceEntryBattle:
return MapIcon_HyperspaceEntryBattle();
default:
throw InternalProgramError(
nullptr, PA_CURRENT_FUNCTION,
Expand Down Expand Up @@ -207,6 +292,14 @@ const char* map_icon_type_to_string(MapIconType type){
return "WildZoneFlyable";
case MapIconType::BattleZone:
return "BattleZone";
case MapIconType::HyperspaceBattleZone:
return "HyperspaceBattleZone";
case MapIconType::HyperspaceWildZone:
return "HyperspaceWildZone";
case MapIconType::HyperspaceEntryWild:
return "HyperspaceEntryWild";
case MapIconType::HyperspaceEntryBattle:
return "HyperspaceEntryBattle";
default:
throw InternalProgramError(
nullptr, PA_CURRENT_FUNCTION,
Expand All @@ -226,6 +319,10 @@ MapIconType string_to_map_icon_type(const std::string& str){
if (str == "WildZone") return MapIconType::WildZone;
if (str == "WildZoneFlyable") return MapIconType::WildZoneFlyable;
if (str == "BattleZone") return MapIconType::BattleZone;
if (str == "HyperspaceBattleZone") return MapIconType::HyperspaceBattleZone;
if (str == "HyperspaceWildZone") return MapIconType::HyperspaceWildZone;
if (str == "HyperspaceEntryWild") return MapIconType::HyperspaceEntryWild;
if (str == "HyperspaceEntryBattle") return MapIconType::HyperspaceEntryBattle;
throw InternalProgramError(
nullptr, PA_CURRENT_FUNCTION,
"Unknown MapIconType string: " + str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ enum class MapIconType{
WildZone,
WildZoneFlyable,
BattleZone,
HyperspaceBattleZone, //Icon in Lumiose
HyperspaceWildZone, //Icon in Lumiose
HyperspaceEntryWild, //Icon while in Hyperspace
HyperspaceEntryBattle, //Icon while in Hyperspace
};

const char* map_icon_type_to_string(MapIconType type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,15 @@ bool open_map(ConsoleHandle& console, ProControllerContext& context, bool zoom_t
MapIconDetector pokecenter_icon(COLOR_RED, MapIconType::PokemonCenter, icon_region, &console.overlay());
MapIconDetector flyable_building_icon(COLOR_BLACK, MapIconType::BuildingFlyable, icon_region, &console.overlay());
MapIconDetector flayble_cafe_icon(COLOR_ORANGE, MapIconType::CafeFlyable, icon_region, &console.overlay());
MapIconDetector flyable_hyperspace_battle_zone_icon(COLOR_ORANGE, MapIconType::HyperspaceBattleZone, icon_region, &console.overlay());
MapIconDetector flyable_hyperspace_wild_zone_icon(COLOR_ORANGE, MapIconType::HyperspaceWildZone, icon_region, &console.overlay());

MapWatcher map_detector(COLOR_RED, &console.overlay());
map_detector.attach_map_icon_detector(pokecenter_icon);
map_detector.attach_map_icon_detector(flyable_building_icon);
map_detector.attach_map_icon_detector(flayble_cafe_icon);
map_detector.attach_map_icon_detector(flyable_hyperspace_battle_zone_icon);
map_detector.attach_map_icon_detector(flyable_hyperspace_wild_zone_icon);

do{
map_detector.reset_state();
Expand Down Expand Up @@ -173,7 +178,13 @@ void open_hyperspace_map(ConsoleHandle& console, ProControllerContext& context){

WallClock deadline = current_time() + 30s;

const ImageFloatBox icon_region{0.0, 0.089, 1.0, 0.911};
MapIconDetector flyable_hyperspace_entry_wild_icon(COLOR_ORANGE, MapIconType::HyperspaceEntryWild, icon_region, &console.overlay());
MapIconDetector flyable_hyperspace_entry_battle_icon(COLOR_ORANGE, MapIconType::HyperspaceEntryBattle, icon_region, &console.overlay());

MapWatcher map_detector(COLOR_RED, &console.overlay());
map_detector.attach_map_icon_detector(flyable_hyperspace_entry_wild_icon);
map_detector.attach_map_icon_detector(flyable_hyperspace_entry_battle_icon);

do{
map_detector.reset_state();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "CommonTools/StartupChecks/VideoResolutionCheck.h"
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_Superscalar.h"
#include "NintendoSwitch/Programs/NintendoSwitch_GameEntry.h"
#include "Pokemon/Pokemon_Strings.h"
#include "PokemonLA/Inference/Sounds/PokemonLA_ShinySoundDetector.h"
#include "PokemonLZA/Programs/PokemonLZA_BasicNavigation.h"
Expand Down Expand Up @@ -72,6 +73,11 @@ ShinyHunt_FlySpotReset::ShinyHunt_FlySpotReset()
LockMode::LOCK_WHILE_RUNNING,
Route::NO_MOVEMENT
)
, NUM_RESETS(
"<b>Hyperspace Resets:</b><br>Number of resets when running the Hyperspace Wild Zone route. Each fly takes about 1 Cal. of time. Make sure to leave enough time to catch found shinies.",
LockMode::UNLOCK_WHILE_RUNNING,
100, 1
)
, NOTIFICATION_STATUS("Status Update", true, false, std::chrono::seconds(3600))
, NOTIFICATIONS({
&NOTIFICATION_STATUS,
Expand All @@ -83,6 +89,7 @@ ShinyHunt_FlySpotReset::ShinyHunt_FlySpotReset()
{
PA_ADD_STATIC(SHINY_REQUIRES_AUDIO);
PA_ADD_OPTION(ROUTE);
PA_ADD_OPTION(NUM_RESETS);
PA_ADD_OPTION(SHINY_DETECTED);
PA_ADD_OPTION(NOTIFICATIONS);
}
Expand Down Expand Up @@ -245,6 +252,7 @@ void ShinyHunt_FlySpotReset::program(SingleSwitchProgramEnvironment& env, ProCon
);
}

uint64_t num_resets = 0;
bool to_zoom_to_max = true;
run_until<ProControllerContext>(
env.console, context,
Expand All @@ -254,11 +262,19 @@ void ShinyHunt_FlySpotReset::program(SingleSwitchProgramEnvironment& env, ProCon
shiny_sound_handler.process_pending(context);
route(env, context, stats, to_zoom_to_max);
to_zoom_to_max = false;
num_resets++;
stats.resets++;
env.update_stats();
if (stats.resets.load(std::memory_order_relaxed) % 10 == 0){
send_program_status_notification(env, NOTIFICATION_STATUS);
}

uint64_t num_resets_temp = NUM_RESETS;
if (ROUTE == Route::HYPERSPACE_WILD_ZONE && num_resets >= num_resets_temp){
env.log("Number of resets hit. Going to home to pause the game.");
go_home(env.console, context);
break;
}
} // end while
},
{{shiny_detector}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#ifndef PokemonAutomation_PokemonLZA_ShinyHunt_FlySpotReset_H
#define PokemonAutomation_PokemonLZA_ShinyHunt_FlySpotReset_H

#include "Common/Cpp/Options/SimpleIntegerOption.h"
#include "CommonFramework/Notifications/EventNotificationsTable.h"
#include "NintendoSwitch/NintendoSwitch_SingleSwitchProgram.h"
#include "PokemonLA/Options/PokemonLA_ShinyDetectedAction.h"
Expand Down Expand Up @@ -47,6 +48,7 @@ class ShinyHunt_FlySpotReset : public SingleSwitchProgramInstance{
PokemonLA::ShinyRequiresAudioText SHINY_REQUIRES_AUDIO;
ShinySoundDetectedActionOption SHINY_DETECTED;
EnumDropdownOption<Route> ROUTE;
SimpleIntegerOption<uint64_t> NUM_RESETS;

EventNotificationOption NOTIFICATION_STATUS;
EventNotificationsOption NOTIFICATIONS;
Expand Down
Loading