Skip to content

[BBQ Tree 4] Specialized quest handlers, detector image tests and target diagnostics - #275

Draft
dayfine wants to merge 66 commits into
mainfrom
bbq/tree4-specialized-quests
Draft

dayfine wants to merge 66 commits into
mainfrom
bbq/tree4-specialized-quests

Conversation

@dayfine

@dayfine dayfine commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Base: main (Draft PR on fork)

Consolidates the 6 standalone fork PRs in Tree 4:

Supersedes: #19, #23, #29, #33, #35, #180.

dayfine and others added 30 commits October 20, 2026 11:52
The Tera-self and wild-Tera routes checked for a battle menu, but the
result only controlled a log message. On an entry timeout they still
called wild_battle_tera and sent battle commands in the overworld.

Both routes now ask tera_encounter_action() what to do: stop on a
shiny, battle when either the encounter watcher (callback 0) or the
route's own wait saw the battle menu, otherwise skip to the existing
plaza recovery. The audio callback alone does not count as entry.

Unit tests cover the decision table in PokemonSV_Tests.cpp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
The TM machine opens on the first TM, and quest_make_tm() walked
through every uncraftable TM before the craftable one: 12-16 steps of
~2.5 s each in R4 and R5, on every Make TM quest.

Remember the index of the last craftable TM for the program run (keyed
by the run's start time) and try it first. If it is no longer
craftable, go back to the first TM and scan as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
quest_hatch_egg() could pick a hatched Pokemon as the egg: it read the
summary panel right after the cursor move, before the panel updated.
Now it waits for the panel to settle and needs two fresh snapshots that
both show an egg, rechecks the party lead after the swap, and swaps the
lead back into its box slot if the hatch step fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
The summary-panel detector only tells eggs apart in the stats or judge view;
in the default view every occupied slot reads as an egg (R7 and R8 swapped a
Litten in and rode for 10 minutes). BoxEggDetector matches the egg sprite in
the grid, so it works in any view, and one frame covers all 30 slots without
moving the cursor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
The glide to Kleavor lands in the right place, but Kleavor was absent in
about 40% of attempts (R4-R8), and the attempt then gave up. Any wild
Pokemon counts for the quest and Scyther roam the area, so turn the camera
about a quarter at a time, up to three times, and send out the lead again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Catch-any and sneak-up can use it too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
PokemonSV_Tests.cpp registers every SV test, and each BBQ change adds
its controller tests there, so parallel BBQ changes all conflict in it.
Move the Tera encounter tests unchanged into
Programs/Farming/PokemonSV_BBQTests.cpp, registered through one
add_tests_BBQ() call, following the add_tests_<Module>() pattern the
detectors use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
… target

Catch Any and Sneak Up spent 48% of an hour failing to find a target, and
the log only says "Did not enter battle. Did target spawn?". Record each
attempt so a run can tell a missing target from a missed arrival or a
missed detection:

- log a checkpoint after lock-on / before the shutter, and on a timeout,
  then the attempt's outcome from what the detectors reported;
- with the new "Save Target Diagnostics" option (off by default), save the
  checkpoint frames, and the stream history on a possible miss, under
  DebugDumps/BBQ/targets/, after the attempt ends.

No controller command, wait or decision changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
quest_catch() watches for the battle menu twice: an inner wait_until() and
the outer EncounterWatcher. When the inner one saw the menu first,
run_until() returned -1, the battle was treated as "no battle", and
return_to_plaza() fled from the target. Logs show 7 of 22 catch-quest
battles lost this way; no battle ever started after the 25 s timeout.

- Count the inner watcher's battle menu as a battle.
- Catch Any: catch a battle that starts on the way back to Central Plaza
  until this attempt has battled (return_to_plaza_unless_battle(), opt-in;
  return_to_plaza() is unchanged). Typed catch quests still flee.
- Skip the Pokecenter heal and re-fly after an attempt with no battle: the
  player is still on the Central Plaza fly point (~28 s per attempt).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
PokemonSV_Tests.cpp registers every SV test, and each BBQ change adds
its tests there, so parallel BBQ changes all conflict in it. Move the
BBQ tests unchanged into Programs/Farming/PokemonSV_BBQTests.cpp,
registered through one add_tests_BBQ() call, following the
add_tests_<Module>() pattern the detectors use: the Tera encounter
tests, the quest slug round trip and the Blueberry Points reader tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
main moved the quest token map, BBQuests_string_to_enum/enum_to_string and
CameraAngle out of BlueberryQuests (PokemonAutomation#1631), and the BP crop into
read_BP_from_image (PokemonAutomation#1628). Took main's versions and kept only this branch's
log_bbq_snapshot() in BlueberryQuests; BlueberryCatchPhoto.cpp now includes
BlueberryQuests.h directly, since its header no longer pulls it in. Unknown
quests now log as an empty slug (main's enum_to_string) instead of "unknown".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Conflict in PokemonSV_Tests.cpp: upstream converted Test_BlueberryPoints
to ImageUnitTest (PokemonAutomation#1554) while this branch moved it out. Kept the move and
carried the ImageUnitTest change into Programs/Farming/PokemonSV_BBQTests.cpp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
The two Traditional Chinese quest panel frames under
PokemonSV/BlueberryPoints also show three quests each. Read every slot of
both at 1080p and 720p; the empty fourth slot reads as nothing, and
"捕捉1隻..." on screen must fuzzy-match the dictionary's "捕捉一隻...".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Like the other SV detectors, the test class and add_tests_ function live
next to the detector; PokemonSV_Tests.cpp only registers them. One helper
adds a frame's slots so each frame is one line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine and others added 17 commits November 6, 2026 07:01
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine and others added 7 commits November 9, 2026 07:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant