Skip to content

FRLG AutoStory: MART, TEACH, LEVEL, GRIND and fossil CHOICE steps - #195

Closed
dayfine wants to merge 23 commits into
frlg/autostory-capture-pcfrom
frlg/autostory-mart-teach-grind
Closed

dayfine wants to merge 23 commits into
frlg/autostory-capture-pcfrom
frlg/autostory-mart-teach-grind

Conversation

@dayfine

@dayfine dayfine commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Depends on #193 (base frlg/autostory-capture-pc; the diff shows only this change).

Adds the MART, TEACH, LEVEL, GRIND and fossil CHOICE story steps as GAME variants that later checkpoints can name in the table, each with its decisions tested against a fake that follows pokefirered.

  • MART (mart <map> budget= floor= item=qty ...): buys the lines in priority order within the budget at any Mart whose stock is known (the scripts.inc lists, items.json prices). It never opens SELL. The money comes from the money box or, without a reader, from the table's floor. With neither it buys nothing, because typing a quantity past the box's most wraps to the wrong number. Potions, Antidotes and Parlyz Heals it buys are counted into the battles' supplies.
  • TEACH (teach hm03 surf slot=1 forget=tail-whip): picks the move to forget by name or slot before opening the bag. It refuses HM moves, a name the member doesn't know, and a member with four moves and none named, and confirms by reading the moves again.
  • LEVEL (level slot=1 min=16) and GRIND (grind slot=1 level=18 ..., the nurse as the step's target): GRIND calls fight_battle() as is, for the lead only, and is bounded by encounter count. It heals when hurt or every N battles, walks back to the patch, and stops on a shiny the way a capture does.
  • CHOICE(fossil): DOME (13,7) or HELIX (14,7) on MtMoon_B2F. It answers YES only when the prompt reads as the wanted fossil; otherwise it answers NO.
  • GRIND also heals when the lead's attacks are low on PP, and its trip to the nurse restores the PP the battles count (2026-11-03): otherwise a long grind ends on Tackle.
  • Members are read through MemberReader, a callable returning species, level and moves (PokemonFRLG_AutoStoryMember.h). On the console, console_member_reader() reads the member's summary with FRLG: AutoStory, FireRed from a new game to the Boulder Badge #120's read_party_summary(); a member it can't read stops TEACH, LEVEL and GRIND before they press anything.
  • The only edits outside new files are one dispatch in StoryExecutor::game() (with the GRIND heal trip), plus registration in PokemonFRLG_Tests.cpp and SourceFiles.cmake.

Captures needed before these steps can run on the console: the Mart money box and the quantity box ("x02 ¥600"); the TM Case list and its "Teach ... to a POKEMON?" prompt; the party menu's "Teach which POKEMON?" with ABLE/NOT ABLE, the "Delete an older move?" prompt and the moves page; the Mt. Moon "You want the HELIX/DOME FOSSIL?" prompt; and the Key Items pocket showing a fossil.

Testing

  • New unit suites AutoStoryMart, AutoStoryTeach, AutoStoryGrind, AutoStoryChoice and AutoStoryAbilities, run against fakes of the shop's quantity box and cursor, the TM Case and party menu, a grass patch, and Mt. Moon B2F. The TEACH fake uses console B's real Squirtle moves (WATER GUN, TAIL WHIP, BUBBLE, WITHDRAW).
  • Local checks: a syntax check of every touched file with the Windows-clang warning set, and code health (0 failures). The unit tests were not run locally; they run in CI. Nothing was run on the console.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E

dayfine and others added 4 commits November 2, 2026 21:56
New GAME step variants for later checkpoints, each with its decisions
behind an actions interface and tested against a fake that follows
pokefirered:

- MART: a buy list in priority order within a budget at any Mart whose
  stock is known (scripts.inc lists, items.json prices); money from the
  money box or the table's floor, never past the quantity box's most.
- TEACH: a TM or HM to a party member, the move to forget named by name
  or slot; refused for HM moves and missing names; confirmed by reading
  the moves again.
- LEVEL: a member's level checked against a minimum.
- GRIND: wild battles with the existing battle handler until the lead
  reaches a level, bounded, healing at the step's nurse between rounds.
- CHOICE(fossil): DOME or HELIX at Mt. Moon B2F; NO unless the prompt
  reads as the wanted fossil.

Members are read through a MemberReader callable for the summary-screen
reader being built separately; until then the console steps that need it,
and the TM Case, money box and fossil prompt, stop instead of pressing.

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

# Conflicts:
#	SerialPrograms/cmake/SourceFiles.cmake
TEACH, LEVEL and GRIND stopped at every member read: the console reader
was a stub until the summary reader landed (#120's read_party_summary()).
It now opens the member's summary and gives its species, level and moves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine and others added 14 commits November 3, 2026 00:25
The console has no reader for "You want the HELIX FOSSIL?", so the step
answered NO and stopped, and 00.13 could never take a fossil. The table
walks the player to face the wanted fossil, so an unread prompt is now
taken to offer that one and answered YES; the console answers through
answer_yes_no(), which reads the box's cursor, and the scene is cleared
to the overworld as before. A prompt read as the other fossil still gets
NO.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
A grind's battles spend more PP than the lead's attacks have: it now goes
to the nurse when they run low, and the trip back counts the PP restored,
so the battle loop doesn't fall back to Tackle after the nurse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…ter RUN in a dark cave) into frlg/autostory-mart-teach-grind
…t never showed) into frlg/autostory-mart-teach-grind
…autostory-mart-teach-grind

# Conflicts:
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryEvents.cpp
…mpts out of step) into frlg/autostory-mart-teach-grind
…frlg/autostory-mart-teach-grind

# Conflicts:
#	SerialPrograms/cmake/SourceFiles.cmake
… frlg/autostory-mart-teach-grind

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

Console B, 2026-11-03: the TEACH step failed with "couldn't open tm03 from
the TM Case". ConsoleTeachActions had no readers and returned before the
bag. The TEACH step's console side becomes ScreenTeachActions over a
TeachScreens (the screen read, a press), and a fake bag, TM CASE and party
menu answer as the console's captures did: TM03 over TAIL WHIP, the bag
left on POKE BALLS, a free slot, no TM03, not compatible. The actions are
still the old stub, so the test fails with the console's message.

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

The console's TEACH step opened nothing (console B, 2026-11-03: "couldn't
open tm03 from the TM Case"). TeachScreenReader reads each screen of the
way from captures of that run: the bag's pocket and KEY ITEMS' rows, the
OPEN and USE menus, the TM CASE's moves, the party menu's messages and
YES/NO, and the KNOWN MOVES page's cursor. ScreenTeachActions looks before
every press: KEY ITEMS, TM CASE, OPEN, the TM, USE, the member, YES, the
move to forget, then B out of the TM CASE and the bag to the overworld.
The fake screens' test passes, and the 14 frames are image tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine and others added 5 commits November 3, 2026 07:51
… TM CASE

A row can teach a TM the run may not have won yet: 00.15 teaches TM03
Water Pulse, which only Misty gives. open_item() now tells a TM CASE
whose list was read without the TM (NOT_IN_CASE) from a bag or case that
didn't open (FAILED); NOT_IN_CASE ends the step NO_ITEM, logged in
orange and a success.

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

GrindPlan takes a trainer (variant "beat=TRAINER_... chance=70"): the
step then grinds until the battle sim's win chance against that trainer
reaches min_chance (MIN_WIN_CHANCE, 70%), checked before the first
battle and after each, with the member just read, healed, and the bag's
Potions. Its level is then a cap: reached short of the chance, the step
stops LEVEL_CAP with the level, the chance and the trainer in its
message; the encounter cap still holds. The summary's stats now come
with MemberInfo, and on the console the member read becomes the story's
lead (lead_as_read()), so the boss's own check plays the same one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
On console B (run m53) GRIND paced all 200 steps while "Wild RATTATA
appeared!" waited for A: the battle's flash was missed and the D-pad
does nothing in a battle. Pacing now also checks for the battle screen
after each step, and before giving up checks the overworld once more,
logging and saving a debug image if it doesn't show. GRIND and CAPTURE
share the pacing loop through a PatchSteps seam, tested with a fake patch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
On console B (run m53) the teach worked but the step failed with "the
moves page didn't answer": after A on the move to forget, the "Poof!",
"forgot" and "learned" texts read as "other" and nothing was pressed.
After the pick, B now pages through unplaced screens until the TM CASE
(or the bag) shows; if neither does, the moves read afterwards decide.
Every TEACH failure saves a debug image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…n't name) into frlg/autostory-mart-teach-grind

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

dayfine commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #215 (FRLG stack consolidated into stage PRs; will be resplit for upstream).

@dayfine dayfine closed this Nov 3, 2026
@dayfine
dayfine deleted the frlg/autostory-mart-teach-grind branch November 13, 2026 03:26
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