diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_SaveCardReader.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_SaveCardReader.cpp index d2cfeece86..500c80b1e8 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_SaveCardReader.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Inference/Menus/PokemonFRLG_SaveCardReader.cpp @@ -86,6 +86,8 @@ class PlaceNameMatcher : public OCR::SmallDictionaryMatcher{ {"saffron-city", "Saffron City"}, {"cinnabar-island", "Cinnabar Island"}, {"silph-co", "Silph Co"}, + {"cinnabar-island", "Cinnabar Island"}, + {"pokemon-mansion", "Pokemon Mansion"}, }){ JsonArray names; names.push_back(std::string(name)); diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.cpp index 52ea13652d..fca044320c 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.cpp @@ -163,6 +163,11 @@ constexpr std::string_view MAP_NAMES[] = { "SilphCo_9F", "SilphCo_10F", "SilphCo_11F", + // The Pokemon Mansion's four floors, for the SECRET KEY. + "PokemonMansion_1F", + "PokemonMansion_2F", + "PokemonMansion_3F", + "PokemonMansion_B1F", "CeruleanCave_1F", "CeruleanCave_2F", "CeruleanCave_B1F", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp index f3486697a1..a65f0fbe6f 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp @@ -57,6 +57,7 @@ #include "Programs/AutoStory/PokemonFRLG_AutoStoryHealing.h" #include "Programs/AutoStory/PokemonFRLG_AutoStoryRows12_Tests.h" #include "Programs/AutoStory/PokemonFRLG_AutoStoryRows15_Tests.h" +#include "Programs/AutoStory/PokemonFRLG_AutoStoryRows13_Tests.h" #include "Programs/AutoStory/PokemonFRLG_AutoStoryRows16_Tests.h" #include "Programs/AutoStory/PokemonFRLG_AutoStoryTable.h" #include "Programs/AutoStory/PokemonFRLG_AutoStoryTrashCans.h" @@ -114,6 +115,7 @@ static void add_tests_AutoStoryRows(UnitTestDatabase& database){ add_tests_AutoStoryCeladonGym(database); add_tests_AutoStorySaffron(database); add_tests_AutoStorySilph(database); + add_tests_AutoStoryMansion(database); } void add_tests(UnitTestDatabase& database){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp index 435c2fb451..0682222895 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp @@ -373,6 +373,8 @@ std::string save_card_place(const std::string& map){ {"SaffronCity", "saffron-city"}, {"CinnabarIsland", "cinnabar-island"}, {"SilphCo", "silph-co"}, + {"CinnabarIsland", "cinnabar-island"}, + {"PokemonMansion", "pokemon-mansion"}, }; for (const auto& [prefix, place] : PLACES){ if (map == prefix || map.rfind(prefix + "_", 0) == 0){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMansion_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMansion_Tests.cpp new file mode 100644 index 0000000000..01aeb65a89 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMansion_Tests.cpp @@ -0,0 +1,225 @@ +/* AutoStory Mansion Tests + * + * From: https://github.com/PokemonAutomation/ + * + * Rows 13.01 to 13.04 (StoryData/frlg-13.0N.plan.json) on the overworld + * sim: Cinnabar's Center to the Pokemon Mansion's statue switches, the + * SECRET KEY and the Escape Rope out. The sim has the map's switch state + * (flag clear), so a step through a barrier the switches open is declared. + * + */ + +#include +#include +#include +#include +#include +#include +#include "Common/Cpp/Exceptions.h" +#include "Common/Cpp/TestRunners/UnitTest.h" +#include "Pokemon/AutoStory/Pokemon_BuiltinStoryActions.h" +#include "Pokemon/AutoStory/Pokemon_StoryStepExecutor.h" +#include "Pokemon/Navigation/Pokemon_MapData.h" +#include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.h" +#include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.h" +#include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalkTimes.h" +#include "PokemonFRLG_AutoStoryEvents.h" +#include "PokemonFRLG_AutoStoryRooms.h" +#include "PokemonFRLG_AutoStoryRowSim.h" +#include "PokemonFRLG_AutoStoryRows_Tests.h" +#include "PokemonFRLG_AutoStoryRows13_Tests.h" +#include "PokemonFRLG_AutoStoryTable.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonFRLG{ + + +namespace{ + +struct AutoStoryMansionInput{ + std::string name; + std::function body; +}; + +struct AutoStoryMansionExpectation{ + std::string_view description; +}; + +struct AutoStoryMansionCase{ + AutoStoryMansionInput input; + AutoStoryMansionExpectation expectation; +}; + +class Test_AutoStoryMansion : public UnitTest{ +public: + explicit Test_AutoStoryMansion(AutoStoryMansionCase test_case) + : UnitTest(std::format("PokemonFRLG::AutoStory - Simulation: {}", test_case.input.name)) + , m_case(std::move(test_case)) + {} + virtual UnitTestResult run(Logger&, CancellableScope&) const override{ + try{ + return m_case.input.body(); + }catch (Exception& e){ + return std::format("{}: {}", e.name(), e.message()); + } + } + +private: + AutoStoryMansionCase m_case; +}; + +const StoryCheckpoint& checkpoint(std::string_view id){ + for (const StoryCheckpoint& row : story_checkpoints()){ + if (row.id == id){ + return row; + } + } + throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, std::format("No checkpoint {}.", id)); +} + +// Burglar Lewis, B1F's wanderer: he walks (19..21, 24..26) with sight 1 and +// looks every way, so the sim, which takes his whole range as seen, meets +// him where 13.03 passes (22, 24). Whether he is there is up to the dice; +// the battle code fights him if he sees the player. Nobody else is met. +const std::string LEWIS = "poke_maniac"; + +struct MansionRow{ + std::string_view id; + MapPosition end; + std::vector floors; +}; + +// A step over a tile the switches open: the pack's maps are the clear +// state, where it is a wall, so the sim cannot walk it and the step's +// declared pose stands. `wall` is whether the tile it lands on is such a +// barrier on the map; the step after it, onto floor, is declared too. +struct SwitchStep{ + std::string_view row; + std::string_view step; + bool wall; +}; + +const SwitchStep SWITCH_STEPS[] = { + {"13.02", "into_opening_1", true}, + {"13.02", "into_opening_2", true}, + {"13.02", "through_opening", false}, + {"13.03", "into_room_2", true}, + {"13.03", "into_room_3", true}, + {"13.04", "into_opening", true}, + {"13.04", "through_opening", false}, +}; + +const SwitchStep* switch_step(std::string_view row, std::string_view step){ + for (const SwitchStep& item : SWITCH_STEPS){ + if (item.row == row && item.step == step){ + return &item; + } + } + return nullptr; +} + +bool map_wall(const MapPosition& at){ + for (const MapData& map : story_maps()){ + if (map.name == at.map){ + return map.tiles.at(at.point) == TileKind::WALL; + } + } + throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, std::format("No map {}.", at.map)); +} + +// A row on the sim from its start: every step lands (a switch step on its +// declared pose, on a barrier that is a wall on the map), the row ends on +// its postcondition's tile after the floors it should cross, and nobody but Lewis is met and no rule is broken on the way (checked +// after each step). +UnitTestResult test_row(const MansionRow& expected){ + const StoryCheckpoint& row = checkpoint(expected.id); + StoryPose at = *story_pose(Pokemon::pose_of(*row.start)); + std::optional sim; + sim.emplace(story_maps(), MapPosition{at.map, at.tile}, *at.facing); + std::vector floors; + for (const StoryStep& step : row.steps){ + if (const SwitchStep* barrier = switch_step(row.id, step.name)){ + at = *story_pose(Pokemon::pose_of(*step.pose_after)); + if (map_wall(MapPosition{at.map, at.tile}) != barrier->wall){ + return std::format("{}/{}: expected {} on {}.", row.id, step.name, barrier->wall ? "a barrier" : "floor", to_string(MapPosition{at.map, at.tile})); + } + sim.emplace(story_maps(), MapPosition{at.map, at.tile}, *at.facing); + }else if (step.name == "escape_rope"){ + // The rope's script has no map: the player stands where it says. + at = *story_pose(Pokemon::pose_of(*step.pose_after)); + sim.emplace(story_maps(), MapPosition{at.map, at.tile}, *at.facing); + }else if (const std::string failure = row_step_on_sim(*sim, at, step, row.id); !failure.empty()){ + return std::format("{}: ended on {}; {}", row.id, to_string(sim->state().position), failure); + } + if (step.name == "down_the_hole"){ + // The hole's fade: a declared step does not wait it out, a walk does. + sim->watch({}, OverworldWalkSteps::AFTER_WARP); + } + if (!sim->state().violations.empty()){ + return std::format("{}/{}: broke a rule on the way, on {}: {}.", row.id, step.name, to_string(sim->state().position), sim->state().violations.front()); + } + for (const std::string& trainer : sim->state().trainers_beaten){ + if (trainer != LEWIS){ + return std::format("{}/{}: met a trainer: {}.", row.id, step.name, trainer); + } + } + if (floors.empty() || floors.back() != at.map){ + floors.push_back(at.map); + } + } + if (!(MapPosition{at.map, at.tile} == expected.end)){ + return std::format("{}: ended on {}, not {}.", row.id, to_string(MapPosition{at.map, at.tile}), to_string(expected.end)); + } + if (floors != expected.floors){ + std::string crossed; + for (const std::string& floor : floors){ + crossed += std::format(" {}", floor); + } + return std::format("{}: the steps crossed the wrong floors:{}.", row.id, crossed); + } + return true; +} + +const MansionRow ROW_13_01{"13.01", {"PokemonMansion_3F", {12, 6}}, + {"PokemonMansion_3F"}}; +const MansionRow ROW_13_02{"13.02", {"PokemonMansion_B1F", {34, 29}}, + {"PokemonMansion_3F", "PokemonMansion_1F", "PokemonMansion_B1F"}}; +const MansionRow ROW_13_03{"13.03", {"PokemonMansion_B1F", {27, 6}}, + {"PokemonMansion_B1F"}}; +const MansionRow ROW_13_04{"13.04", {"CinnabarIsland", {8, 4}}, + {"PokemonMansion_B1F", "CinnabarIsland"}}; + +const AutoStoryMansionCase AUTO_STORY_MANSION_CASES[] = { + { + .input = {.name = "13.01 Cinnabar to the Mansion's 3F statue", .body = []{ return test_row(ROW_13_01); }}, + .expectation = {.description = "through 1F and 2F to 3F's (12, 6), nobody met"}, + }, + { + .input = {.name = "13.02 3F's opening, the hole, 1F's stairs", .body = []{ return test_row(ROW_13_02); }}, + .expectation = {.description = "through the declared opening and the hole to B1F's (34, 29)"}, + }, + { + .input = {.name = "13.03 B1F's two statues, the Elixir and TM14", .body = []{ return test_row(ROW_13_03); }}, + .expectation = {.description = "through the declared opening to (27, 6), nobody but Lewis met"}, + }, + { + .input = {.name = "13.04 the SECRET KEY and the Escape Rope", .body = []{ return test_row(ROW_13_04); }}, + .expectation = {.description = "through the declared opening to the key, out by the rope to (8, 4)"}, + }, +}; + +} // namespace + + +void add_tests_AutoStoryMansion(UnitTestDatabase& database){ + for (const auto& item : AUTO_STORY_MANSION_CASES){ + database.add(item); + } +} + + + +} // namespace PokemonFRLG +} // namespace NintendoSwitch +} // namespace PokemonAutomation diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden13.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden13.h new file mode 100644 index 0000000000..8f249b0c04 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden13.h @@ -0,0 +1,42 @@ +/* FRLG AutoStory Plan Golden, Segment 13 + * + * From: https://github.com/PokemonAutomation/ + * + * The golden's lines of segment 13 (the Pokemon Mansion), which STORY_ORDER + * places after segment 16's. The test reads FRLG_PLAN_GOLDEN_16, then these. + * + */ + +#ifndef PokemonAutomation_PokemonFRLG_AutoStoryPlanGolden13_H +#define PokemonAutomation_PokemonFRLG_AutoStoryPlanGolden13_H + +#include + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonFRLG{ + +// The stored plan lines of segment 13, after FRLG_PLAN_GOLDEN_16's. +inline constexpr std::string_view FRLG_PLAN_GOLDEN_13[] = { + "13.01 mansion_3f from CinnabarIsland_PokemonCenter_1F (7, 4) facing north to PokemonMansion_3F (8, 3) facing east", + "13.01 walk south 5 (warp) -> CinnabarIsland (14, 12) [walk only]", + "13.01 walk east 7 -> CinnabarIsland (21, 12)", + "13.01 walk north 7 (to wall) -> CinnabarIsland (21, 5)", + "13.01 walk west 13 -> CinnabarIsland (8, 5)", + "13.01 walk north 2 (warp) -> PokemonMansion_1F (8, 33)", + "13.01 walk north 20 (to wall) -> PokemonMansion_1F (8, 13) [wild]", + "13.01 walk east 3 (warp) -> PokemonMansion_2F (6, 14) [wild]", + "13.01 walk south 4 (to wall) -> PokemonMansion_2F (6, 18) [wild]", + "13.01 walk east 11 (to wall) -> PokemonMansion_2F (17, 18) [wild]", + "13.01 walk north 12 -> PokemonMansion_2F (17, 6) [wild]", + "13.01 walk west 8 -> PokemonMansion_2F (9, 6) [wild]", + "13.01 walk north 3 (to wall) -> PokemonMansion_2F (9, 3) [wild]", + "13.01 walk east 1 (warp) -> PokemonMansion_3F (8, 3)", + "13.02 down_to_b1f from PokemonMansion_1F (26, 27) facing north to PokemonMansion_B1F (34, 29) facing west", + "13.02 walk west 2 (warp) -> PokemonMansion_B1F (34, 29)", +}; + +} // namespace PokemonFRLG +} // namespace NintendoSwitch +} // namespace PokemonAutomation +#endif diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows13_Tests.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows13_Tests.h new file mode 100644 index 0000000000..15aac02145 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows13_Tests.h @@ -0,0 +1,27 @@ +/* AutoStory Row Tests, Segment 13 + * + * From: https://github.com/PokemonAutomation/ + * + * Registration of the tests that run segment 13's rows (the Pokemon + * Mansion) on the overworld sim. + * + */ + +#ifndef PokemonAutomation_PokemonFRLG_AutoStoryRows13_Tests_H +#define PokemonAutomation_PokemonFRLG_AutoStoryRows13_Tests_H + +#include "Common/Cpp/TestRunners/UnitTestDatabase.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonFRLG{ + + +// Rows 13.01 to 13.04, the Pokemon Mansion, on the overworld sim (PokemonFRLG_AutoStoryMansion_Tests.cpp). +void add_tests_AutoStoryMansion(UnitTestDatabase& database); + + +} // namespace PokemonFRLG +} // namespace NintendoSwitch +} // namespace PokemonAutomation +#endif diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRunPlan_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRunPlan_Tests.cpp index 0678a7f55f..e53b1ead3f 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRunPlan_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRunPlan_Tests.cpp @@ -145,7 +145,7 @@ class Test_RunPlan : public UnitTest{ const RunPlanScenario m_scenario; }; -const std::string TODAY = "01.01 01.03 01.04 01.05 02.01 02.02 02.03 03.01 03.02 03.03 04.01 04.02 04.04 04.05 04.06 05.01 05.02 05.03 05.04 05.05 05.06 05.07 05.08 05.09 05.10 06.01 06.02 06.03 06.04 07.01 07.02 08.01 08.02 08.03 09.01 09.02 09.03 10.01 10.02 10.03 10.04 10.05 10.06 11.01 11.02 11.03 12.01 12.02 12.02b 12.03 14.03 14.04 14.04b 15.01 16.01"; +const std::string TODAY = "01.01 01.03 01.04 01.05 02.01 02.02 02.03 03.01 03.02 03.03 04.01 04.02 04.04 04.05 04.06 05.01 05.02 05.03 05.04 05.05 05.06 05.07 05.08 05.09 05.10 06.01 06.02 06.03 06.04 07.01 07.02 08.01 08.02 08.03 09.01 09.02 09.03 10.01 10.02 10.03 10.04 10.05 10.06 11.01 11.02 11.03 12.01 12.02 12.02b 12.03 13.01 13.02 13.03 13.04 14.03 14.04 14.04b 15.01 16.01"; const RunPlanScenario RUN_PLAN_CASES[] = { { @@ -236,11 +236,11 @@ const RunPlanScenario RUN_PLAN_CASES[] = { }, { .input = {.name = "Gift RNG off: 04.03 is passed over", .first = "04.01"}, - .expectation = {.expected_ids = "04.01 04.02 04.04 04.05 04.06 05.01 05.02 05.03 05.04 05.05 05.06 05.07 05.08 05.09 05.10 06.01 06.02 06.03 06.04 07.01 07.02 08.01 08.02 08.03 09.01 09.02 09.03 10.01 10.02 10.03 10.04 10.05 10.06 11.01 11.02 11.03 12.01 12.02 12.02b 12.03 14.03 14.04 14.04b 15.01 16.01"}, + .expectation = {.expected_ids = "04.01 04.02 04.04 04.05 04.06 05.01 05.02 05.03 05.04 05.05 05.06 05.07 05.08 05.09 05.10 06.01 06.02 06.03 06.04 07.01 07.02 08.01 08.02 08.03 09.01 09.02 09.03 10.01 10.02 10.03 10.04 10.05 10.06 11.01 11.02 11.03 12.01 12.02 12.02b 12.03 13.01 13.02 13.03 13.04 14.03 14.04 14.04b 15.01 16.01"}, }, { .input = {.name = "Gift RNG off: 04.03 runs when started at", .first = "04.03"}, - .expectation = {.expected_ids = "04.03 04.04 04.05 04.06 05.01 05.02 05.03 05.04 05.05 05.06 05.07 05.08 05.09 05.10 06.01 06.02 06.03 06.04 07.01 07.02 08.01 08.02 08.03 09.01 09.02 09.03 10.01 10.02 10.03 10.04 10.05 10.06 11.01 11.02 11.03 12.01 12.02 12.02b 12.03 14.03 14.04 14.04b 15.01 16.01"}, + .expectation = {.expected_ids = "04.03 04.04 04.05 04.06 05.01 05.02 05.03 05.04 05.05 05.06 05.07 05.08 05.09 05.10 06.01 06.02 06.03 06.04 07.01 07.02 08.01 08.02 08.03 09.01 09.02 09.03 10.01 10.02 10.03 10.04 10.05 10.06 11.01 11.02 11.03 12.01 12.02 12.02b 12.03 13.01 13.02 13.03 13.04 14.03 14.04 14.04b 15.01 16.01"}, }, { .input = { .name = "Gift RNG: started at 04.03, from the save beside the salesman", @@ -279,7 +279,7 @@ const RunPlanScenario RUN_PLAN_CASES[] = { }, { .input = {.name = "Starter RNG alone: 04.03 runs when started at", .first = "04.03", .handoffs = {.starter_rng = true}}, - .expectation = {.expected_ids = "04.03 04.04 04.05 04.06 05.01 05.02 05.03 05.04 05.05 05.06 05.07 05.08 05.09 05.10 06.01 06.02 06.03 06.04 07.01 07.02 08.01 08.02 08.03 09.01 09.02 09.03 10.01 10.02 10.03 10.04 10.05 10.06 11.01 11.02 11.03 12.01 12.02 12.02b 12.03 14.03 14.04 14.04b 15.01 16.01"}, + .expectation = {.expected_ids = "04.03 04.04 04.05 04.06 05.01 05.02 05.03 05.04 05.05 05.06 05.07 05.08 05.09 05.10 06.01 06.02 06.03 06.04 07.01 07.02 08.01 08.02 08.03 09.01 09.02 09.03 10.01 10.02 10.03 10.04 10.05 10.06 11.01 11.02 11.03 12.01 12.02 12.02b 12.03 13.01 13.02 13.03 13.04 14.03 14.04 14.04b 15.01 16.01"}, }, { .input = { .name = "Starter RNG first, with both on", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySimulation_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySimulation_Tests.cpp index 8c655a9757..67ad4d8c7e 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySimulation_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySimulation_Tests.cpp @@ -40,6 +40,7 @@ #include "PokemonFRLG_AutoStoryRows_Tests.h" #include "PokemonFRLG_AutoStoryStepTable.h" #include "PokemonFRLG_AutoStoryTable.h" +#include "PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h" namespace PokemonAutomation{ namespace NintendoSwitch{ @@ -226,9 +227,13 @@ UnitTestResult test_whole_story(){ if (sim.begun() != ids || sim.saves.size() != ids.size()){ return "Expected each checkpoint once, in order, each saving at its end:" + joined(sim.game.trace); } - // Each checkpoint starts where the save before it stands. + // Each checkpoint starts where the save before it stands, but one + // authored before the rows that lead up to it. for (size_t c = 1; c < sim.rows.size(); c++){ const StoryCheckpoint& data = sim.rows[c]; + if (starts_after_unauthored_rows(data.id)){ + continue; + } const std::optional start = story_pose(*start_pose(data)); const std::optional saved = story_pose(sim.saves[c - 1].second); const bool same = start && saved && start->map == saved->map && start->tile == saved->tile diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp index b16885c6eb..887d520f7d 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp @@ -234,7 +234,8 @@ constexpr std::string_view STORY_ORDER[] = { "05.03", "05.04", "05.05", "05.06", "05.07", "05.08", "05.09", "05.10", "06.01", "06.02", "06.03", "06.04", "07.01", "07.02", "08.01", "08.02", "08.03", "09.01", "09.02", "09.03", "09.04", "10.01", "10.02", "10.03", "10.04", "10.05", "10.06", "11.01", "11.02", "11.03", - "12.01", "12.02", "12.02b", "12.03", "14.03", "14.04", "14.04b", "15.01", "16.01", + "12.01", "12.02", "12.02b", "12.03", + "13.01", "13.02", "13.03", "13.04", "14.03", "14.04", "14.04b", "15.01", "16.01", }; // `checkpoints` in STORY_ORDER's order. Throws ParseException for a diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h new file mode 100644 index 0000000000..314b38975f --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h @@ -0,0 +1,34 @@ +/* AutoStory Unauthored Starts + * + * From: https://github.com/PokemonAutomation/ + * + * Which checkpoints start from their own declared pose in the tests. + * + */ + +#ifndef PokemonAutomation_PokemonFRLG_AutoStoryUnauthoredStarts_Tests_H +#define PokemonAutomation_PokemonFRLG_AutoStoryUnauthoredStarts_Tests_H + +#include + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonFRLG{ + + +// Whether checkpoint `id` was authored before the rows that lead up to it: +// it starts from its own declared pose, not where the row before it in +// the story's order (STORY_ORDER in PokemonFRLG_AutoStoryTable.cpp) ends. +// 14.03 starts at Cinnabar's Center nurse, where no row before it in the +// order ends (the Mansion's 13.04 ends outside, by an Escape Rope, and +// Blaine's rows 14.01 to 14.02b, which heal at that Center, are not in +// yet). An id leaves this list once the rows before it are in. +inline bool starts_after_unauthored_rows(std::string_view id){ + return id == "14.03"; +} + + +} // namespace PokemonFRLG +} // namespace NintendoSwitch +} // namespace PokemonAutomation +#endif diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp index 1a9e110858..036e20b4e1 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp @@ -40,10 +40,12 @@ #include "PokemonFRLG_AutoStoryPlanGolden12.h" #include "PokemonFRLG_AutoStoryPlanGolden15.h" #include "PokemonFRLG_AutoStoryPlanGolden16.h" +#include "PokemonFRLG_AutoStoryPlanGolden13.h" #include "PokemonFRLG_AutoStoryRows_Tests.h" #include "PokemonFRLG_AutoStoryMoveData.h" #include "PokemonFRLG_AutoStoryStepTable.h" #include "PokemonFRLG_AutoStoryTable.h" +#include "PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h" namespace PokemonAutomation{ namespace NintendoSwitch{ @@ -284,16 +286,19 @@ UnitTestResult check_checkpoint(const StoryCheckpoint& checkpoint, StoryPose& po } // Plans every route of the story, each checkpoint from where the one -// before leaves the player, and adds the plans to `golden`. +// before leaves the player (or, past rows not authored yet, from its own +// start: starts_after_unauthored_rows()), and adds the plans to `golden`. UnitTestResult chain_story_routes(std::vector& golden){ const std::vector& checkpoints = story_checkpoints(); - if (checkpoints.size() != 59 || checkpoints[0].start){ - return "Expected 59 checkpoints, the first from a new game."; + if (checkpoints.size() != 63 || checkpoints[0].start){ + return "Expected 63 checkpoints, the first from a new game."; } StoryPose pose; for (size_t c = 0; c < checkpoints.size(); c++){ const StoryCheckpoint& checkpoint = checkpoints[c]; - if (c > 0){ + if (c > 0 && starts_after_unauthored_rows(checkpoint.id)){ + pose = one_tile(Pokemon::grid_pose_of(*checkpoint.start)); + }else if (c > 0){ const StoryPose start = one_tile(Pokemon::grid_pose_of(*checkpoint.start)); const bool same_facing = !start.facing || start.facing == pose.facing; if (start.map != pose.map || !(start.tile == pose.tile) || !same_facing){ @@ -330,6 +335,7 @@ UnitTestResult test_golden_plans(){ golden.insert(golden.end(), std::begin(FRLG_PLAN_GOLDEN_10), std::end(FRLG_PLAN_GOLDEN_10)); golden.insert(golden.end(), std::begin(FRLG_PLAN_GOLDEN_11), std::end(FRLG_PLAN_GOLDEN_11)); golden.insert(golden.end(), std::begin(FRLG_PLAN_GOLDEN_12), std::end(FRLG_PLAN_GOLDEN_12)); + golden.insert(golden.end(), std::begin(FRLG_PLAN_GOLDEN_13), std::end(FRLG_PLAN_GOLDEN_13)); golden.insert(golden.end(), std::begin(FRLG_PLAN_GOLDEN_12_CELADON), std::end(FRLG_PLAN_GOLDEN_12_CELADON)); golden.insert(golden.end(), std::begin(FRLG_PLAN_GOLDEN_15), std::end(FRLG_PLAN_GOLDEN_15)); golden.insert(golden.end(), std::begin(FRLG_PLAN_GOLDEN_16), std::end(FRLG_PLAN_GOLDEN_16)); @@ -685,7 +691,10 @@ UnitTestResult check_lines(const StoryCheckpoint& checkpoint, std::set> stops = walks ? wanderer_stops(pose, step) : std::vector>{}; - if (std::count(stops.begin(), stops.end(), std::nullopt) > 0){ + // 13.03's walk into Lewis's room, B1F of the Pokemon Mansion: its one way in, + // (22, 24), is beside his wander range (19..21, 24..26), on a cave's wild floor. + const bool lewis = checkpoint.id == "13.03" && step.name == "to_statue"; + if (!lewis && std::count(stops.begin(), stops.end(), std::nullopt) > 0){ return where + "crosses a wandering trainer's sight where the walk can't tell where they'd stop the player."; } if (const std::string problem = walks ? held_past_lookers(pose, step, beaten) : ""; !problem.empty()){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-13.01.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-13.01.plan.json new file mode 100644 index 0000000000..da40ebbfcb --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-13.01.plan.json @@ -0,0 +1,110 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "frlg", + "checkpoint": { + "id": "13.01", + "title": "Cinnabar to the Pokemon Mansion: 1F and 2F up to 3F's statue, press it", + "start": { + "map": "CinnabarIsland_PokemonCenter_1F", + "tiles": [ + [ + 7, + 4 + ] + ], + "facing": "north" + }, + "events": [ + { + "id": "mansion_3f", + "kind": "route", + "action": "run", + "args": { + "target": { + "map": "PokemonMansion_3F", + "tiles": [ + [ + 8, + 3 + ] + ], + "facing": "east" + } + }, + "why": "out of Cinnabar's Center, up to the Mansion door (8, 3), 1F (8, 33) up its stairs (10, 13) to 2F (6, 14), through 2F's rooms to the stairs (9, 3), onto 3F's (8, 3); all in the switch's clear state, which is the map's" + }, + { + "id": "to_statue", + "kind": "legs", + "action": "taps", + "args": { + "legs": [ + { + "direction": "south", + "tiles": 3 + }, + { + "direction": "east", + "tiles": 4 + } + ] + }, + "why": "a tap a tile on 3F in the clear state: down to (8, 6) and east along row 6 to (12, 6), below the statue (12, 5)" + }, + { + "id": "face_statue", + "kind": "step", + "args": { + "direction": "north" + }, + "declared_after": { + "map": "PokemonMansion_3F", + "tiles": [ + [ + 12, + 6 + ] + ], + "facing": "north" + }, + "why": "turn north to the statue (12, 5)" + }, + { + "id": "press_3f_statue", + "kind": "talk", + "why": "face the statue (12, 5) and press A: \"Press the secret switch?\"" + }, + { + "id": "press_3f", + "kind": "answer", + "why": "YES: \"Who wouldn't?\"; the switch flag is set, 3F's (17-19,11-12) open, its (21,4-8) close" + } + ] + }, + "execution": { + "menu": "full", + "notes": { + "checkpoint": [ + "Starts at Cinnabar's nurse, facing her, where 12.03 ends (Fly to Pallet Town and Surf down Route 21, as PokeGuy goes after Koga). Ends on 3F (12, 6) facing the statue it just pressed.", + "The Mansion's statue switches: one flag for all four floors. Switch model (pokefirered data/scripts/pokemon_mansion.inc, PokemonMansion_*F scripts.inc; one global flag, set on a press and applied on each floor's load; the pack's maps are the flag-clear state only). Assumed per floor (read from pokefirered; the overlay data on PokemonSimulation's maps/frlg-mansion-switches branch, seen 2026-11-12, has the same tiles open or closed per state): 1F set: (22-24,10-11), (27-29,25-26), (32-34,25-26) open, (31-33,18-19) closed. 2F set: (24-26,14-15), (10,30-32) open, (12,4-8) closed, (10,28-29) wall. 3F set: (17-19,11-12) open, (21,4-8) closed. B1F set: (12,10-12), (20-22,22-23) open, (33-35,20-21) and (16,28-30) closed. Clear = the map as it is.", + "13.01 walks only in the clear state; the press at its end sets the flag, and every row after walks the set state until a statue is pressed again (13.03 presses B1F's two).", + "Mansion trainers met on this walk: 1F Johnson wanders row 8, 2F Arnie (5, 23) and 3F Simon (6-8, 12-14) are off the route (the route takes 2F's northern rooms and 3F's (8, 3) arrival)." + ] + } + }, + "metadata": { + "phase": "testing", + "postconditions": { + "position": { + "map": "PokemonMansion_3F", + "tiles": [ + [ + 12, + 6 + ] + ], + "facing": "north" + } + } + } +} diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-13.02.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-13.02.plan.json new file mode 100644 index 0000000000..db95982209 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-13.02.plan.json @@ -0,0 +1,214 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "frlg", + "checkpoint": { + "id": "13.02", + "title": "Pokemon Mansion 3F through the switch's opening, the hole to 1F, 1F's stairs to B1F", + "start": { + "map": "PokemonMansion_3F", + "tiles": [ + [ + 12, + 6 + ] + ], + "facing": "north" + }, + "events": [ + { + "id": "to_barrier", + "kind": "legs", + "action": "taps", + "args": { + "legs": [ + { + "direction": "east", + "tiles": 7 + }, + { + "direction": "south", + "tiles": 4 + } + ] + }, + "why": "a tap a tile: east along row 6 to (19, 6), south to (19, 10), above 3F's opening (17-19, 11-12), set open by the press (the map has it closed)" + }, + { + "id": "into_opening_1", + "kind": "step", + "args": { + "direction": "south" + }, + "declared_after": { + "map": "PokemonMansion_3F", + "tiles": [ + [ + 19, + 11 + ] + ], + "facing": "south" + }, + "why": "a step onto (19, 11): the opening is open only in the set state, closed on the map" + }, + { + "id": "into_opening_2", + "kind": "step", + "args": { + "direction": "south" + }, + "declared_after": { + "map": "PokemonMansion_3F", + "tiles": [ + [ + 19, + 12 + ] + ], + "facing": "south" + }, + "why": "a step onto (19, 12), the opening's second row" + }, + { + "id": "through_opening", + "kind": "step", + "args": { + "direction": "south" + }, + "declared_after": { + "map": "PokemonMansion_3F", + "tiles": [ + [ + 19, + 13 + ] + ], + "facing": "south" + }, + "why": "a step through onto (19, 13), the room of holes" + }, + { + "id": "to_hole_edge", + "kind": "legs", + "action": "taps", + "args": { + "legs": [ + { + "direction": "south", + "tiles": 4 + } + ] + }, + "why": "a tap a tile down column 19 to (19, 17), above the hole row (18..20, 18); Braydon (22, 13) looks south along column 22, so x 19 is clear" + }, + { + "id": "down_the_hole", + "kind": "step", + "args": { + "direction": "south" + }, + "declared_after": { + "map": "PokemonMansion_1F", + "tiles": [ + [ + 20, + 22 + ] + ], + "facing": "south" + }, + "why": "a step onto the hole (19, 18), which drops to 1F (20, 22) (3F map.json warp to 1F warp 8)" + }, + { + "id": "to_stairs", + "kind": "legs", + "action": "taps", + "args": { + "legs": [ + { + "direction": "south", + "tiles": 1 + }, + { + "direction": "west", + "tiles": 3 + }, + { + "direction": "south", + "tiles": 2 + }, + { + "direction": "east", + "tiles": 1 + }, + { + "direction": "south", + "tiles": 2 + }, + { + "direction": "east", + "tiles": 4 + }, + { + "direction": "south", + "tiles": 2 + }, + { + "direction": "east", + "tiles": 4 + }, + { + "direction": "north", + "tiles": 2 + } + ] + }, + "why": "a tap a tile along 1F's southern rooms to (26, 27): west to column 17 (Ted (22, 24) looks west along row 24 and sees x 18-21 only), down to row 27, east on to (22, 27), (22, 29), (26, 29) and up to (26, 27), east of the stairs (25, 27), an arrow warp to B1F (34, 29)" + }, + { + "id": "down_to_b1f", + "kind": "route", + "action": "run", + "args": { + "target": { + "map": "PokemonMansion_B1F", + "tiles": [ + [ + 34, + 29 + ] + ], + "facing": "west" + } + }, + "why": "west from (26, 27) onto the stairs (25, 27), an arrow warp, to B1F's (34, 29)" + } + ] + }, + "execution": { + "menu": "full", + "notes": { + "checkpoint": [ + "Starts where 13.01 ends, 3F (12, 6) facing the pressed statue. Ends on B1F (34, 29), the foot of 1F's stairs, in the set state.", + "Barriers: Switch model (pokefirered data/scripts/pokemon_mansion.inc, PokemonMansion_*F scripts.inc; one global flag, set on a press and applied on each floor's load; the pack's maps are the flag-clear state only). Assumed per floor (read from pokefirered; the overlay data on PokemonSimulation's maps/frlg-mansion-switches branch, seen 2026-11-12, has the same tiles open or closed per state): 1F set: (22-24,10-11), (27-29,25-26), (32-34,25-26) open, (31-33,18-19) closed. 2F set: (24-26,14-15), (10,30-32) open, (12,4-8) closed, (10,28-29) wall. 3F set: (17-19,11-12) open, (21,4-8) closed. B1F set: (12,10-12), (20-22,22-23) open, (33-35,20-21) and (16,28-30) closed. Clear = the map as it is.", + "This row walks 3F and 1F in the set state: 3F (19, 11-12) are open, so the three single steps are declared (the map has the barrier there); the holes (18..20, 18) drop to 1F (19, 22) and (20, 22), and 1F's east rooms (x 17-37, y 20-33) are reachable only by them (a wall at x 16 splits them from the west).", + "The hole is the way pokeguy goes (floor drop, then the staircase to the basement, before 1:19:56)." + ] + } + }, + "metadata": { + "phase": "testing", + "postconditions": { + "position": { + "map": "PokemonMansion_B1F", + "tiles": [ + [ + 34, + 29 + ] + ], + "facing": "west" + } + } + } +} diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-13.03.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-13.03.plan.json new file mode 100644 index 0000000000..bf9b0b8466 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-13.03.plan.json @@ -0,0 +1,351 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "frlg", + "checkpoint": { + "id": "13.03", + "title": "Pokemon Mansion B1F: the statue by Lewis's room, the Elixir, TM14, the statue by the Elixir room", + "start": { + "map": "PokemonMansion_B1F", + "tiles": [ + [ + 34, + 29 + ] + ], + "facing": "west" + }, + "events": [ + { + "id": "to_lewis_room", + "kind": "legs", + "action": "taps", + "args": { + "legs": [ + { + "direction": "west", + "tiles": 7 + }, + { + "direction": "north", + "tiles": 9 + }, + { + "direction": "west", + "tiles": 5 + } + ] + }, + "why": "B1F arrives in the set state (the flag is set), which closes its north: a tap a tile west to (27, 29), up column 27 to (27, 20) and west along row 20 to (22, 20), above the opening (20-22, 22-23), set open" + }, + { + "id": "into_room_1", + "kind": "step", + "args": { + "direction": "south" + }, + "declared_after": { + "map": "PokemonMansion_B1F", + "tiles": [ + [ + 22, + 21 + ] + ], + "facing": "south" + }, + "why": "a step to (22, 21)" + }, + { + "id": "into_room_2", + "kind": "step", + "args": { + "direction": "south" + }, + "declared_after": { + "map": "PokemonMansion_B1F", + "tiles": [ + [ + 22, + 22 + ] + ], + "facing": "south" + }, + "why": "a step onto (22, 22): the opening (20-22, 22-23) is open only in the set state, closed on the map" + }, + { + "id": "into_room_3", + "kind": "step", + "args": { + "direction": "south" + }, + "declared_after": { + "map": "PokemonMansion_B1F", + "tiles": [ + [ + 22, + 23 + ] + ], + "facing": "south" + }, + "why": "a step onto (22, 23), the opening's second row" + }, + { + "id": "to_statue", + "kind": "legs", + "action": "taps", + "args": { + "legs": [ + { + "direction": "south", + "tiles": 1 + }, + { + "direction": "east", + "tiles": 1 + }, + { + "direction": "south", + "tiles": 6 + }, + { + "direction": "east", + "tiles": 1 + } + ] + }, + "why": "a tap a tile down to (22, 24), east to (23, 24) and down column 23 to (23, 30), then east to (24, 30), below the statue (24, 29); Burglar Lewis wanders (19-21, 24-26) with sight 1, and a battle is taken as it comes (pokeguy passed without one)" + }, + { + "id": "face_statue", + "kind": "step", + "args": { + "direction": "north" + }, + "declared_after": { + "map": "PokemonMansion_B1F", + "tiles": [ + [ + 24, + 30 + ] + ], + "facing": "north" + }, + "why": "turn north to the statue (24, 29)" + }, + { + "id": "press_b1f_south", + "kind": "talk", + "why": "press A: \"Press the secret switch?\"" + }, + { + "id": "press_south", + "kind": "answer", + "why": "YES: the flag clears, B1F's north opens again ((12, 10-12) and (20-22, 22-23) close, (33-35, 20-21) and (16, 28-30) open: the map)" + }, + { + "id": "south_to_north", + "kind": "legs", + "action": "taps", + "args": { + "legs": [ + { + "direction": "west", + "tiles": 9 + }, + { + "direction": "north", + "tiles": 10 + }, + { + "direction": "east", + "tiles": 14 + }, + { + "direction": "south", + "tiles": 2 + }, + { + "direction": "east", + "tiles": 4 + }, + { + "direction": "north", + "tiles": 16 + }, + { + "direction": "north", + "tiles": 1 + }, + { + "direction": "east", + "tiles": 1 + } + ] + }, + "why": "a tap a tile in the clear state, which is the map's: west to (15, 30), up column 15 to (15, 20), east along row 20 to (29, 20), down to (29, 22), east to (33, 22), up column 33 to (33, 5) (Ivan (34, 13) looks south along column 34 with sight 6, so not x 34), and east to (34, 5), facing (35, 5)" + }, + { + "id": "hidden_elixir", + "kind": "talk", + "why": "the hidden ELIXIR on (35, 5) (pokeguy 1:20:06)" + }, + { + "id": "to_tm14", + "kind": "legs", + "action": "taps", + "args": { + "legs": [ + { + "direction": "south", + "tiles": 1 + }, + { + "direction": "west", + "tiles": 4 + }, + { + "direction": "south", + "tiles": 4 + }, + { + "direction": "west", + "tiles": 11 + }, + { + "direction": "north", + "tiles": 5 + }, + { + "direction": "east", + "tiles": 4 + } + ] + }, + "why": "a tap a tile back down: (34, 6), west to (30, 6), down to (30, 10), west along row 10 to (19, 10), up column 19 to (19, 5) and east to (23, 5), below TM14 (23, 4)" + }, + { + "id": "face_tm14", + "kind": "step", + "args": { + "direction": "north" + }, + "declared_after": { + "map": "PokemonMansion_B1F", + "tiles": [ + [ + 23, + 5 + ] + ], + "facing": "north" + }, + "why": "turn north to the ball" + }, + { + "id": "tm14", + "kind": "talk", + "why": "TM14 (pokeguy 1:20:15)" + }, + { + "id": "teach_blizzard", + "kind": "game_action", + "action": "teach", + "args": { + "item": "tm14", + "move": "blizzard", + "slot": 1, + "keep": ["tackle", "withdraw", "tail-whip", "water-gun", "bubble", "bite", "mega-kick", "water-pulse", "surf"] + }, + "why": "TM14 Blizzard over Dig (pokeguy, PokemonSimulation docs/progression/pokeguy-moves.md: Strength, Surf, Bite, Blizzard; the user approved the TM spend 2026-11-12), taught as soon as it is picked up; keep list: every move the lead can know but Dig, so the one other move (Dig) goes; fails if none or several are outside the list" + }, + { + "id": "to_north_statue", + "kind": "legs", + "action": "taps", + "args": { + "legs": [ + { + "direction": "west", + "tiles": 4 + }, + { + "direction": "south", + "tiles": 5 + }, + { + "direction": "east", + "tiles": 11 + }, + { + "direction": "north", + "tiles": 4 + }, + { + "direction": "west", + "tiles": 3 + } + ] + }, + "why": "a tap a tile back: west to (19, 5), down column 19 to (19, 10), east along row 10 to (30, 10), up to (30, 6) and west to (27, 6), below the statue (27, 5)" + }, + { + "id": "face_north_statue", + "kind": "step", + "args": { + "direction": "north" + }, + "declared_after": { + "map": "PokemonMansion_B1F", + "tiles": [ + [ + 27, + 6 + ] + ], + "facing": "north" + }, + "why": "turn north to the statue (27, 5)" + }, + { + "id": "press_b1f_north", + "kind": "talk", + "why": "press A: \"Press the secret switch?\" (pokeguy 1:20:09 presses the statue before the TM, the Elixir between)" + }, + { + "id": "press_north", + "kind": "answer", + "why": "YES: the flag is set; (12, 10-12) open, (33-35, 20-21) and (16, 28-30) close" + } + ] + }, + "execution": { + "menu": "full", + "notes": { + "checkpoint": [ + "Starts on B1F (34, 29) where 13.02 ends. Ends below the second statue (27, 5), at (27, 6), with the flag set: (12, 10-12) is the opening the walk to the SECRET KEY takes.", + "Barriers: Switch model (pokefirered data/scripts/pokemon_mansion.inc, PokemonMansion_*F scripts.inc; one global flag, set on a press and applied on each floor's load; the pack's maps are the flag-clear state only). Assumed per floor (read from pokefirered; the overlay data on PokemonSimulation's maps/frlg-mansion-switches branch, seen 2026-11-12, has the same tiles open or closed per state): 1F set: (22-24,10-11), (27-29,25-26), (32-34,25-26) open, (31-33,18-19) closed. 2F set: (24-26,14-15), (10,30-32) open, (12,4-8) closed, (10,28-29) wall. 3F set: (17-19,11-12) open, (21,4-8) closed. B1F set: (12,10-12), (20-22,22-23) open, (33-35,20-21) and (16,28-30) closed. Clear = the map as it is.", + "The two B1F statues are (24, 29) (press from (24, 30)) and (27, 5) (from (27, 6)). B1F is entered in the set state whichever way it was left, so the first press is a reset to clear: that opens the north, which the set state closes ((33-35, 20-21), (16, 28-30) are open in the clear state). The path to the Elixir and TM14 is the clear state, as the map is.", + "Open: Burglar Lewis (wandering (19-21, 24-26), sight 1: Growlithe, Ponyta Lv34) cannot be avoided in the room (its one way in, (22, 24), is beside his range; the sim meets him there and the AutoStory test lists to_statue as the one wanderer crossing it allows); the row relies on the normal battle code if he fights. Ivan (34, 13, looking south, sight 6) is passed on x 33. The Elixir is a hidden item: the walk faces it from (34, 5).", + "PokeGuy (1:19:56 to 1:20:21): basement statue, the Elixir 1:20:06, another statue 1:20:09, TM14 1:20:15." + ] + } + }, + "metadata": { + "phase": "testing", + "postconditions": { + "position": { + "map": "PokemonMansion_B1F", + "tiles": [ + [ + 27, + 6 + ] + ], + "facing": "north" + } + } + } +} diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-13.04.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-13.04.plan.json new file mode 100644 index 0000000000..b33ae0ce44 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-13.04.plan.json @@ -0,0 +1,168 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "frlg", + "checkpoint": { + "id": "13.04", + "title": "Pokemon Mansion B1F to the SECRET KEY, out by an Escape Rope", + "start": { + "map": "PokemonMansion_B1F", + "tiles": [ + [ + 27, + 6 + ] + ], + "facing": "north" + }, + "events": [ + { + "id": "to_opening", + "kind": "legs", + "action": "taps", + "args": { + "legs": [ + { + "direction": "east", + "tiles": 3 + }, + { + "direction": "south", + "tiles": 4 + }, + { + "direction": "west", + "tiles": 17 + } + ] + }, + "why": "a tap a tile in the set state: east to (30, 6), down to (30, 10) and west along row 10 to (13, 10), east of the opening (12, 10-12), set open (closed on the map)" + }, + { + "id": "into_opening", + "kind": "step", + "args": { + "direction": "west" + }, + "declared_after": { + "map": "PokemonMansion_B1F", + "tiles": [ + [ + 12, + 10 + ] + ], + "facing": "west" + }, + "why": "a step onto (12, 10): open only in the set state" + }, + { + "id": "through_opening", + "kind": "step", + "args": { + "direction": "west" + }, + "declared_after": { + "map": "PokemonMansion_B1F", + "tiles": [ + [ + 11, + 10 + ] + ], + "facing": "west" + }, + "why": "a step through onto (11, 10)" + }, + { + "id": "to_key", + "kind": "legs", + "action": "taps", + "args": { + "legs": [ + { + "direction": "west", + "tiles": 3 + }, + { + "direction": "north", + "tiles": 4 + }, + { + "direction": "west", + "tiles": 3 + } + ] + }, + "why": "a tap a tile: west to (8, 10), up column 8 to (8, 6) and west to (5, 6), above the SECRET KEY (5, 7)" + }, + { + "id": "face_key", + "kind": "step", + "args": { + "direction": "south" + }, + "declared_after": { + "map": "PokemonMansion_B1F", + "tiles": [ + [ + 5, + 6 + ] + ], + "facing": "south" + }, + "why": "turn south to the ball" + }, + { + "id": "secret_key", + "kind": "talk", + "why": "the SECRET KEY (pokeguy 1:20:21)" + }, + { + "id": "escape_rope", + "kind": "game_action", + "action": "use_item", + "args": { + "item": "escape-rope" + }, + "declared_after": { + "map": "CinnabarIsland", + "tiles": [ + [ + 8, + 4 + ] + ], + "facing": "south" + }, + "why": "out to the Mansion's door (pokeguy 1:20:24-36, his ESCAPE ROPE count 3 to 2); the player stands on (8, 4), where 14.01 starts" + } + ] + }, + "execution": { + "menu": "full", + "notes": { + "checkpoint": [ + "Starts below B1F's second statue, at (27, 6), where 13.03 ends, the flag set. Ends outside the Mansion door on Cinnabar (8, 4) facing south, where 14.01 starts.", + "Barriers: Switch model (pokefirered data/scripts/pokemon_mansion.inc, PokemonMansion_*F scripts.inc; one global flag, set on a press and applied on each floor's load; the pack's maps are the flag-clear state only). Assumed per floor (read from pokefirered; the overlay data on PokemonSimulation's maps/frlg-mansion-switches branch, seen 2026-11-12, has the same tiles open or closed per state): 1F set: (22-24,10-11), (27-29,25-26), (32-34,25-26) open, (31-33,18-19) closed. 2F set: (24-26,14-15), (10,30-32) open, (12,4-8) closed, (10,28-29) wall. 3F set: (17-19,11-12) open, (21,4-8) closed. B1F set: (12,10-12), (20-22,22-23) open, (33-35,20-21) and (16,28-30) closed. Clear = the map as it is.", + "The walk west along row 10 crosses (12, 10-12), which is closed on the pack's map and open in the set state: its two steps are declared because the pack's map has the barrier there.", + "Not taken: the FULL RESTORE (2F (2, 29)) and TM22 (1F (6, 21)); pokeguy leaves by Escape Rope after the key (1:20:24-36)." + ] + } + }, + "metadata": { + "phase": "testing", + "postconditions": { + "position": { + "map": "CinnabarIsland", + "tiles": [ + [ + 8, + 4 + ] + ], + "facing": "south" + } + } + } +} diff --git a/SerialPrograms/cmake/SourceFiles.cmake b/SerialPrograms/cmake/SourceFiles.cmake index 22be3d4d53..205f49fec9 100644 --- a/SerialPrograms/cmake/SourceFiles.cmake +++ b/SerialPrograms/cmake/SourceFiles.cmake @@ -2111,6 +2111,9 @@ file(GLOB LIBRARY_SOURCES Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffron_Tests.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySilph_Tests.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows16_Tests.h + Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMansion_Tests.cpp + Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows13_Tests.h + Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryChoice.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryChoice.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryChoice_Tests.cpp @@ -2199,6 +2202,7 @@ file(GLOB LIBRARY_SOURCES Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden12.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden15.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden16.h + Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden13.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryResources.cpp Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryResources.h Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryResources_Tests.cpp