Skip to content

FRLG Gift RNG: make the attempts callable - #189

Draft
dayfine wants to merge 3 commits into
mainfrom
frlg/gift-rng-callable-steps
Draft

dayfine wants to merge 3 commits into
mainfrom
frlg/gift-rng-callable-steps

Conversation

@dayfine

@dayfine dayfine commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Base: main; independent of #183 and AutoStory. The diff shows only this change.

Moves Gift RNG's reset, calibrate and attempt loop out of GiftRng::program into a GiftRngAttempts class, so AutoStory can later run Gift RNG for the Magikarp salesman inside its own program, as #183 did for Starter RNG.

  • GiftRngAttempts::run() returns a GiftRngResult (outcome + target Pokemon). Settings, displays, notifications and stats are passed in as GiftRngTarget/Settings/Displays/Notifications/Stats, shaped like FRLG: make Starter RNG's attempts and SID Helper's steps callable #183's Starter structs, with the same on_reset, identify_shiny and max_resets hooks (plus max_rare_candies, read per attempt as before).
  • GiftRng::program is now a thin wrapper. Presses, timings, logs, stats names and notifications are unchanged; "5 failed searches" still throws from the program, as FRLG: make Starter RNG's attempts and SID Helper's steps callable #183 does.
  • New: identify_shiny (off in Gift RNG) reads a shiny gift's summary and tells whether it hit the target; gift_shiny_outcome() is that check. Names are Gift-specific so they don't clash with FRLG: make Starter RNG's attempts and SID Helper's steps callable #183's identify_shiny when both land.
  • Changed: the per-target base stats/gender/level switch is now gift_rng_species(), one return per case, to fit the 50-line function limit; the values are the same and the tests pin each one.
  • Moved: the loop body, split into finished, reset_game, check_shiny_gift and run_attempt. Locals became members (m_calibrations, m_target.seed, m_settings.language, ...), so most of it is moved with renames; about 75 of the 253 removed lines show as moved. Compare with git diff --color-moved=dimmed-zebra --color-moved-ws=allow-indentation-change main...frlg/gift-rng-callable-steps.

Testing

  • New PokemonFRLG::GiftRngAttempts suite: species values per target, and shiny outcome on/off target.
  • Syntax-checked the changed .cpp files with clang and -Wmissing-designated-field-initializers; code health: 0 failures. Mac, Windows Clang and Ubuntu CI dispatched on the branch.
  • Not run on the Switch.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E

Move GiftRng::program's reset, calibrate and attempt loop into a
GiftRngAttempts class whose run() returns the outcome, so another
program (AutoStory) can run Gift RNG with its own options and displays.
GiftRng::program builds it from its options and keeps its behaviour.
The per-target base stats move into gift_rng_species(), tested along
with the shiny outcome.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine and others added 2 commits November 3, 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
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