Skip to content
Open
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 @@ -12,6 +12,7 @@

// General
#include "Programs/PokemonPokopia_CloudIslandReset.h"
#include "Programs/PokemonPokopia_PaletteReset.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
Expand Down Expand Up @@ -39,6 +40,7 @@ std::vector<PanelEntry> PanelListFactory::make_panels() const{
if (IS_BETA_VERSION || PreloadSettings::instance().DEVELOPER_MODE){
ret.emplace_back("---- Untested/Beta/WIP ----");
ret.emplace_back(make_single_switch_program<CloudIslandReset_Descriptor, CloudIslandReset>());
ret.emplace_back(make_single_switch_program<PaletteReset_Descriptor, PaletteReset>());
}

// if (PreloadSettings::instance().DEVELOPER_MODE){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,16 @@ GameSettings::GameSettings()
, m_advanced_options(
"<font size=4><b>Advanced Options:</b> You should not need to touch anything below here.</font>"
)
,GAME_TO_HOME_DELAY0(
"<b>Game to Home Delay:</b><br>Delay from pressing home to entering the the Switch home menu.",
LockMode::LOCK_WHILE_RUNNING,
"1000 ms"
)

{
PA_ADD_STATIC(m_general);
PA_ADD_STATIC(m_advanced_options);
PA_ADD_OPTION(GAME_TO_HOME_DELAY0);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class GameSettings : public BatchOption{

SectionDividerOption m_advanced_options;

MillisecondsOption GAME_TO_HOME_DELAY0;

};

Expand All @@ -35,6 +36,8 @@ class GameSettings : public BatchOption{
class GameSettings_Descriptor : public PanelDescriptor{
public:
GameSettings_Descriptor();


};


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
/* Palette Reset
*
* From: https://github.com/PokemonAutomation/
*
*/

//#include "CommonFramework/Logging/Logger.h"
#include "Common/Cpp/PrettyPrint.h"
#include "CommonFramework/Notifications/ProgramNotifications.h"
#include "CommonTools/StartupChecks/VideoResolutionCheck.h"
#include "NintendoSwitch/NintendoSwitch_Settings.h"
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
#include "NintendoSwitch/Programs/NintendoSwitch_GameEntry.h"
#include "NintendoSwitch/Programs/DateSpam/NintendoSwitch_HomeToDateTime.h"
#include "Pokemon/Pokemon_Strings.h"
#include "PokemonPokopia/Inference/PokemonPokopia_ButtonDetector.h"
#include "PokemonPokopia/Inference/PokemonPokopia_MovesDetection.h"
#include "PokemonPokopia/Inference/PokemonPokopia_PCDetection.h"
#include "PokemonPokopia/Inference/PokemonPokopia_SettingsScreenDetector.h"
#include "CommonFramework/Notifications/ProgramNotifications.h"
#include "PokemonPokopia/PokemonPokopia_Settings.h"

#include "PokemonPokopia/Programs/PokemonPokopia_PCNavigation.h"
#include "PokemonPokopia/Programs/PokemonPokopia_PaletteReset.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonPokopia{

using namespace Pokemon;


PaletteReset_Descriptor::PaletteReset_Descriptor()
: SingleSwitchProgramDescriptor(
"PokemonPokopia:PaletteReset",
STRING_POKEMON + " Pokopia", "Palette Reset",
"Programs/PokemonPokopia/PaletteReset.html",
"Reset Palette Town for Mew stamps and recipes.",
ProgramControllerClass::StandardController_NoRestrictions,
FeedbackType::REQUIRED,
AllowCommandsWhenRunning::DISABLE_COMMANDS
)
{}


PaletteReset::PaletteReset()
: SKIPS(
"<b>Number of Attempts:</b>",
LockMode::UNLOCK_WHILE_RUNNING,
1500
)
, GO_HOME_WHEN_DONE(false)
, NOTIFICATIONS({
&NOTIFICATION_PROGRAM_FINISH,
&NOTIFICATION_ERROR_FATAL,
})
{
PA_ADD_OPTION(SKIPS);
PA_ADD_OPTION(GO_HOME_WHEN_DONE);
PA_ADD_OPTION(NOTIFICATIONS);
}



void PaletteReset::program(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
assert_16_9_720p_min(env.logger(), env.console);

//start in game facing a PC, with the A button visible,
for (uint32_t c = 0; c < SKIPS; c++){
env.log("Resets: " + tostr_u_commas(c));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The resets can be added as a program stat


wait_for_overworld(env.console, context);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

screenshot-20260421-232749398234

If there's an event happening, this extra dialog appears which breaks the flow. I think it's safe to pbf_mash_button() and attach the overworld watcher



access_pc_from_overworld(env.console, context, true);
env.console.log("Opened Cloud Island PC menu");
pbf_wait(context, 2000ms);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor non-gating suggestion: It may be worthwhile to add some logic to detect that the stamp card is actually open before get_stamp(). Possibly by using a watcher for SelectionArrowDetector on ADD_STAMP_BOX.

Having some detection here would stop the program from trailing off in an unknown state in case of something unexpected or setup error (ie. forgetting to pick up Ditto flag). get_stamp() does not distinguish between "not a ditto stamp" and "this isn't even a stamp at all"

Stamp todays_stamp = get_stamp(env.console, context, TODAYS_STAMP_BOX);
Comment on lines +75 to +79
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would break if the user already opened the PC once today since the stamp card would not automatically pop up

if (todays_stamp == Stamp::MEW){
env.log("Mew Stamp found.");
GO_HOME_WHEN_DONE.run_end_of_program(context);
send_program_finished_notification(env, NOTIFICATION_PROGRAM_FINISH);
break;
}

exit_pc(env.console, context);

// Date skip
pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0);
home_to_date_time(env.console, context, true);

pbf_press_button(context, BUTTON_A, 160ms, 840ms);
pbf_press_button(context, BUTTON_A, 48ms, 24ms);//month
pbf_move_left_joystick(context, {0,-1}, 48ms, 24ms);
pbf_press_button(context, BUTTON_A, 48ms, 24ms);//day
pbf_press_button(context, BUTTON_A, 48ms, 24ms);//year
pbf_press_button(context, BUTTON_A, 48ms, 24ms);//hour
pbf_press_button(context, BUTTON_A, 48ms, 24ms);//minute
pbf_press_button(context, BUTTON_A, 48ms, 24ms);//am-pm
pbf_press_button(context, BUTTON_A, 160ms, 840ms);
Comment on lines +93 to +101
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be different for different locales. The NintendoSwitch/Programs/DateSkip area should have routines to abstract this


pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0);
//resume game
resume_game_from_home(env.console, context);

// Date skip
pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0);
home_to_date_time(env.console, context, true);

pbf_press_button(context, BUTTON_A, 160ms, 840ms);
pbf_press_button(context, BUTTON_A, 48ms, 24ms);//month
pbf_move_left_joystick(context, {0,+1}, 48ms, 24ms);
pbf_press_button(context, BUTTON_A, 48ms, 24ms);//day
pbf_press_button(context, BUTTON_A, 48ms, 24ms);//year
pbf_press_button(context, BUTTON_A, 48ms, 24ms);//hour
pbf_press_button(context, BUTTON_A, 48ms, 24ms);//minute
pbf_press_button(context, BUTTON_A, 48ms, 24ms);//am-pm
pbf_press_button(context, BUTTON_A, 160ms, 840ms);

pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0);
//resume game
resume_game_from_home(env.console, context);

pbf_wait(context, 2000ms);

send_program_finished_notification(env, NOTIFICATION_PROGRAM_FINISH);
GO_HOME_WHEN_DONE.run_end_of_program(context);
}



}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/* Palette Reset
*
* From: https://github.com/PokemonAutomation/
*
*/

#ifndef PokemonAutomation_PokemonPokopia_PaletteReset_H
#define PokemonAutomation_PokemonPokopia_PaletteReset_H

#include "Common/Cpp/Options/SimpleIntegerOption.h"
#include "Common/Cpp/Options/ButtonOption.h"
#include "CommonFramework/Notifications/EventNotificationsTable.h"
#include "NintendoSwitch/NintendoSwitch_SingleSwitchProgram.h"
#include "NintendoSwitch/Options/NintendoSwitch_GoHomeWhenDoneOption.h"

namespace PokemonAutomation{

template <typename Type> class ControllerContext;

namespace NintendoSwitch{

class ProController;
using ProControllerContext = ControllerContext<ProController>;

namespace PokemonPokopia{


class PaletteReset_Descriptor : public SingleSwitchProgramDescriptor{
public:
PaletteReset_Descriptor();

};


class PaletteReset : public SingleSwitchProgramInstance{
public:
PaletteReset();

virtual void program(SingleSwitchProgramEnvironment& env, ProControllerContext& context) override;


private:
SimpleIntegerOption<uint32_t> SKIPS;
GoHomeWhenDoneOption GO_HOME_WHEN_DONE;
EventNotificationsOption NOTIFICATIONS;
};



}
}
}
#endif
Loading