diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHealing.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHealing.cpp index 6cf371563c..7ae4c5addd 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHealing.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryHealing.cpp @@ -21,6 +21,7 @@ namespace{ constexpr int POTION_HP = 20; constexpr int SUPER_POTION_HP = 50; +constexpr int HYPER_POTION_HP = 200; // The player's HP bar's width in pixels: its fill is read to one. constexpr int HP_BAR_PIXELS = 48; // The most items heal_to_full() uses: more than a full bar takes. @@ -38,6 +39,9 @@ int healing_hp(const std::string& item){ if (item == "super-potion"){ return SUPER_POTION_HP; } + if (item == "hyper-potion"){ + return HYPER_POTION_HP; + } return 0; } @@ -96,8 +100,12 @@ std::optional heal_to_full( if (!missing || *missing <= 0){ return missing; } + // A Hyper Potion (counted when the bag read shows some) for more + // than a Super Potion heals; else the smallest that covers it. std::string item; - if (*missing > POTION_HP && supplies.super_potions > 0){ + if (*missing > SUPER_POTION_HP && bag_count(supplies, "hyper-potion") > 0){ + item = "hyper-potion"; + }else if (*missing > POTION_HP && supplies.super_potions > 0){ item = "super-potion"; }else if (supplies.potions > 0){ item = "potion"; @@ -286,6 +294,36 @@ UnitTestResult test_elixir_after_lance(){ return true; } +// A Hyper Potion in the bag heals more than a Super Potion's 50 missing +// HP (user, 2026-11-15: the between-fight heal uses them if present); +// under that, the Super Potions as before, the Hyper Potion kept. +UnitTestResult test_hyper_potion(){ + Supplies supplies = bag(0, 2); + supplies.pocket.push_back("hyper-potion"); + supplies.other_counts = {{"hyper-potion", 1}}; + measured_hp(supplies, 0.30); + const std::optional after = heal_to_full(supplies, LEAD_MAX_HP, [&](const std::string& item){ + return use_from_bag(supplies, item); + }); + if (after != std::optional(-112) || supplies.other_counts.contains("hyper-potion") || supplies.super_potions != 2){ + return std::format( + "{} HP missing, {} Hyper Potions, {} Super Potions; expected -112 (one Hyper Potion for 88), none, 2.", + after.value_or(-1), supplies.other_counts.contains("hyper-potion") ? supplies.other_counts["hyper-potion"] : 0, supplies.super_potions + ); + } + Supplies small = bag(0, 2); + small.pocket.push_back("hyper-potion"); + small.other_counts = {{"hyper-potion", 1}}; + measured_hp(small, 0.80); + heal_to_full(small, LEAD_MAX_HP, [&](const std::string& item){ + return use_from_bag(small, item); + }); + if (small.other_counts["hyper-potion"] != 1 || small.super_potions != 1){ + return std::format("27 HP missing: {} Hyper Potions and {} Super Potions left, expected 1 and 1.", small.other_counts["hyper-potion"], small.super_potions); + } + return true; +} + // The Fuchsia Mart buys Super Potions so the bag covers a full bar. UnitTestResult test_cover_shortfall(){ struct Case{ @@ -317,6 +355,7 @@ void add_tests_AutoStoryHealing(UnitTestDatabase& database){ database.add(HealingCase{"the Mart buys the shortfall for a full bar", test_cover_shortfall}); database.add(HealingCase{"a Full Restore after Agatha, Potions without one", test_full_restore_after_agatha}); database.add(HealingCase{"an Elixir after Lance: 10 PP each, at most full", test_elixir_after_lance}); + database.add(HealingCase{"a Hyper Potion for more than a Super Potion heals", test_hyper_potion}); } diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItemUse_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItemUse_Tests.cpp index b9027c97e8..eceedcb97c 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItemUse_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItemUse_Tests.cpp @@ -646,9 +646,9 @@ class Test_SuperRepelStep : public UnitTest{ const SuperRepelCase SUPER_REPEL_CASES[] = { { - .name = "12.03's Super Repel before the Fly to Pallet", + .name = "12.03's Super Repel after the Fuchsia Mart, before the Fly to Pallet", .input = {.checkpoint = "12.03", .step = "super_repel_fuchsia"}, - .expectation = {.previous = "", .next = "outside_fuchsia_center", .in_bag = 5}, + .expectation = {.previous = "cut_mart_tree_back", .next = "fly_pallet", .in_bag = 5}, }, { .name = "13.01's Super Repel after 3F's statue", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMart.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMart.cpp index 39b2cd246c..d328fe288b 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMart.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMart.cpp @@ -175,7 +175,11 @@ Pokemon::StoryActionArgs mart_args(const MartPlan& plan){ for (const MartLine& line : plan.lines){ items.push_back({line.item, line.quantity}); } - return {{"map", plan.map}, {"items", std::move(items)}}; + Pokemon::StoryActionArgs args{{"map", plan.map}, {"items", std::move(items)}}; + if (plan.if_affordable){ + args["if_affordable"] = true; + } + return args; } std::optional mart_plan_of(const Pokemon::StoryActionArgs& args){ @@ -184,7 +188,8 @@ std::optional mart_plan_of(const Pokemon::StoryActionArgs& args){ if (map == nullptr || mart_stock(*map).empty() || items == nullptr || items->empty()){ return std::nullopt; } - MartPlan plan{.map = *map}; + const bool* if_affordable = game_arg(args, "if_affordable"); + MartPlan plan{.map = *map, .if_affordable = if_affordable != nullptr && *if_affordable}; for (const Pokemon::StoryItem& item : *items){ if (item.quantity < 1 || item.quantity > MAX_QUANTITY || !stock_row(mart_stock(plan.map), item.item)){ return std::nullopt; @@ -305,7 +310,13 @@ class MartRun{ if (!reach(buy)){ return false; } - switch (m_actions.buy(buy)){ + const PurchaseEnd end = m_actions.buy(buy); + const bool short_of_money = end == PurchaseEnd::NOT_ENOUGH_MONEY || end == PurchaseEnd::WRONG_QUANTITY; + if (m_plan.if_affordable && short_of_money){ + m_logger.log(std::format("Mart: the money doesn't cover {} {}; skipped (if_affordable).", buy.quantity, buy.item), COLOR_ORANGE); + return true; + } + switch (end){ case PurchaseEnd::BOUGHT: m_logger.log(std::format("Mart: bought {} {} for ${}.", buy.quantity, buy.item, buy.cost)); m_result.bought.push_back(buy); diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMart.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMart.h index fa60a471d8..0801ef4e0c 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMart.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMart.h @@ -27,7 +27,8 @@ * its quantity, in the order listed, blind. The only money check is the * "You don't have enough money." dialog, which fails the step; a * quantity typed past the box's most wraps, which the box's read catches - * where it can be read. A Mart step belongs early in its checkpoint, so + * where it can be read. A plan with if_affordable skips such a line + * instead, logged. A Mart step belongs early in its checkpoint, so * that a failure costs little. * * The decisions take their game steps from a MartActions, so they run in diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMartPlan.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMartPlan.h index f1be46628f..73d68560b4 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMartPlan.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMartPlan.h @@ -53,10 +53,15 @@ struct MartPlan{ std::string map = {}; // In priority order. std::vector lines = {}; + // A line the money doesn't cover (the Mart refuses it, or its + // quantity box can't reach the count) is skipped with a log line, + // and the step goes on, instead of failing. + bool if_affordable = false; }; // The GAME action of a Mart step: map WORD (required), the Mart's map; -// items ITEMS (required), the lines in order. +// items ITEMS (required), the lines in order; if_affordable BOOLEAN +// (absent: false), MartPlan::if_affordable. inline const std::string MART_ACTION = "mart"; // `plan` as its action's args. Pokemon::StoryActionArgs mart_args(const MartPlan& plan); diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMart_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMart_Tests.cpp index c8c8bc5dfa..9b173b5a42 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMart_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryMart_Tests.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -301,9 +302,47 @@ std::vector mart_cases_4(){ }; } +// 20.01a's Full Heals after the Full Restores, only if the money left +// covers them (user, 2026-11-15): a short purse skips the line, the step +// done, where without if_affordable it fails. +std::vector mart_cases_5(){ + const std::vector two_full_heals{{"full-heal", 2}}; + const std::vector restore_then_heal{{"full-restore", 1}, {"full-heal", 1}}; + const MartPlan full_heals{.map = "IndigoPlateau_PokemonCenter_1F", .lines = two_full_heals, .if_affordable = true}; + const MartPlan restore_first{.map = "IndigoPlateau_PokemonCenter_1F", .lines = restore_then_heal, .if_affordable = true}; + return { + { + .name = "if_affordable: both bought when the money covers them", + .plan = full_heals, + .money = 1500, + .bag = {{"full-heal", 2}}, + .money_after = 300, + }, + { + .name = "if_affordable: money for one, the quantity box wraps: skipped, done", + .plan = full_heals, + .money = 900, + .money_after = 900, + }, + { + .name = "if_affordable: money for none: skipped, done", + .plan = full_heals, + .money = 400, + .money_after = 400, + }, + { + .name = "if_affordable: a line skipped, the cheaper next one still bought", + .plan = restore_first, + .money = 700, + .bag = {{"full-heal", 1}}, + .money_after = 100, + }, + }; +} + std::vector mart_cases(){ std::vector cases; - for (std::vector part : {mart_cases_1(), mart_cases_2(), mart_cases_3(), mart_cases_4()}){ + for (std::vector part : {mart_cases_1(), mart_cases_2(), mart_cases_3(), mart_cases_4(), mart_cases_5()}){ cases.insert(cases.end(), part.begin(), part.end()); } return cases; @@ -367,6 +406,12 @@ UnitTestResult test_mart_args(){ ){ return "The Pewter plan didn't read back from its args."; } + MartPlan if_affordable = plan; + if_affordable.if_affordable = true; + const std::optional affordable_back = mart_plan_of(mart_args(if_affordable)); + if (!affordable_back || !affordable_back->if_affordable || back->if_affordable || args.contains("if_affordable")){ + return "if_affordable didn't read back from its args, or was written when false."; + } const std::vector> bad_args{ {"items", std::vector{}}, {"map", std::string("Nowhere_Mart")}, @@ -502,6 +547,108 @@ UnitTestResult test_mart_steps_early(){ return true; } +// One Mart step of the shopping the user approved on 2026-11-15, with +// the story row it must come before and the money it is run against. +struct ApprovedShopping{ + std::string_view checkpoint; + std::string_view step; + std::string_view before; + MartPlan plan; + size_t money; + std::map bag; + size_t money_after; +}; + +// A plan of one line: `quantity` of `item` at `map`'s Mart. +MartPlan one_line(std::string map, std::string item, size_t quantity){ + return {.map = std::move(map), .lines = {MartLine{std::move(item), quantity}}}; +} + +const std::vector& approved_shopping(){ + MartPlan status_heals = one_line("ViridianCity_Mart", "antidote", 1); + status_heals.lines.push_back({"parlyz-heal", 2}); + MartPlan full_heals = one_line("IndigoPlateau_PokemonCenter_1F", "full-heal", 2); + full_heals.if_affordable = true; + static const std::vector shopping{ + { + .checkpoint = "12.03", .step = "buy_super_potions_for_silph", .before = "16.01", + .plan = one_line("FuchsiaCity_Mart", "super-potion", 4), + .money = 2800, .bag = {{"super-potion", 4}}, .money_after = 0, + }, + { + .checkpoint = "18.03", .step = "buy_x_accuracies", .before = "19.01", + .plan = one_line("CeladonCity_DepartmentStore_5F", "x-accuracy", 2), + .money = 1900, .bag = {{"x-accuracy", 2}}, .money_after = 0, + }, + { + .checkpoint = "19.01a", .step = "buy_status_heals", .before = "19.01", + .plan = status_heals, + .money = 500, .bag = {{"antidote", 1}, {"parlyz-heal", 2}}, .money_after = 0, + }, + { + // After 13 Full Restores, money for one Full Heal: skipped. + .checkpoint = "20.01a", .step = "buy_full_heals", .before = "20.01", + .plan = full_heals, + .money = 1100, .bag = {}, .money_after = 1100, + }, + }; + return shopping; +} + +bool same_plan(const MartPlan& a, const MartPlan& b){ + if (a.map != b.map || a.if_affordable != b.if_affordable || a.lines.size() != b.lines.size()){ + return false; + } + for (size_t c = 0; c < a.lines.size(); c++){ + if (a.lines[c].item != b.lines[c].item || a.lines[c].quantity != b.lines[c].quantity){ + return false; + } + } + return true; +} + +// Each approved Mart step is in its row, before the row it shops for, +// with the approved lines; on a fake Mart with the money given it ends +// done with that bag. +UnitTestResult test_approved_shopping(){ + const std::vector& rows = story_checkpoints(); + for (const ApprovedShopping& shopping : approved_shopping()){ + std::optional row_index; + std::optional before_index; + const StoryStep* found = nullptr; + for (size_t c = 0; c < rows.size(); c++){ + if (rows[c].id == shopping.before){ + before_index = c; + } + if (rows[c].id != shopping.checkpoint){ + continue; + } + row_index = c; + for (const StoryStep& step : rows[c].steps){ + found = step.name == shopping.step ? &step : found; + } + } + if (found == nullptr || !row_index || !before_index || *row_index >= *before_index){ + return std::format("{}/{}: missing, or not before {}.", shopping.checkpoint, shopping.step, shopping.before); + } + const std::optional plan = mart_plan_of(found->args); + if (!plan || !same_plan(*plan, shopping.plan)){ + return std::format("{}/{}: not the approved lines.", shopping.checkpoint, shopping.step); + } + const UnitTestResult result = check_mart_case({ + .name = std::format("{}/{}", shopping.checkpoint, shopping.step), + .plan = *plan, + .money = shopping.money, + .bag = shopping.bag, + .money_after = shopping.money_after, + }); + if (result.result != UnitTestResult::PASSED){ + return result; + } + } + return true; +} + } // namespace @@ -534,6 +681,10 @@ const AutoStoryMartCase AUTO_STORY_MART_CASES[] = { .input = {"every Mart step is early in its checkpoint", test_mart_steps_early}, .expectation = {}, }, + { + .input = {"the shopping approved on 2026-11-15", test_approved_shopping}, + .expectation = {}, + }, }; void add_tests_AutoStoryMart(UnitTestDatabase& database){ diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden12.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden12.h index d44cf1013c..4f7451e9f4 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden12.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden12.h @@ -87,8 +87,26 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_12[] = { "12.02b walk north 5 (to wall) -> FuchsiaCity (11, 32)", "12.02b walk east 14 -> FuchsiaCity (25, 32)", "12.02b face north -> FuchsiaCity (25, 32)", - "12.03 outside_fuchsia_center from FuchsiaCity_PokemonCenter_1F (7, 4) facing north to FuchsiaCity (25, 32) facing south", + "12.03 outside_fuchsia_center from FuchsiaCity_PokemonCenter_1F (7, 4) facing north to FuchsiaCity (27, 32) facing east", "12.03 walk south 5 (warp) -> FuchsiaCity (25, 32) [walk only]", + "12.03 walk east 2 -> FuchsiaCity (27, 32)", + "12.03 below_mart_tree from FuchsiaCity (29, 32) facing east to FuchsiaCity (24, 23) facing north", + "12.03 walk north 9 -> FuchsiaCity (29, 23)", + "12.03 walk west 5 -> FuchsiaCity (24, 23)", + "12.03 face north -> FuchsiaCity (24, 23)", + "12.03 fuchsia_mart_wall from FuchsiaCity (24, 22) facing north to FuchsiaCity_Mart (4, 2) facing north", + "12.03 walk north 6 -> FuchsiaCity (24, 16)", + "12.03 walk west 13 -> FuchsiaCity (11, 16)", + "12.03 walk north 1 (warp) -> FuchsiaCity_Mart (4, 7)", + "12.03 walk north 5 (to wall) -> FuchsiaCity_Mart (4, 2) [walk only]", + "12.03 fuchsia_mart_clerk from FuchsiaCity_Mart (4, 2) facing north to FuchsiaCity_Mart (4, 3) facing west", + "12.03 walk south 1 -> FuchsiaCity_Mart (4, 3) [walk only]", + "12.03 face west -> FuchsiaCity_Mart (4, 3) [walk only]", + "12.03 above_mart_tree from FuchsiaCity_Mart (4, 3) facing west to FuchsiaCity (24, 21) facing south", + "12.03 walk south 5 (warp) -> FuchsiaCity (11, 16) [walk only]", + "12.03 walk south 1 (to wall) -> FuchsiaCity (11, 17)", + "12.03 walk east 13 (to wall) -> FuchsiaCity (24, 17)", + "12.03 walk south 4 -> FuchsiaCity (24, 21)", "12.03 pallet_shore from PalletTown (6, 8) facing south to PalletTown (10, 16) facing south", "12.03 walk south 2 (to wall) -> PalletTown (6, 10)", "12.03 walk east 4 -> PalletTown (10, 10)", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden16.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden16.h index bee769a8b2..9dc578c9f8 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden16.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden16.h @@ -78,32 +78,19 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_16[] = { "16.05b walk north 5 -> SilphCo_11F (5, 10)", "16.05b walk east 4 -> SilphCo_11F (9, 10)", "16.05b face north -> SilphCo_11F (9, 10)", - "16.06 below_center_door from SilphCo_11F (9, 10) facing north to SaffronCity (24, 39) facing north", - "16.06 walk west 4 (to wall) -> SilphCo_11F (5, 10)", - "16.06 walk south 9 (to wall) -> SilphCo_11F (5, 19)", - "16.06 walk west 3 -> SilphCo_11F (2, 19)", - "16.06 walk north 14 (warp) -> SilphCo_7F (5, 8)", - "16.06 walk north 1 (to wall) -> SilphCo_7F (5, 7)", - "16.06 walk west 4 -> SilphCo_7F (1, 7)", - "16.06 walk north 3 (to wall) -> SilphCo_7F (1, 4)", - "16.06 walk east 4 (warp) -> SilphCo_3F (13, 14)", - "16.06 walk east 6 (to wall) -> SilphCo_3F (19, 14)", - "16.06 walk north 2 -> SilphCo_3F (19, 12)", - "16.06 walk east 6 -> SilphCo_3F (25, 12)", - "16.06 walk north 8 (to wall) -> SilphCo_3F (25, 4)", - "16.06 walk east 3 -> SilphCo_3F (28, 4)", - "16.06 walk north 2 (to wall) -> SilphCo_3F (28, 2)", - "16.06 walk west 1 (warp) -> SilphCo_2F (28, 2)", - "16.06 walk east 3 (warp) -> SilphCo_1F (31, 2)", - "16.06 walk west 1 (to wall) -> SilphCo_1F (30, 2)", - "16.06 walk south 5 (to wall) -> SilphCo_1F (30, 7)", - "16.06 walk west 22 -> SilphCo_1F (8, 7)", - "16.06 walk south 14 (warp) -> SaffronCity (33, 31)", - "16.06 walk south 3 (to wall) -> SaffronCity (33, 34)", - "16.06 walk west 18 (to wall) -> SaffronCity (15, 34)", - "16.06 walk south 5 -> SaffronCity (15, 39)", - "16.06 walk east 9 -> SaffronCity (24, 39)", + "16.06 below_center_door from SaffronCity (24, 39) facing south to SaffronCity (24, 39) facing north", "16.06 face north -> SaffronCity (24, 39)", + "16.06b below_center_row_40 from SaffronCity_PokemonCenter_1F (7, 4) facing north to SaffronCity (24, 40) facing south", + "16.06b walk south 5 (warp) -> SaffronCity (24, 39) [walk only]", + "16.06b walk south 1 -> SaffronCity (24, 40)", + "16.06b east_wall_row_40 from SaffronCity (24, 40) facing south to SaffronCity (52, 40) facing east", + "16.06b walk east 28 (to wall) -> SaffronCity (52, 40)", + "16.06b below_row_14_wall from SaffronCity (52, 40) facing east to SaffronCity (52, 15) facing north", + "16.06b walk north 25 (to wall) -> SaffronCity (52, 15)", + "16.06b below_gym_door from SaffronCity (52, 15) facing north to SaffronCity (46, 15) facing west", + "16.06b walk west 6 -> SaffronCity (46, 15)", + "16.06b into_gym from SaffronCity (46, 15) facing west to SaffronCity_Gym (14, 23) facing north", + "16.06b walk north 3 (warp) -> SaffronCity_Gym (14, 23)", }; } // namespace PokemonFRLG diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden18.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden18.h index 1778a21440..c11e1d6a5c 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden18.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden18.h @@ -2,7 +2,8 @@ * * From: https://github.com/PokemonAutomation/ * - * The golden's lines for 18.01 to 18.02b, Saffron Gym (after + * The golden's lines for 18.01 to 18.03, Saffron Gym and the X items + * trip to Celadon (after * PokemonFRLG_AutoStoryPlanGolden16.h's, before PokemonFRLG_AutoStoryPlanGolden17.h's * 17.01), in the story's order. * @@ -17,7 +18,8 @@ namespace PokemonAutomation{ namespace NintendoSwitch{ namespace PokemonFRLG{ -// The stored plan lines of 18.01 to 18.02b, Saffron Gym. +// The stored plan lines of 18.01 to 18.03, Saffron Gym and the X items +// trip to Celadon. inline constexpr std::string_view FRLG_PLAN_GOLDEN_18[] = { "18.01 by_pad_to_bottom_right from SaffronCity_Gym (14, 23) facing north to SaffronCity_Gym (17, 20) facing east", "18.01 walk east 3 -> SaffronCity_Gym (17, 23) [walk only]", @@ -51,15 +53,37 @@ inline constexpr std::string_view FRLG_PLAN_GOLDEN_18[] = { "18.02b walk south 2 -> SaffronCity_Gym (20, 22) [walk only]", "18.02b walk east 8 (to wall) -> SaffronCity_Gym (28, 22) [walk only]", "18.02b face south -> SaffronCity_Gym (28, 22) [walk only]", - "18.02b below_center_door from SaffronCity_Gym (18, 20) facing south to SaffronCity (24, 39) facing north", + "18.02b out_of_gym from SaffronCity_Gym (18, 20) facing south to SaffronCity (46, 13) facing south", "18.02b walk south 3 (to wall) -> SaffronCity_Gym (18, 23) [walk only]", "18.02b walk west 4 -> SaffronCity_Gym (14, 23) [walk only] [tapped]", "18.02b walk south 1 (warp) -> SaffronCity (46, 13) [walk only]", - "18.02b walk south 4 (to wall) -> SaffronCity (46, 17)", - "18.02b walk east 4 -> SaffronCity (50, 17)", - "18.02b walk south 24 (to wall) -> SaffronCity (50, 41)", - "18.02b walk west 26 -> SaffronCity (24, 41)", - "18.02b walk north 2 -> SaffronCity (24, 39)", + "18.02b below_center_door from SaffronCity (24, 39) facing south to SaffronCity (24, 39) facing north", + "18.02b face north -> SaffronCity (24, 39)", + "18.03 saffron_outside from SaffronCity_PokemonCenter_1F (7, 4) facing north to SaffronCity (24, 39) facing south", + "18.03 walk south 5 (warp) -> SaffronCity (24, 39) [walk only]", + "18.03 below_store_lift from CeladonCity (48, 12) facing south to CeladonCity_DepartmentStore_1F (6, 2) facing north", + "18.03 walk west 25 -> CeladonCity (23, 12)", + "18.03 walk south 4 (to wall) -> CeladonCity (23, 16)", + "18.03 walk west 8 -> CeladonCity (15, 16)", + "18.03 walk north 2 (warp) -> CeladonCity_DepartmentStore_1F (10, 14)", + "18.03 walk north 9 (to wall) -> CeladonCity_DepartmentStore_1F (10, 5) [walk only]", + "18.03 walk west 4 -> CeladonCity_DepartmentStore_1F (6, 5) [walk only]", + "18.03 walk north 3 -> CeladonCity_DepartmentStore_1F (6, 2) [walk only]", + "18.03 x_items_clerk from CeladonCity_DepartmentStore_5F (6, 2) facing south to CeladonCity_DepartmentStore_5F (3, 7) facing west", + "18.03 walk south 4 -> CeladonCity_DepartmentStore_5F (6, 6) [walk only]", + "18.03 walk west 3 (to wall) -> CeladonCity_DepartmentStore_5F (3, 6) [walk only]", + "18.03 walk south 1 -> CeladonCity_DepartmentStore_5F (3, 7) [walk only]", + "18.03 face west -> CeladonCity_DepartmentStore_5F (3, 7) [walk only]", + "18.03 below_5f_lift from CeladonCity_DepartmentStore_5F (3, 7) facing west to CeladonCity_DepartmentStore_5F (6, 2) facing north", + "18.03 walk north 5 (to wall) -> CeladonCity_DepartmentStore_5F (3, 2) [walk only]", + "18.03 walk east 3 -> CeladonCity_DepartmentStore_5F (6, 2) [walk only]", + "18.03 face north -> CeladonCity_DepartmentStore_5F (6, 2) [walk only]", + "18.03 out_of_store from CeladonCity_DepartmentStore_1F (6, 2) facing south to CeladonCity (11, 15) facing south", + "18.03 walk south 5 (to wall) -> CeladonCity_DepartmentStore_1F (6, 7) [walk only]", + "18.03 walk west 4 -> CeladonCity_DepartmentStore_1F (2, 7) [walk only]", + "18.03 walk south 8 (warp) -> CeladonCity (11, 15) [walk only]", + "18.03 below_center_door from SaffronCity (24, 39) facing south to SaffronCity (24, 39) facing north", + "18.03 face north -> SaffronCity (24, 39)", }; } // namespace PokemonFRLG diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows18_Tests.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows18_Tests.h index ce365a190f..e06bb21195 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows18_Tests.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryRows18_Tests.h @@ -18,7 +18,8 @@ namespace NintendoSwitch{ namespace PokemonFRLG{ -// Rows 18.01 to 18.02b, Saffron Gym's pads, on the overworld sim +// Rows 18.01 to 18.03, Saffron Gym's pads and the Fly to Celadon's X +// items clerk, on the overworld sim // (PokemonFRLG_AutoStorySaffronGym_Tests.cpp). void add_tests_AutoStorySaffronGym(UnitTestDatabase& database); 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 7ba98ec582..e0f4e8a237 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 13.01 13.02 13.03 13.04 14.01 14.02 14.02b 14.03 14.04 14.04b 15.01 16.01 16.02 16.03 16.03b 16.05 16.05b 16.06 18.01 18.02 18.02b 17.02 17.03 17.04 17.04b 19.01a 19.01 19.02 19.03 19.04 19.04b 19.04c 19.04d 19.05 20.01a 20.01 20.02 20.03 20.04 20.05"; +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.01 14.02 14.02b 14.03 14.04 14.04b 15.01 16.01 16.02 16.03 16.03b 16.05 16.05b 16.06 16.06b 18.01 18.02 18.02b 18.03 17.02 17.03 17.04 17.04b 19.01a 19.01 19.02 19.03 19.04 19.04b 19.04c 19.04d 19.05 20.01a 20.01 20.02 20.03 20.04 20.05"; 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 13.01 13.02 13.03 13.04 14.01 14.02 14.02b 14.03 14.04 14.04b 15.01 16.01 16.02 16.03 16.03b 16.05 16.05b 16.06 18.01 18.02 18.02b 17.02 17.03 17.04 17.04b 19.01a 19.01 19.02 19.03 19.04 19.04b 19.04c 19.04d 19.05 20.01a 20.01 20.02 20.03 20.04 20.05"}, + .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.01 14.02 14.02b 14.03 14.04 14.04b 15.01 16.01 16.02 16.03 16.03b 16.05 16.05b 16.06 16.06b 18.01 18.02 18.02b 18.03 17.02 17.03 17.04 17.04b 19.01a 19.01 19.02 19.03 19.04 19.04b 19.04c 19.04d 19.05 20.01a 20.01 20.02 20.03 20.04 20.05"}, }, { .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 13.01 13.02 13.03 13.04 14.01 14.02 14.02b 14.03 14.04 14.04b 15.01 16.01 16.02 16.03 16.03b 16.05 16.05b 16.06 18.01 18.02 18.02b 17.02 17.03 17.04 17.04b 19.01a 19.01 19.02 19.03 19.04 19.04b 19.04c 19.04d 19.05 20.01a 20.01 20.02 20.03 20.04 20.05"}, + .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.01 14.02 14.02b 14.03 14.04 14.04b 15.01 16.01 16.02 16.03 16.03b 16.05 16.05b 16.06 16.06b 18.01 18.02 18.02b 18.03 17.02 17.03 17.04 17.04b 19.01a 19.01 19.02 19.03 19.04 19.04b 19.04c 19.04d 19.05 20.01a 20.01 20.02 20.03 20.04 20.05"}, }, { .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 13.01 13.02 13.03 13.04 14.01 14.02 14.02b 14.03 14.04 14.04b 15.01 16.01 16.02 16.03 16.03b 16.05 16.05b 16.06 18.01 18.02 18.02b 17.02 17.03 17.04 17.04b 19.01a 19.01 19.02 19.03 19.04 19.04b 19.04c 19.04d 19.05 20.01a 20.01 20.02 20.03 20.04 20.05"}, + .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.01 14.02 14.02b 14.03 14.04 14.04b 15.01 16.01 16.02 16.03 16.03b 16.05 16.05b 16.06 16.06b 18.01 18.02 18.02b 18.03 17.02 17.03 17.04 17.04b 19.01a 19.01 19.02 19.03 19.04 19.04b 19.04c 19.04d 19.05 20.01a 20.01 20.02 20.03 20.04 20.05"}, }, { .input = { .name = "Starter RNG first, with both on", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffronGym_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffronGym_Tests.cpp index 096e772745..766840dcc4 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffronGym_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffronGym_Tests.cpp @@ -5,13 +5,19 @@ * Rows 18.01, 18.02 and 18.02b (StoryData/frlg-18.02*.plan.json ...) on the * overworld sim: Saffron Gym's teleport pads, from the door to the tile below * Sabrina and back out to Saffron's Center, with no trainer met on the way; - * Sabrina's battle is a checkpoint of its own. + * Sabrina's battle is a checkpoint of its own. Then 18.03, the Fly to + * Celadon's X items clerk and back to Saffron's Center. Last, that the + * walks through Saffron and in and out of its buildings (16.06, 16.06b, + * 18.02b) stay near the straight line and never cross a tile twice. * */ +#include +#include #include #include #include +#include #include #include #include @@ -19,9 +25,12 @@ #include "Common/Cpp/TestRunners/UnitTest.h" #include "Pokemon/AutoStory/Pokemon_BuiltinStoryActions.h" #include "Pokemon/AutoStory/Pokemon_StoryStepExecutor.h" +#include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_HideoutLiftRoom.h" #include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.h" #include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.h" #include "PokemonFRLG_AutoStoryEvents.h" +#include "PokemonFRLG_AutoStoryMartPlan.h" +#include "PokemonFRLG_AutoStoryPacedRoute.h" #include "PokemonFRLG_AutoStoryRooms.h" #include "PokemonFRLG_AutoStoryRowSim.h" #include "PokemonFRLG_AutoStoryRows18_Tests.h" @@ -77,8 +86,9 @@ const StoryCheckpoint& checkpoint(std::string_view id){ // Where each of `row`'s pad steps (the STEP steps, which are only ever // onto a pad here) leaves the player, in order, after running the row's -// steps on the sim up to (not including) its Center step. Fails with the -// row's message if a step does not run. +// steps (a Fly among them) on the sim up to (not including) its Center +// step, on the maps of its start flags. Fails with the row's message if a +// step does not run. struct PadWalk{ std::string failure; std::vector landings; @@ -89,15 +99,16 @@ struct PadWalk{ PadWalk walk_pads(const StoryCheckpoint& row){ PadWalk walk; StoryPose at = *story_pose(Pokemon::pose_of(*row.start)); - OverworldSim sim(story_maps(), MapPosition{at.map, at.tile}, *at.facing); + const std::set flags(row.start_flags.begin(), row.start_flags.end()); + OverworldSim sim(run_story_maps(flags), MapPosition{at.map, at.tile}, *at.facing); for (const StoryStep& step : row.steps){ if (step.action == CENTER_ENTER_VARIANT){ break; } - if (step.kind == StoryStepKind::GAME || step.kind == StoryStepKind::TALK || step.kind == StoryStepKind::BATTLE){ + if (step.kind == StoryStepKind::TALK || step.kind == StoryStepKind::BATTLE){ continue; } - walk.failure = row_step_on_sim(sim, at, step, row.id); + walk.failure = row_step_on_sim(sim, at, step, row.id, flags); if (!walk.failure.empty()){ break; } @@ -150,7 +161,7 @@ UnitTestResult test_sabrina_own_checkpoint(){ } // The way out (18.02b): the same pads the other way, each pair linked both -// ways, then the door onto Saffron City and the street to below the Center's door. +// ways, then the door onto Saffron City and the Fly to below the Center's door. UnitTestResult test_pads_out_to_center(){ const PadWalk walk = walk_pads(checkpoint("18.02b")); if (!walk.failure.empty()){ @@ -191,6 +202,195 @@ UnitTestResult test_cameron_sees_row_21(){ return true; } +// 18.03 (user, 2026-11-15: 2 X Accuracies before the Route 22 rival) from +// Saffron's nurse: out, the Fly to Celadon, 1F's lift to 5F, its X items +// clerk, where the Mart step buys, the lift back, out of the store, the Fly +// to Saffron and below the Center's door, where center_enter takes the +// player to 17.02's start. Nobody met. +UnitTestResult test_celadon_x_accuracies(){ + const StoryCheckpoint& row = checkpoint("18.03"); + StoryPose at = *story_pose(Pokemon::pose_of(*row.start)); + // The Department Store's lift, as 10.01's: its room and its floors. + SimScript script; + script.lift_floors[std::string(DEPT_STORE_LIFT_MAP)] = department_store_lift_exits(); + OverworldSim sim(story_maps(), MapPosition{at.map, at.tile}, *at.facing, script); + const MapPosition clerk{"CeladonCity_DepartmentStore_5F", {3, 7}}; + bool bought_at_clerk = false; + for (const StoryStep& step : row.steps){ + if (step.action == CENTER_ENTER_VARIANT){ + break; + } + if (step.action == MART_ACTION){ + bought_at_clerk = sim.state().position == clerk && at.facing == Direction::WEST; + continue; + } + if (const std::string failure = row_step_on_sim(sim, at, step, row.id); !failure.empty()){ + return std::format("18.03: ended on {}; {}", to_string(sim.state().position), failure); + } + } + if (!bought_at_clerk){ + return std::format("18.03: the Mart step was not at the X items clerk {} facing west.", to_string(clerk)); + } + const MapPosition below_center{"SaffronCity", {24, 39}}; + if (!(sim.state().position == below_center) || at.facing != Direction::NORTH){ + return std::format("18.03: ended on {}, not below Saffron's Center door {} facing north.", to_string(sim.state().position), to_string(below_center)); + } + if (!sim.state().trainers_beaten.empty() || !sim.state().violations.empty()){ + return "18.03: met a trainer or broke a rule on the way."; + } + return true; +} + +// One stretch of a row's walking on one map, between warps and the steps +// that move the player without walking (a pad, Fly, an Escape Rope, the +// Center's script): where it starts and the tiles it walks, in order. +struct Stretch{ + MapPosition from; + std::vector tiles; +}; + +struct RowStretches{ + std::string failure; + std::vector stretches; +}; + +// `route` walked from `at`, its tiles added to `out`'s stretches; `at` +// moves to where it ends. +void add_route_tiles(const std::vector& maps, const std::vector& route, StoryPose& at, RowStretches& out){ + MapPosition position{at.map, at.tile}; + for (const RouteStep& leg : route){ + if (leg.action == RouteAction::WALK){ + const std::vector tiles = leg_tiles(maps, position, leg); + std::vector& walked = out.stretches.back().tiles; + walked.insert(walked.end(), tiles.empty() ? tiles.end() : tiles.begin() + 1, tiles.end()); + } + if (leg.action == RouteAction::WALK && leg.warps){ + out.stretches.push_back({leg.end, {}}); + } + position = leg.end; + at.facing = leg.facing_after; + } + at.map = position.map; + at.tile = position.point; +} + +// The maps, doors and rules a row's routes are planned on. +struct RowPlanning{ + const std::vector& maps; + Pokemon::GateState gates; + Pokemon::GateRules rules; +}; + +// `step` from `at`: a route's tiles added to `out`, or a pose the step +// declares elsewhere starting a stretch; `at` moves to where it ends. +// The failure, or empty. +std::string add_step_tiles(const RowPlanning& planning, const StoryStep& step, StoryPose& at, RowStretches& out){ + if (step.kind == StoryStepKind::ROUTE || step.kind == StoryStepKind::LEGS){ + const std::optional> route = walked_route(at, step, planning.maps, planning.gates, planning.rules); + if (!route){ + return std::format("{}: no route from {}.", step.name, to_string(MapPosition{at.map, at.tile})); + } + add_route_tiles(planning.maps, *route, at, out); + return ""; + } + if (!step.pose_after){ + return ""; + } + const StoryPose to = *story_pose(Pokemon::pose_of(*step.pose_after)); + if (to.map != at.map || !(to.tile == at.tile)){ + out.stretches.push_back({MapPosition{to.map, to.tile}, {}}); + } + at = to; + return ""; +} + +// The tiles `row`'s routes walk, planned as the program plans them from +// the row's save (on the maps of its start flags), each from where the +// step before leaves the player. +RowStretches row_stretches(const StoryCheckpoint& row){ + const std::set flags(row.start_flags.begin(), row.start_flags.end()); + const RowPlanning planning{ + .maps = run_story_maps(flags), + .gates = row.start_gates.value_or(Pokemon::GateState()), + .rules = Pokemon::GateRules{.card_key_held = flags.contains("card_key_held")}, + }; + StoryPose at = *story_pose(Pokemon::pose_of(*row.start)); + RowStretches out; + out.stretches.push_back({MapPosition{at.map, at.tile}, {}}); + for (const StoryStep& step : row.steps){ + if (const std::string failure = add_step_tiles(planning, step, at, out); !failure.empty()){ + out.failure = std::format("{}/{}", row.id, failure); + return out; + } + } + return out; +} + +// Tiles a map makes every walk across it take beyond the straight line. +struct ForcedDetour{ + std::string_view map; + int tiles = 0; +}; + +// A row whose walks should be direct, and the detours its maps force. +struct DirectRow{ + std::string_view id; + std::vector detours; +}; + +// 16.06 walks nothing: Escape Rope out of Silph Co., Fly to the Center. +const DirectRow DIRECT_16_06{"16.06", {}}; +// Saffron City from the Center's door (24, 39) to the Gym's (46, 12): the +// only way north past row 19 is columns 50..52, 4 columns east of the +// door and back (8 tiles), and row 39 is the Lass's walk (27..37, 39), a +// row down and back (2 tiles). The fewest tiles there are 58. +const DirectRow DIRECT_16_06B{"16.06b", {{"SaffronCity", 10}}}; +// 18.02b's pads, then only the entrance room to the Gym's door and the Fly. +const DirectRow DIRECT_18_02B{"18.02b", {}}; + +int straight_line(const TilePos& from, const TilePos& to){ + return std::abs(from.x - to.x) + std::abs(from.y - to.y); +} + +// Console B, 2026-11-15: 16.06 walked about 2 minutes down Silph Co. with +// 16 tiles walked again after re-plans; 18.02b walked about 80 tiles to +// the Center for a straight line of 48, and 16.06b about 79. Each stretch +// of `expected`'s walking, as planned, takes at most 1.2 times the +// straight line from its start to its end (plus what the map forces), and +// no tile is walked onto twice. +UnitTestResult test_direct_walks(const DirectRow& expected){ + const RowStretches walk = row_stretches(checkpoint(expected.id)); + if (!walk.failure.empty()){ + return walk.failure; + } + std::vector crossed; + for (const Stretch& stretch : walk.stretches){ + crossed.push_back(stretch.from); + for (const MapPosition& tile : stretch.tiles){ + if (std::find(crossed.begin(), crossed.end(), tile) != crossed.end()){ + return std::format("{}: walks onto {} twice.", expected.id, to_string(tile)); + } + crossed.push_back(tile); + } + if (stretch.tiles.empty()){ + continue; + } + int forced = 0; + for (const ForcedDetour& detour : expected.detours){ + forced += detour.map == stretch.from.map ? detour.tiles : 0; + } + const int line = straight_line(stretch.from.point, stretch.tiles.back().point) + forced; + const int tiles = (int)stretch.tiles.size(); + if (tiles * 5 > line * 6){ + return std::format( + "{}: walks {} tiles from {} to {}, more than 1.2 times {} (the straight line, plus {} the map forces).", + expected.id, tiles, to_string(stretch.from), to_string(stretch.tiles.back()), line, forced + ); + } + } + return true; +} + const AutoStorySaffronGymCase AUTO_STORY_SAFFRON_GYM_CASES[] = { { .name = "18.01 Saffron Gym's pads from the door to below Sabrina", @@ -205,13 +405,33 @@ const AutoStorySaffronGymCase AUTO_STORY_SAFFRON_GYM_CASES[] = { { .name = "18.02b Saffron Gym's pads back out to the Center's door", .input = {.body = test_pads_out_to_center}, - .expectation = {.description = "four pads the other way, below Saffron's Center door, nobody met"}, + .expectation = {.description = "four pads the other way, out of the door, the Fly to below Saffron's Center door, nobody met"}, }, { .name = "Saffron Gym: Cameron sees a walk along row 21", .input = {.body = test_cameron_sees_row_21}, .expectation = {.description = "the sim meets a trainer on row 21, so the rows' row 22 is a real detour"}, }, + { + .name = "18.03 Fly to Celadon's X items clerk and back to Saffron's Center", + .input = {.body = test_celadon_x_accuracies}, + .expectation = {.description = "the Mart step at 5F's clerk facing west, then below Saffron's Center door facing north, nobody met"}, + }, + { + .name = "16.06 walks direct: Escape Rope and Fly", + .input = {.body = []{ return test_direct_walks(DIRECT_16_06); }}, + .expectation = {.description = "no walk longer than 1.2 times its straight line, no tile twice"}, + }, + { + .name = "16.06b walks direct: Saffron's Center to the Gym's door", + .input = {.body = []{ return test_direct_walks(DIRECT_16_06B); }}, + .expectation = {.description = "62 tiles on Saffron City, within 1.2 times 58 (48 straight, 10 forced), no tile twice"}, + }, + { + .name = "18.02b walks direct: the pads, the Gym's door, Fly", + .input = {.body = []{ return test_direct_walks(DIRECT_18_02B); }}, + .expectation = {.description = "each room's walk its straight line, no tile twice"}, + }, }; } // namespace diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySilph_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySilph_Tests.cpp index e9dee88ae2..fe0aa54bf2 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySilph_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySilph_Tests.cpp @@ -27,6 +27,7 @@ #include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.h" #include "PokemonFRLG_AutoStoryBattlePolicyData.h" #include "PokemonFRLG_AutoStoryEvents.h" +#include "PokemonFRLG_AutoStoryItemUse.h" #include "PokemonFRLG_AutoStoryMovedTrainers.h" #include "PokemonFRLG_AutoStoryPacedRoute.h" #include "PokemonFRLG_AutoStoryParty.h" @@ -114,15 +115,18 @@ UnitTestResult test_pad_to_5f(){ } // The steps of row `id` walked on the sim over `maps`, from the row's start with -// the Card Key and doors its start_flags and start_gates say. +// the Card Key and doors its start_flags and start_gates say. `maps` must +// outlive the walk. class RowWalk{ public: RowWalk(std::string_view id, const std::vector& maps) : m_row(checkpoint(id)) + , m_maps(maps) , m_at(*story_pose(Pokemon::pose_of(*m_row.start))) - , m_sim(maps, MapPosition{m_at.map, m_at.tile}, *m_at.facing, script_of(m_row)) , m_flags(m_row.start_flags.begin(), m_row.start_flags.end()) - {} + { + m_sim.emplace(m_maps, MapPosition{m_at.map, m_at.tile}, *m_at.facing, script_of(m_row)); + } // Each step in turn; the failure of the first that fails, or empty. std::string run(){ @@ -130,23 +134,29 @@ class RowWalk{ // The sim has no trigger scenes: a scripted battle (the rival's, Giovanni's) // is taken as won where it leaves the player. A trainer's battle, his // message up after the step into his line, is fought. - if (step.kind == StoryStepKind::BATTLE && m_sim.state().screen != SimScreen::MESSAGE){ + if (step.kind == StoryStepKind::BATTLE && m_sim->state().screen != SimScreen::MESSAGE){ m_at = *story_pose(Pokemon::pose_of(*step.pose_after)); - m_floors.push_back(m_sim.state().position.map); + m_floors.push_back(m_sim->state().position.map); + continue; + } + // The Escape Rope's script has no map: the player stands where + // the step says, the doors and the Card Key as they were. + if (parse_use_item_step(step) == "escape-rope"){ + escape_to(*story_pose(Pokemon::pose_of(*step.pose_after))); continue; } // The run's flags as the program's state has them at the step: the // row's start flags and what the steps before set (flags_after). - if (const std::string failure = row_step_on_sim(m_sim, m_at, step, m_row.id, m_flags); !failure.empty()){ + if (const std::string failure = row_step_on_sim(*m_sim, m_at, step, m_row.id, m_flags); !failure.empty()){ return failure; } m_flags.insert(step.flags_after.begin(), step.flags_after.end()); - m_floors.push_back(m_sim.state().position.map); + m_floors.push_back(m_sim->state().position.map); } return ""; } const StoryCheckpoint& row() const{ return m_row; } - const OverworldSim& sim() const{ return m_sim; } + const OverworldSim& sim() const{ return *m_sim; } const std::vector& floors() const{ return m_floors; } // What the row left out as a line, or empty: the sim's rule breaks and the @@ -154,12 +164,12 @@ class RowWalk{ // steps declare (gates_after). std::string problems() const{ std::string text; - if (!m_sim.state().violations.empty()){ - text += std::format(" broke a rule: {};", m_sim.state().violations.front()); + if (!m_sim->state().violations.empty()){ + text += std::format(" broke a rule: {};", m_sim->state().violations.front()); } const Pokemon::GateState declared = Pokemon::checkpoint_gates(m_row, m_row.steps.size()); - if (!(declared == m_sim.state().gates)){ - text += std::format(" the sim has {} gates open, the row's gates_after {};", m_sim.state().gates.opened.size(), declared.opened.size()); + if (!(declared == m_sim->state().gates)){ + text += std::format(" the sim has {} gates open, the row's gates_after {};", m_sim->state().gates.opened.size(), declared.opened.size()); } return text; } @@ -172,9 +182,21 @@ class RowWalk{ return script; } + // Starts the sim again on `to`, carrying the gates and the Card Key + // over: the Escape Rope's warp. + void escape_to(const StoryPose& to){ + SimScript script = script_of(m_row); + script.card_key_held = m_sim->card_key_held(); + script.gates = m_sim->state().gates; + m_at = to; + m_sim.emplace(m_maps, MapPosition{to.map, to.tile}, *to.facing, script); + m_floors.push_back(to.map); + } + const StoryCheckpoint& m_row; + const std::vector& m_maps; StoryPose m_at; - OverworldSim m_sim; + std::optional m_sim; std::set m_flags; std::vector m_floors; }; @@ -445,20 +467,76 @@ UnitTestResult test_president_walk_after_giovanni(){ return true; } -// 16.06: the walk back down to Saffron's Center on the maps with no Rocket in -// Silph Co. or Saffron City. +// 16.06: out of Silph Co. by Escape Rope, to below its door on Saffron City, +// where the Fly to the Center's door is taken outdoors, on the maps with no +// Rocket in Silph Co. or Saffron City. UnitTestResult test_return_row(){ const std::set flags{std::string(SILPH_CLEARED_FLAG)}; const RowResult result = walk_row("16.06", with_beaten(run_story_maps(flags), "SilphCo_5F", 9, 21)); if (const std::string wrong = wrong_end("16.06", result, MapPosition{"SaffronCity", {24, 39}}); !wrong.empty()){ return wrong; } + if (result.floors.empty() || result.floors.front() != "SaffronCity"){ + return "16.06: its first step does not leave Silph Co. for Saffron City, where Fly can be used."; + } if (!result.trainers.empty()){ return "16.06: walked into a trainer's line."; } return true; } +// Where the last of `row`'s steps that says where it ends leaves the +// player: its declared pose, or a route's target. +std::optional declared_end(const StoryCheckpoint& row){ + for (auto step = row.steps.rbegin(); step != row.steps.rend(); ++step){ + if (step->pose_after){ + return story_pose(Pokemon::pose_of(*step->pose_after)); + } + if (step->kind == StoryStepKind::ROUTE){ + return story_pose(Pokemon::pose_of(Pokemon::story_arg(step->args, "target"))); + } + } + return std::nullopt; +} + +bool same_pose(const StoryPose& a, const StoryPose& b){ + return a.map == b.map && a.tile == b.tile && a.facing == b.facing; +} + +// 16.06 ends at Saffron's nurse and 18.01 starts on the Gym's door mat +// (14, 23) facing north. 16.06b, between them in the story's order, starts +// where 16.06 ends and, walked on the sim with the Rockets gone, ends where +// 18.01 starts (console B, 2026-11-15: 18.01 run from the nurse "moved +// nothing twice in a row" against the Center's counter). +UnitTestResult test_center_to_gym_door_chain(){ + const std::vector& rows = story_checkpoints(); + const auto position = [&](std::string_view id){ + return std::find_if(rows.begin(), rows.end(), [&](const StoryCheckpoint& row){ return row.id == id; }) - rows.begin(); + }; + if (position("16.06b") != position("16.06") + 1 || position("18.01") != position("16.06b") + 1){ + return "16.06b is not between 16.06 and 18.01 in the story's order."; + } + const std::optional healed = declared_end(checkpoint("16.06")); + const StoryPose start = *story_pose(Pokemon::pose_of(*checkpoint("16.06b").start)); + if (!healed || !same_pose(*healed, start)){ + return "16.06b does not start where 16.06 ends."; + } + const std::set flags{std::string(SILPH_CLEARED_FLAG)}; + const RowResult result = walk_row("16.06b", run_story_maps(flags)); + const StoryPose gym = *story_pose(Pokemon::pose_of(*checkpoint("18.01").start)); + if (const std::string wrong = wrong_end("16.06b", result, MapPosition{gym.map, gym.tile}); !wrong.empty()){ + return wrong; + } + const std::optional end = declared_end(checkpoint("16.06b")); + if (!end || !same_pose(*end, gym)){ + return "16.06b does not declare the pose 18.01 starts from."; + } + if (!result.trainers.empty()){ + return "16.06b: walked into a trainer's line."; + } + return true; +} + bool has_object_at(const std::vector& maps, std::string_view map_name, int x, int y){ for (const MapData& map : maps){ for (const MapObject& object : map.objects){ @@ -703,8 +781,12 @@ const AutoStorySilphCase AUTO_STORY_SILPH_CASES[] = { .expectation = {.description = "from (5, 15) facing east, ends on (9, 10) facing north"}, }, { - .input = {.name = "16.06 back to Saffron's Center with no Rockets", .body = test_return_row}, - .expectation = {.description = "no trainer met, ends below the Center's door"}, + .input = {.name = "16.06 Escape Rope out of Silph Co. and Fly to Saffron's Center", .body = test_return_row}, + .expectation = {.description = "the rope leaves the player on Saffron City, the Fly ends below the Center's door, no trainer met"}, + }, + { + .input = {.name = "16.06 end pose to 18.01 start pose chain", .body = test_center_to_gym_door_chain}, + .expectation = {.description = "16.06b between them starts at 16.06's nurse and ends on the Gym's door mat (14, 23) facing north, nobody met"}, }, { .input = {.name = "the Saffron Rocket is gone after Silph Co.", .body = test_saffron_rocket_removed}, diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStepTable.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStepTable.cpp index 4a6e74c68b..37261b04bd 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStepTable.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryStepTable.cpp @@ -124,6 +124,7 @@ Pokemon::StoryActionSpec mart_action_spec(){ required_arg("map", StoryArgType::WORD, "the Mart's map, for its stock"), required_arg("items", StoryArgType::ITEMS, "what to buy, in priority order"), absent_arg("fill_to", StoryArgType::INTEGER, "buy only what the bag lacks of the first line's item to hold this many"), + absent_arg("if_affordable", StoryArgType::BOOLEAN, "skip a line the money doesn't cover, logged, instead of failing"), }}; } diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp index 712386d914..bad23e952d 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable.cpp @@ -246,8 +246,8 @@ constexpr std::string_view STORY_ORDER[] = { "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", "13.01", "13.02", "13.03", "13.04", "14.01", "14.02", "14.02b", - "14.03", "14.04", "14.04b", "15.01", "16.01", "16.02", "16.03", "16.03b", "16.04", "16.05", "16.05b", "16.06", - "18.01", "18.02", "18.02b", + "14.03", "14.04", "14.04b", "15.01", "16.01", "16.02", "16.03", "16.03b", "16.04", "16.05", "16.05b", "16.06", "16.06b", + "18.01", "18.02", "18.02b", "18.03", "17.02", "17.03", "17.04", "17.04b", "19.01a", "19.01", "19.02", "19.03", "19.04", "19.04b", "19.04c", "19.04d", "19.05", "20.01a", "20.01", "20.02", "20.03", "20.04", "20.05", }; diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable_Tests.cpp index 2101f5561a..b7c2659ce5 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryTable_Tests.cpp @@ -35,8 +35,8 @@ const std::vector PINNED_ORDER = { "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", "13.01", "13.02", "13.03", "13.04", "14.01", "14.02", "14.02b", - "14.03", "14.04", "14.04b", "15.01", "16.01", "16.02", "16.03", "16.03b", "16.04", "16.05", "16.05b", "16.06", - "18.01", "18.02", "18.02b", + "14.03", "14.04", "14.04b", "15.01", "16.01", "16.02", "16.03", "16.03b", "16.04", "16.05", "16.05b", "16.06", "16.06b", + "18.01", "18.02", "18.02b", "18.03", "17.02", "17.03", "17.04", "17.04b", "19.01a", "19.01", "19.02", "19.03", "19.04", "19.04b", "19.04c", "19.04d", "19.05", "20.01a", "20.01", "20.02", "20.03", "20.04", "20.05", }; diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h index debc7f34a0..46a52d6f26 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryUnauthoredStarts_Tests.h @@ -19,13 +19,11 @@ 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. -// 18.01 (Saffron's gym) starts at Saffron's Center nurse, where no row -// before it in the order ends (Silph Co.'s 16.01 ends on a pad on 5F; the -// rest of Silph Co. is not authored). 14.01 starts outside the Pokemon -// Mansion, after its Escape Rope (13.04), which is not authored. An id -// leaves this list once the rows before it are in. +// 14.01 starts outside the Pokemon Mansion, after its Escape Rope (13.04), +// which is not authored. An id leaves this list once the rows before it +// are in. inline bool starts_after_unauthored_rows(std::string_view id){ - return id == "18.01" || id == "14.01"; + return id == "14.01"; } 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 c42bb56534..3ccab42213 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp @@ -400,8 +400,8 @@ UnitTestResult check_checkpoint(const StoryCheckpoint& checkpoint, StoryPose& po // 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() != 95 || checkpoints[0].start){ - return "Expected 95 checkpoints, the first from a new game."; + if (checkpoints.size() != 97 || checkpoints[0].start){ + return "Expected 97 checkpoints, the first from a new game."; } StoryPose pose; walk_state() = WalkGates{}; diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-12.03.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-12.03.plan.json index abaec77c34..ac147fff98 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-12.03.plan.json +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-12.03.plan.json @@ -8,18 +8,79 @@ "start_flags": ["trainer_beaten:Route21_South/swimmer_m_water@10,29"], "events": [ { - "id": "super_repel_fuchsia", + "id": "outside_fuchsia_center", + "kind": "route", + "action": "run", + "args": {"target": {"map": "FuchsiaCity", "tiles": [[27, 32]], "facing": "east"}}, + "why": "from the nurse straight south 5 to the Center's door warp (7, 9), held until the warp: the door is the position fix, so no walk to a wall corner first (user, 2026-11-13: the old way west to (0, 5) turned east beside the escalator, whose rail hides the player's legs and the facing read failed); out onto Fuchsia City and east along row 32 to the ledge column (28, 30..34), as 12.01's west_of_east_ledge" + }, + { + "id": "east_ledge_hop", + "kind": "step", + "args": {"direction": "east"}, + "declared_after": {"map": "FuchsiaCity", "tiles": [[29, 32]], "facing": "east"}, + "why": "over the ledge (28, 32), as 12.01: planned routes never hop a ledge, and without it the way north goes round the city's west edge" + }, + { + "id": "below_mart_tree", + "kind": "route", + "action": "run", + "args": {"target": {"map": "FuchsiaCity", "tiles": [[24, 23]], "facing": "north"}}, + "why": "up columns 29..30 to row 23 and west to below the Cut tree (24, 22), as 12.01" + }, + { + "id": "cut_mart_tree", "kind": "game_action", - "action": "use_item", - "args": {"item": "super-repel", "if_any": true}, - "why": "pokeguy's Super Repel before his Fly to Pallet (1:18:40, Super Repels 5 to 4; user's approval 2026-11-13): its 200 steps last over Route 21's water (wild Tentacool and Tentacruel on every tile) and up the Mansion to 3F's statue, where 13.01 uses the next. The first event, at the nurse: this checkpoint's save already stands there. 08.03 bought 7, 10.04 and 11.03 used one each; a Repel renewed in battle may have taken more, so with none left the step is skipped (if_any) and the Repel at Pallet's shore still covers the Surf" + "action": "cut_tree", + "args": {"direction": "north"}, + "declared_after": {"map": "FuchsiaCity", "tiles": [[24, 22]], "facing": "north"}, + "why": "the tree (FuchsiaCity map.json object 13, EventScript_CutTree), grown back since 12.01; a step onto its tile" }, { - "id": "outside_fuchsia_center", + "id": "fuchsia_mart_wall", + "kind": "route", + "action": "run", + "args": {"target": {"map": "FuchsiaCity_Mart", "tiles": [[4, 2]], "facing": "north"}}, + "why": "up column 24 to row 17, west to the Mart's door (11, 15) and in, up column 4 to the wall (4, 1), as 12.01" + }, + { + "id": "fuchsia_mart_clerk", "kind": "route", "action": "run", - "args": {"target": {"map": "FuchsiaCity", "tiles": [[25, 32]], "facing": "south"}}, - "why": "from the nurse straight south 5 to the Center's door warp (7, 9), held until the warp: the door is the position fix, so no walk to a wall corner first (user, 2026-11-13: the old way west to (0, 5) turned east beside the escalator, whose rail hides the player's legs and the facing read failed); out onto Fuchsia City, where Fly works" + "args": {"target": {"map": "FuchsiaCity_Mart", "tiles": [[4, 3]], "facing": "west"}}, + "why": "a tile back down, facing the clerk (2, 3) over the counter (3, 3)" + }, + { + "id": "buy_super_potions_for_silph", + "kind": "game_action", + "action": "mart", + "args": { + "map": "FuchsiaCity_Mart", + "items": [{"item": "super-potion", "quantity": 4}] + }, + "why": "4 Super Potions (700 each, 2,800) for Silph Co.'s fights (user's decision 2026-11-15, from the shopping audit: Fuchsia's Super Potions, not Saffron's Hyper Potions or Full Heals): PokeGuy's bag at the Silph rival, Silph's Giovanni and Sabrina holds superpotion x4 (PokemonSimulation docs/battles/pokeguy-conditions.md), and 12.01's Super Potions go to Kayden's and Kirk's damage before Koga, with no Mart after it before Silph Co. The last Fuchsia visit before Silph Co. (16.01), so no Fly detour. Bought blind after Koga's prize (12.02), which 12.01's 3,762 less its Super Potions doesn't count; a short purse fails the step here, before the Fly" + }, + { + "id": "above_mart_tree", + "kind": "route", + "action": "run", + "args": {"target": {"map": "FuchsiaCity", "tiles": [[24, 21]], "facing": "south"}}, + "why": "out of the Mart's door (11, 15), east along row 17 and down column 24 to above the Cut tree (24, 22), grown back when the city loaded" + }, + { + "id": "cut_mart_tree_back", + "kind": "game_action", + "action": "cut_tree", + "args": {"direction": "south"}, + "declared_after": {"map": "FuchsiaCity", "tiles": [[24, 22]], "facing": "south"}, + "why": "the tree again; a step onto its tile, where Fly works" + }, + { + "id": "super_repel_fuchsia", + "kind": "game_action", + "action": "use_item", + "args": {"item": "super-repel", "if_any": true}, + "why": "pokeguy's Super Repel before his Fly to Pallet (1:18:40, Super Repels 5 to 4; user's approval 2026-11-13): its 200 steps last over Route 21's water (wild Tentacool and Tentacruel on every tile) and up the Mansion to 3F's statue, where 13.01 uses the next. After the Fuchsia Mart, before the Fly: the walk to the Mart and back (about 70 steps) doesn't spend it. 08.03 bought 7, 10.04 and 11.03 used one each; a Repel renewed in battle may have taken more, so with none left the step is skipped (if_any) and the Repel at Pallet's shore still covers the Surf" }, { "id": "fly_pallet", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-16.06.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-16.06.plan.json index 71914204d3..bf4af82b51 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-16.06.plan.json +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-16.06.plan.json @@ -3,7 +3,7 @@ "game": "frlg", "checkpoint": { "id": "16.06", - "title": "Silph Co. to Saffron: back down to the Center", + "title": "Silph Co. to Saffron: Escape Rope out, Fly to the Center", "start": { "map": "SilphCo_11F", "tiles": [ @@ -25,6 +25,45 @@ "silph_cleared" ], "events": [ + { + "id": "escape_rope", + "kind": "game_action", + "action": "use_item", + "args": { + "item": "escape-rope" + }, + "declared_after": { + "map": "SaffronCity", + "tiles": [ + [ + 33, + 31 + ] + ], + "facing": "south" + }, + "why": "out of Silph Co. from 11F, as pokeguy (1:32:56-1:33:00, his ESCAPE ROPE count 2 to 1). SilphCo_11F allows it (pokefirered map.json: allow_escaping true, MAP_TYPE_INDOOR), and the rope takes the player to the escape warp, set when the player walked north into Silph Co.'s door (33, 30) from Saffron (overworld.c UpdateEscapeWarp(): the tile below the door, (33, 31)). The bag has 4 by now: 07.01's 2 and 08.03's 4, less 09.02's and 13.04's" + }, + { + "id": "fly_saffron", + "kind": "game_action", + "action": "fly", + "args": { + "town": "SaffronCity", + "species": "pidgey" + }, + "declared_after": { + "map": "SaffronCity", + "tiles": [ + [ + 24, + 39 + ] + ], + "facing": "south" + }, + "why": "the Pidgey flies to Saffron City, landing below the Pokemon Center's door (24, 38) on its heal spot (pokefirered heal_locations.json, HEAL_LOCATION_SAFFRON_CITY), as 18.03" + }, { "id": "below_center_door", "kind": "route", @@ -41,7 +80,7 @@ "facing": "north" } }, - "why": "back by the pads and stairs, with the doors open and no Rocket left in Silph Co. or Saffron City, out of Silph Co.'s door (33, 30) to below the Center's door (24, 38)" + "why": "turn to face the Center's door (24, 38) from the landing" }, { "id": "saffron_nurse", @@ -70,7 +109,8 @@ "menu": "full", "notes": { "checkpoint": [ - "Starts facing the president on 11F, where 16.05b ends. The Rockets are gone from Silph Co. and Saffron City (silph_cleared): the Grunt at Saffron (46, 13) no longer blocks the Gym's door." + "Starts facing the president on 11F, where 16.05b ends. The Rockets are gone from Silph Co. and Saffron City (silph_cleared): the Grunt at Saffron (46, 13) no longer blocks the Gym's door.", + "Out by Escape Rope and Fly, not back down by the pads and stairs: that walk took about 2 minutes, with 16 tiles walked again after re-plans on 7F, 3F and in Saffron (console B, 2026-11-15). The rope lands below Silph Co.'s door (33, 31); the city's blocks between it and the Center make the walk there 35 tiles, so the Pidgey flies." ] } }, diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-16.06b.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-16.06b.plan.json new file mode 100644 index 0000000000..9e1d878173 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-16.06b.plan.json @@ -0,0 +1,138 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "frlg", + "checkpoint": { + "id": "16.06b", + "title": "Saffron City: from the Center to the Gym's door", + "start": { + "map": "SaffronCity_PokemonCenter_1F", + "tiles": [ + [ + 7, + 4 + ] + ], + "facing": "north" + }, + "start_flags": [ + "silph_cleared" + ], + "events": [ + { + "id": "below_center_row_40", + "kind": "route", + "action": "run", + "args": { + "target": { + "map": "SaffronCity", + "tiles": [ + [ + 24, + 40 + ] + ], + "facing": "south" + } + }, + "why": "out of Saffron's Center (its ground floor coded) onto the street below its door (24, 38), and a tile on to row 40, below the Lass's walk (27..37, 39)" + }, + { + "id": "east_wall_row_40", + "kind": "route", + "action": "run", + "args": { + "target": { + "map": "SaffronCity", + "tiles": [ + [ + 52, + 40 + ] + ], + "facing": "east" + } + }, + "why": "east along row 40 to the east wall: the only way north past row 19 is columns 50..52" + }, + { + "id": "below_row_14_wall", + "kind": "route", + "action": "run", + "args": { + "target": { + "map": "SaffronCity", + "tiles": [ + [ + 52, + 15 + ] + ], + "facing": "north" + } + }, + "why": "north up column 52 to the wall of row 14 (column 50 ends at the sign (50, 14), which a hold into it reads)" + }, + { + "id": "below_gym_door", + "kind": "route", + "action": "run", + "args": { + "target": { + "map": "SaffronCity", + "tiles": [ + [ + 46, + 15 + ] + ], + "facing": "west" + } + }, + "why": "west along row 15 to column 46, below the gap in row 14 (45..47, 14) that leads to the Gym's door (46, 12)" + }, + { + "id": "into_gym", + "kind": "route", + "action": "run", + "args": { + "target": { + "map": "SaffronCity_Gym", + "tiles": [ + [ + 14, + 23 + ] + ], + "facing": "north" + } + }, + "why": "north through the gap and the Gym's door (46, 12) onto the mat (14, 23) inside (SaffronCity map.json warp 3 to SaffronCity_Gym warp 1): a column off, the hold stops at the Gym's front wall (45 or 47, 13) instead; the Rocket Grunt who stood on (46, 13) is gone (silph_cleared)" + } + ] + }, + "execution": { + "menu": "full", + "notes": { + "checkpoint": [ + "Starts at Saffron's nurse, facing her, where 16.06 ends healed; ends on the Gym's door mat (14, 23), facing north, where 18.01 starts.", + "The Rockets are gone from Saffron City (silph_cleared, 16.05's Giovanni): the Grunt on (46, 13) (SaffronCity_EventScript_RocketGrunt3, hidden by FLAG_HIDE_SAFFRON_ROCKETS), the only tile the Gym's door (46, 12) is entered from, no longer blocks it.", + "Four legs after the Center's door, 62 tiles for a straight line of 48: the fewest a walk can take is 58, as the only way north past row 19 is columns 50..52 and row 39 is the Lass's; the east wall and row 14's wall stop the two long legs. The old walk boxed round by row 41 and back from column 52 (about 79 tiles, console B, 2026-11-15)." + ] + } + }, + "metadata": { + "phase": "testing", + "postconditions": { + "position": { + "map": "SaffronCity_Gym", + "tiles": [ + [ + 14, + 23 + ] + ], + "facing": "north" + } + } + } +} diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-18.01.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-18.01.plan.json index e7038e03e9..e1a730787c 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-18.01.plan.json +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-18.01.plan.json @@ -201,7 +201,7 @@ "menu": "full", "notes": { "checkpoint": [ - "Starts on the gym's door mat (14, 23), facing north, as the door leaves the player. The way there from Saffron's Center is not authored: Silph Co. (16.0x) comes first and clears Saffron's Rocket Grunts, and one of them (SaffronCity_EventScript_RocketGrunt3, hidden by FLAG_HIDE_SAFFRON_ROCKETS) stands on (46, 13), the only tile the gym's door (46, 12) is entered from; story_maps() still has him, and rows 15.01 and 16.01 need the others there. So this start is on the unauthored-start list.", + "Starts on the gym's door mat (14, 23), facing north, as the door leaves the player, where 16.06b ends: its walk from Saffron's Center to the door comes after Silph Co. (16.0x), which clears Saffron's Rocket Grunts, one of them on (46, 13) (SaffronCity_EventScript_RocketGrunt3, hidden by FLAG_HIDE_SAFFRON_ROCKETS), the only tile the gym's door (46, 12) is entered from.", "Ends at (14, 12), facing Sabrina (14, 11), where 18.02 starts: the save in front of her.", "The gym is nine rooms of 9x6 tiles with no door between them: each room's pads (the map's step_on warps) lead to another room's, and the way from the entrance to Sabrina is four of them: (18, 20) to (28, 23), (20, 20) to (28, 4), (20, 7) to (0, 4), (0, 7) to (18, 15). The player lands on a pad and walks off it before the next. The trainers on the way (Cameron (24, 18), Johan (24, 2), Preston (4, 2), sight 3 south) are not fought: each leg keeps out of their lines, and the sim test fails if one is met. The others (Tyron, Amanda, Stacy, Tasha) are in rooms the route does not enter." ] diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-18.02b.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-18.02b.plan.json index 00f8de6c53..455e1e8988 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-18.02b.plan.json +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-18.02b.plan.json @@ -3,7 +3,7 @@ "game": "frlg", "checkpoint": { "id": "18.02b", - "title": "Out of Saffron Gym by the pads, heal at Saffron's Center", + "title": "Out of Saffron Gym by the pads, Fly to Saffron's Center and heal", "start": { "map": "SaffronCity_Gym", "tiles": [ @@ -14,6 +14,9 @@ ], "facing": "north" }, + "start_flags": [ + "silph_cleared" + ], "events": [ { "id": "by_pad_out_of_sabrina", @@ -177,6 +180,44 @@ }, "why": "onto the pad (28, 23), which warps to (18, 20) in the entrance room" }, + { + "id": "out_of_gym", + "kind": "route", + "action": "run", + "args": { + "target": { + "map": "SaffronCity", + "tiles": [ + [ + 46, + 13 + ] + ], + "facing": "south" + } + }, + "why": "down the entrance room and out of the door (14, 23) onto Saffron City below the gym's door (46, 12): Fly works outdoors only" + }, + { + "id": "fly_saffron", + "kind": "game_action", + "action": "fly", + "args": { + "town": "SaffronCity", + "species": "pidgey" + }, + "declared_after": { + "map": "SaffronCity", + "tiles": [ + [ + 24, + 39 + ] + ], + "facing": "south" + }, + "why": "the Pidgey flies to Saffron City, landing below the Pokemon Center's door (24, 38) on its heal spot (pokefirered heal_locations.json, HEAL_LOCATION_SAFFRON_CITY), as 18.03" + }, { "id": "below_center_door", "kind": "route", @@ -193,7 +234,7 @@ "facing": "north" } }, - "why": "down the entrance room and out of the door (14, 23) onto Saffron City below the gym (46, 13), then through the city to below the Center's door (24, 38)" + "why": "turn to face the Center's door (24, 38) from the landing" }, { "id": "saffron_nurse", @@ -224,7 +265,8 @@ "checkpoint": [ "Starts in front of Sabrina, where 18.02 ends after her battle and saves.", "Out by the four pads in reverse, each pair a two-way link: (18, 15) to (0, 7), (0, 4) to (20, 7), (28, 4) to (20, 20), (28, 23) to (18, 20), keeping to the same rows as the way in (18.01). No gym trainer is fought on the way out.", - "Ends at Saffron's nurse, facing her: 17.01's start. Silph Co.'s Rocket Grunts are gone by now (FLAG_HIDE_SAFFRON_ROCKETS), but story_maps() still has them, so the city route here goes round their lines as 15.01's does; the walk out of the gym lands the player on (46, 13), where one of them stands on that map." + "Ends at Saffron's nurse, facing her: 18.03's start. Out of the gym's door and by Fly to the Center's door, not through the city: the walk round the city's blocks to the Center was about 80 tiles for a straight line of 48 (console B, 2026-11-15).", + "Starts with silph_cleared, as 16.06b: Silph Co.'s Giovanni (16.05) sent the Rockets out of Saffron City, so a run started here plans the walk out of the gym's door onto (46, 13), where one of them stood, on maps without them." ] } }, diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-18.03.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-18.03.plan.json new file mode 100644 index 0000000000..aa3a1dc660 --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-18.03.plan.json @@ -0,0 +1,117 @@ +{ + "format": "pokesim-authored-checkpoint/1", + "game": "frlg", + "checkpoint": { + "id": "18.03", + "title": "Fly to Celadon for 2 X Accuracies on the Department Store's 5F, Fly back to Saffron's Center", + "start": {"map": "SaffronCity_PokemonCenter_1F", "tiles": [[7, 4]], "facing": "north"}, + "events": [ + { + "id": "saffron_outside", + "kind": "route", + "action": "run", + "args": {"target": {"map": "SaffronCity", "tiles": [[24, 39]], "facing": "south"}}, + "why": "out of Saffron's Center onto the street below its door (24, 38), as 17.02: Fly works outdoors only" + }, + { + "id": "fly_celadon", + "kind": "game_action", + "action": "fly", + "args": {"town": "CeladonCity", "species": "pidgey"}, + "declared_after": {"map": "CeladonCity", "tiles": [[48, 12]], "facing": "south"}, + "why": "the Pidgey flies to Celadon City, landing below the Pokemon Center's door (48, 11) on its heal spot, as 14.03" + }, + { + "id": "below_store_lift", + "kind": "route", + "action": "run", + "args": {"target": {"map": "CeladonCity_DepartmentStore_1F", "tiles": [[6, 2]], "facing": "north"}}, + "why": "from Fly's landing west along the city to the Department Store's door (11, 14) and up 1F to below its lift door (6, 1), where 10.01 rode it" + }, + { + "id": "lift_to_5f", + "kind": "game_action", + "action": "lift_floor", + "args": {"from": "1F", "to": "5F"}, + "declared_after": {"map": "CeladonCity_DepartmentStore_5F", "tiles": [[6, 2]], "facing": "south"}, + "why": "the lift as in 10.01: in through the door, to the panel (cursor on 1F, the floor came from), 5F, out a tile south of 5F's lift door (6, 1)" + }, + { + "id": "x_items_clerk", + "kind": "route", + "action": "run", + "args": {"target": {"map": "CeladonCity_DepartmentStore_5F", "tiles": [[3, 7]], "facing": "west"}}, + "why": "down and west to face the X items clerk (1, 7) over the counter (2, 7), out of the Sailor's zone (5..7, 7..9), as 10.01" + }, + { + "id": "buy_x_accuracies", + "kind": "game_action", + "action": "mart", + "args": { + "map": "CeladonCity_DepartmentStore_5F", + "items": [{"item": "x-accuracy", "quantity": 2}] + }, + "why": "2 X Accuracies (950 each, 1,900) for the Route 22 rival and the League (user's decision 2026-11-15, from the shopping audit): PokeGuy's bag holds xaccuracy x5 at the Silph rival, x4 at Silph's Giovanni, Sabrina and the Route 22 rival, and x3 at Lorelei (PokemonSimulation docs/battles/pokeguy-conditions.md); 10.01 bought 5, and the C policy's X Accuracies in the Silph and Saffron fights may leave fewer. Only Celadon's 5F sells them, so after Sabrina (18.02b) and before 17.02's Fly to Viridian, the last point before the rival where Saffron's Fly reaches it with one detour. Bought blind after Silph's Giovanni and Sabrina's prizes; a short purse fails the step here, early in the row" + }, + { + "id": "below_5f_lift", + "kind": "route", + "action": "run", + "args": {"target": {"map": "CeladonCity_DepartmentStore_5F", "tiles": [[6, 2]], "facing": "north"}}, + "why": "back up to below the lift door (6, 1)" + }, + { + "id": "lift_to_1f", + "kind": "game_action", + "action": "lift_floor", + "args": {"from": "5F", "to": "1F"}, + "declared_after": {"map": "CeladonCity_DepartmentStore_1F", "tiles": [[6, 2]], "facing": "south"}, + "why": "the lift down, the cursor on 5F, to 1F, out a tile south of 1F's lift door" + }, + { + "id": "out_of_store", + "kind": "route", + "action": "run", + "args": {"target": {"map": "CeladonCity", "tiles": [[11, 15]], "facing": "south"}}, + "why": "down 1F and out of the door (2, 14) onto Celadon below the store's door (11, 14), as 10.01" + }, + { + "id": "fly_saffron", + "kind": "game_action", + "action": "fly", + "args": {"town": "SaffronCity", "species": "pidgey"}, + "declared_after": {"map": "SaffronCity", "tiles": [[24, 39]], "facing": "south"}, + "why": "the Pidgey flies back to Saffron City, landing below the Pokemon Center's door (24, 38) on its heal spot (pokefirered heal_locations.json, HEAL_LOCATION_SAFFRON_CITY)" + }, + { + "id": "below_center_door", + "kind": "route", + "action": "run", + "args": {"target": {"map": "SaffronCity", "tiles": [[24, 39]], "facing": "north"}}, + "why": "turn to face the Center's door (24, 38) from the landing" + }, + { + "id": "saffron_nurse", + "kind": "game_action", + "action": "center_enter", + "declared_after": {"map": "SaffronCity_PokemonCenter_1F", "tiles": [[7, 4]], "facing": "north"}, + "why": "the Center script in: through the door and up to the nurse, where 17.02 starts; no heal needed (18.02b healed, and nothing here fights)" + } + ] + }, + "execution": { + "menu": "full", + "notes": { + "checkpoint": [ + "Starts at Saffron's nurse, where 18.02b ends healed after Sabrina; ends there again, facing her, where 17.02 starts. A row of its own between them so that a playthrough already past Celadon (console B's save at 16.05, 2026-11-15) still buys the X Accuracies before the Route 22 rival.", + "The Department Store's way from 1F's lift to 5F's X items clerk and back is 10.01's." + ] + } + }, + "metadata": { + "phase": "testing", + "postconditions": { + "position": {"map": "SaffronCity_PokemonCenter_1F", "tiles": [[7, 4]], "facing": "north"} + } + } +} diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-19.01a.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-19.01a.plan.json index cbcd2ebb10..06890fd155 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-19.01a.plan.json +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-19.01a.plan.json @@ -29,6 +29,16 @@ "fill_to": 4 }, "why": "Potions up to 4 in the bag, as in PokeGuy's bag at the Route 22 rival (potion x4, superpotion x4, xaccuracy x4, xspecial x17, xspeed x5, guardspec x2; PokemonSimulation docs/battles/pokeguy-conditions.md); the Super Potions are 12.01's. Early in the row, so a failed purchase stops it before the walk. Buys 4 less what the bag holds, skipped at 4" + }, + { + "id": "buy_status_heals", + "kind": "game_action", + "action": "mart", + "args": { + "map": "ViridianCity_Mart", + "items": [{"item": "antidote", "quantity": 1}, {"item": "parlyz-heal", "quantity": 2}] + }, + "why": "an Antidote and 2 Parlyz Heals for the League's poison and paralysis (user's decision 2026-11-15, from the shopping audit): PokeGuy's bag at the Route 22 rival and at Lorelei holds antidote x1 and parlyzheal x2 (PokemonSimulation docs/battles/pokeguy-conditions.md), which the story's bag never bought for the League; recovery_items() cures PSN and PAR with them. Viridian sells both (ANTIDOTE 100, PARLYZ HEAL 200: 500 in all); its own step, as buy_potions's fill_to would skip a whole step when the bag holds 4 Potions. Bought blind after 17.04's Giovanni prize" } ] }, diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-20.01a.plan.json b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-20.01a.plan.json index 41bf9947d8..95e18b81f2 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-20.01a.plan.json +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/StoryData/frlg-20.01a.plan.json @@ -25,6 +25,17 @@ "fill_to": 13 }, "why": "Full Restores up to 13 in the bag, as in PokeGuy's bag at Lorelei (fullrestore x13, potion x4, superpotion x4, xaccuracy x3, xspecial x15, xspeed x4, guardspec x2, elixir x1; PokemonSimulation docs/battles/pokeguy-conditions.md, lorelei): the C policy's heals in the League's five fights come from the bag. Buys 13 less what the bag holds (3000 each), skipped at 13; a short purse stops the row here, before the League" + }, + { + "id": "buy_full_heals", + "kind": "game_action", + "action": "mart", + "args": { + "map": "IndigoPlateau_PokemonCenter_1F", + "items": [{"item": "full-heal", "quantity": 2}], + "if_affordable": true + }, + "why": "2 Full Heals (600 each) at the same counter after the Full Restores, only if the money left covers them (user's decision 2026-11-15: keep the Full Restores at 13 and their money check; the Full Heals are extra): not in PokeGuy's bag at Lorelei (PokemonSimulation docs/battles/pokeguy-conditions.md, lorelei: antidote x1 and parlyzheal x2 only, which 19.01a buys): they cure the sleep and freeze those don't without spending a Full Restore. if_affordable: a refused buy, or a quantity box that can't reach 2, is skipped with a log line and the row goes on. The console buys blind (no money reader), so there the skip is the game's refusal dialog passed by the presses, not a read" } ] },