diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_StorySimulation_Tests.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_StorySimulation_Tests.cpp index ff63a1f8ca..e9f15c0632 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_StorySimulation_Tests.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_StorySimulation_Tests.cpp @@ -486,6 +486,42 @@ UnitTestResult test_poses_chain(Logger&){ return true; } +// Walks are planned on the maps: a LEGS step ("east 6, north 18") is +// left only where no route can do its job, each with its reason. +UnitTestResult test_no_hand_written_legs(Logger&){ + const std::map exceptions = { + {"00.01/off_barrys_mat", "steps off a door's mat, where no route starts"}, + {"00.03/into_sandgem", "walks until Dawn's scene starts, wherever it starts"}, + {"00.04/to_route_201", "runs until Route 201's banner, wherever it shows"}, + {"00.04/to_moms_call", "walks until Mom calls, wherever she calls"}, + {"00.05/up_to_barry", "starts inside the School's door, from no known tile"}, + {"01.03/down_the_hall", "steps off the hall's warp tile, where no route starts"}, + {"01.03/down_to_the_boulder", "steps off the coal room's warp tile, where no route starts"}, + {"01.03/up_the_hall", "steps off the hall's warp tile, where no route starts"}, + {"01.03/up_to_the_mines_sign", "steps off the mine's exit, where no route starts"}, + {"01.11/up_to_the_old_woman", "walks until the old woman stops us"}, + }; + std::set seen; + for (const StoryCheckpoint& row : story_checkpoints()){ + for (const StoryStep& step : row.steps){ + if (step.kind != StoryStepKind::LEGS){ + continue; + } + const std::string key = std::format("{}/{}", row.id, step.name); + if (!exceptions.contains(key)){ + return std::format("{}: hand-written legs; plan a route to where they end.", key); + } + seen.insert(key); + } + } + for (const auto& item : exceptions){ + if (!seen.contains(item.first)){ + return std::format("{}: listed as an exception, but no such LEGS step.", item.first); + } + } + return true; +} + // Legs that run off the end of their map land on the next one of the same // world: east along Route 201's top row ends in Sandgem, not off the map. UnitTestResult test_legs_cross_maps(Logger&){ @@ -583,6 +619,10 @@ const AutoStoryStorySimulationCase AUTO_STORY_STORY_SIMULATION_CASES[] = { .input = {"no text reader for the game's language", test_no_text_reader}, .expectation = {}, }, + { + .input = {"no hand-written legs but the listed ones", test_no_hand_written_legs}, + .expectation = {}, + }, }; void add_tests_AutoStory_StorySimulation(UnitTestDatabase& database){ diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.01.plan.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.01.plan.json index 83b59bc05b..bca1f4918c 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.01.plan.json +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.01.plan.json @@ -38,20 +38,20 @@ { "args": { "fight_wild": false, - "legs": [ - { - "direction": "north", - "tiles": 1 - }, - { - "direction": "east", - "tiles": 1 - } - ] + "target": { + "facing": "east", + "map": "PlayerHouse2F", + "tiles": [ + [ + 8, + 4 + ] + ] + } }, "id": "onto_the_flute_tile", - "kind": "legs", - "why": "up onto (7, 4), then east onto the top of the stairs' mat (8, 4)" + "kind": "route", + "why": "onto the top of the stairs' mat (8, 4), past the flute's tile" }, { "args": { @@ -212,16 +212,20 @@ { "args": { "fight_wild": false, - "legs": [ - { - "direction": "north", - "tiles": 1 - } - ] + "target": { + "facing": "north", + "map": "TwinleafTown", + "tiles": [ + [ + 9, + 12 + ] + ] + } }, "id": "back_onto_barrys_doorstep", - "kind": "legs", - "why": "back to (9, 12); its trigger is spent" + "kind": "route", + "why": "back to his doorstep (9, 12); its trigger is spent" }, { "args": { @@ -380,20 +384,20 @@ { "args": { "fight_wild": false, - "legs": [ - { - "direction": "east", - "tiles": 6 - }, - { - "direction": "north", - "tiles": 18 - } - ] + "target": { + "facing": "north", + "map": "Route201", + "tiles": [ + [ + 15, + 19 + ] + ] + } }, "id": "below_barrys_warning", - "kind": "legs", - "why": "along row 12, then up Twinleaf's exit to Route 201 (15, 19)" + "kind": "route", + "why": "below the trigger, up Twinleaf's exit to Route 201 (15, 19)" }, { "args": { @@ -420,24 +424,20 @@ { "args": { "fight_wild": false, - "legs": [ - { - "direction": "west", - "tiles": 1 - }, - { - "direction": "north", - "tiles": 1 - }, - { - "direction": "west", - "tiles": 2 - } - ] + "target": { + "facing": "west", + "map": "Route201", + "tiles": [ + [ + 12, + 17 + ] + ] + } }, "id": "away_from_barry", - "kind": "legs", - "why": "to (12, 17): row 18 west of the path is trees (r16), the dirt goes on along row 17" + "kind": "route", + "why": "to (12, 17): row 18 west of the path is trees, the dirt goes on along row 17" }, { "args": { diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.02.plan.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.02.plan.json index e9a964d2bb..40663f923f 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.02.plan.json +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.02.plan.json @@ -4,15 +4,19 @@ { "args": { "fight_wild": false, - "legs": [ - { - "direction": "north", - "tiles": 1 - } - ] + "target": { + "facing": "north", + "map": "VerityLakefront", + "tiles": [ + [ + 17, + 13 + ] + ] + } }, "id": "to_the_lake_entrance", - "kind": "legs", + "kind": "route", "why": "a tile short of the trigger" }, { diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.04.plan.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.04.plan.json index 289acceb38..13f5fdb661 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.04.plan.json +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.04.plan.json @@ -200,19 +200,19 @@ { "args": { "fight_wild": false, - "legs": [ - { - "direction": "west", - "tiles": 1 - }, - { - "direction": "south", - "tiles": 2 - } - ] + "target": { + "facing": "south", + "map": "PlayerHouse1F", + "tiles": [ + [ + 5, + 9 + ] + ] + } }, "id": "around_mom", - "kind": "legs", + "kind": "route", "why": "around Mom at (6, 8), to beside the door's column" }, { diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.04b.plan.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.04b.plan.json index b858e8c75a..58d57b54c9 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.04b.plan.json +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.04b.plan.json @@ -122,33 +122,19 @@ "args": { "fight_wild": false, "target": { + "facing": "north", "map": "SandgemTown", "tiles": [ [ - 20, + 17, 11 ] ] } }, - "id": "to_center_sign", - "kind": "route", - "why": "below the Center's sign, its doorway in sight" - }, - { - "action": "one_short_ok", - "args": { - "fight_wild": false, - "legs": [ - { - "direction": "west", - "tiles": 3 - } - ] - }, "id": "below_center_door", - "kind": "legs", - "why": "taps west below the Center's door" + "kind": "route", + "why": "below the Center's door" }, { "declared_after": { diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.05.plan.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.05.plan.json index 0e985d5acc..fe94d37361 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.05.plan.json +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.05.plan.json @@ -1,24 +1,6 @@ { "checkpoint": { "events": [ - { - "args": { - "fight_wild": false, - "legs": [ - { - "direction": "west", - "tiles": 1 - }, - { - "direction": "north", - "tiles": 2 - } - ] - }, - "id": "up_the_steps", - "kind": "legs", - "why": "a tile west of the save, then up the steps to (47, 60)" - }, { "action": "town", "args": { diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.05b.plan.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.05b.plan.json index c9d0ddeec7..8021fabee4 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.05b.plan.json +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-00.05b.plan.json @@ -46,15 +46,19 @@ { "args": { "fight_wild": false, - "legs": [ - { - "direction": "east", - "tiles": 2 - } - ] + "target": { + "facing": "east", + "map": "JubilifeCity", + "tiles": [ + [ + 48, + 40 + ] + ] + } }, "id": "past_the_president", - "kind": "legs", + "kind": "route", "why": "east of his column" }, { diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-01.02.plan.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-01.02.plan.json index 2151fc8642..b5eee72e0f 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-01.02.plan.json +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-01.02.plan.json @@ -2,15 +2,18 @@ "checkpoint": { "events": [ { - "action": "to_wall", "args": { "fight_wild": false, - "legs": [ - { - "direction": "south", - "tiles": 4 - } - ] + "target": { + "facing": "south", + "map": "Route203", + "tiles": [ + [ + 5, + 20 + ] + ] + } }, "declared_after": { "facing": "south", @@ -23,7 +26,7 @@ ] }, "id": "south_to_the_cliff", - "kind": "legs", + "kind": "route", "why": "down the trigger's column to the cliff" }, { diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-01.08.plan.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-01.08.plan.json index db9402098c..387cad3518 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-01.08.plan.json +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-01.08.plan.json @@ -2,15 +2,18 @@ "checkpoint": { "events": [ { - "action": "to_wall", "args": { "fight_wild": false, - "legs": [ - { - "direction": "west", - "tiles": 4 - } - ] + "target": { + "facing": "west", + "map": "JubilifeCity", + "tiles": [ + [ + 44, + 5 + ] + ] + } }, "declared_after": { "facing": "west", @@ -23,7 +26,7 @@ ] }, "id": "west_to_the_wall", - "kind": "legs", + "kind": "route", "why": "west along row 5 to the wall" }, { diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-01.11.plan.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-01.11.plan.json index 4f3981b712..dafdf2a436 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-01.11.plan.json +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-01.11.plan.json @@ -4,16 +4,20 @@ { "args": { "fight_wild": false, - "legs": [ - { - "direction": "west", - "tiles": 8 - } - ] + "target": { + "facing": "west", + "map": "FloaromaTown", + "tiles": [ + [ + 3, + 29 + ] + ] + } }, "id": "west_along_the_field", - "kind": "legs", - "why": "8 taps west along row 29" + "kind": "route", + "why": "west along row 29" }, { "action": "to_wall", @@ -63,12 +67,16 @@ { "args": { "fight_wild": false, - "legs": [ - { - "direction": "west", - "tiles": 1 - } - ] + "target": { + "facing": "west", + "map": "FloaromaTown", + "tiles": [ + [ + 3, + 26 + ] + ] + } }, "declared_after": { "facing": "north", @@ -81,7 +89,7 @@ ] }, "id": "below_the_old_man", - "kind": "legs", + "kind": "route", "why": "a tile west" }, { diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-mine-01.03.plan.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-mine-01.03.plan.json index ac79aa77bd..5d873530a3 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-mine-01.03.plan.json +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StoryData/bdsp-mine-01.03.plan.json @@ -2,43 +2,19 @@ "checkpoint": { "events": [ { - "action": "to_wall", + "action": "town", "args": { "fight_wild": false, - "legs": [ - { - "direction": "east", - "tiles": 6 - }, - { - "direction": "north", - "tiles": 2 - } - ] - }, - "declared_after": { - "facing": "north", - "map": "OreburghCity", - "tiles": [ - [ - 48, - 21 + "target": { + "facing": "north", + "map": "OreburghCity", + "tiles": [ + [ + 47, + 21 + ] ] - ] - }, - "id": "to_the_centers_fence", - "kind": "legs", - "why": "east to the fence below the Center's east corner, north to the Center's front" - }, - { - "args": { - "fight_wild": false, - "legs": [ - { - "direction": "west", - "tiles": 1 - } - ] + } }, "declared_after": { "facing": "north", @@ -51,8 +27,8 @@ ] }, "id": "below_the_centers_door", - "kind": "legs", - "why": "a tap west below the door" + "kind": "route", + "why": "below the Center's door" }, { "id": "barry",