Skip to content

Max Lair: read a single-type Normal opponent in the summary - #288

Closed
dayfine wants to merge 9 commits into
mainfrom
upstream/swsh-maxlair-type-dupe
Closed

dayfine wants to merge 9 commits into
mainfrom
upstream/swsh-maxlair-type-dupe

Conversation

@dayfine

@dayfine dayfine commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Base main; no parent PRs; the diff shows only this change. Written upstream-style so it can be handed to PokemonAutomation/Arduino-Source later.

Max Lair's summary read returned nothing for single-type Normal opponents (e.g. Persian), because the "O" of the summary's "NORMAL" type label also matches the Normal icon; a repeated type is now read as one type.

  • Found from a maintainer's log and 4K screenshot on [Max Lair] Don't use a non-boss as boss in State PokemonAutomation/Arduino-Source#1851 (comment): Type Read Result: normal : 0.0757804 / normal : 0.367816, then an empty opponent read.
  • Cause: the type box holds the "(O) NORMAL" badge. The letter "O" is a separate white ring that matches the Normal icon sprite (0.368 vs 0.076 for the real icon). find_type_symbols() drops only overlapping matches, so the reader took Normal/Normal, which matches no Max Lair Pokemon.
  • Fix: in read_opponent_in_summary(), the two-best-types pick moves into a small summary_types() helper that sets the second type to NONE when it equals the first (no Pokemon has the same type twice). The helper keeps the function under the code-health length limit.
  • New image test PokemonSwSh::MaxLairSummaryOpponentReader runs BattleMenuReader::read_opponent_in_summary() (English) on the screenshot and expects {"persian"}.

Test image (needs a CommandLineTests PR): the test reads PokemonSwSh/MaxLair_SummaryOpponentReader/English_Persian.jpg from the CommandLineTests repo (3840x2160 JPEG, sha1 ce1b524a9fd748afd1c6f01d7f7363ec1c5444e2). The image is the maintainer's screenshot from PokemonAutomation#1851, so we would ask him before adding it to CommandLineTests. Until then the test fails with FileException in CI.

Testing

Headless runner (scratch merge of upstream/headless-tests, not pushed), macOS, SerialProgramsTests --filter MaxLair, image placed locally under build/CommandLineTests/:

  • Red (test commit only): Type Read Result: normal : 0.0777026 / normal : 0.36567, then FAILED: PokemonSwSh::MaxLairSummaryOpponentReader - ... English_Persian.jpg, Message: Read: (nothing).
  • Green (with the fix): same type read, then Disambiguation succeeded: persian and PASSED: PokemonSwSh::MaxLairSummaryOpponentReader - ... English_Persian.jpg.
  • The 10 MaxLairBossState tests pass in both runs. MaxLairBattleMenuDetector fails in both with FileException only because its CommandLineTests image was not checked out locally.

🤖 Generated with Claude Code

https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss

dayfine and others added 7 commits November 8, 2026 20:51
Runs BattleMenuReader::read_opponent_in_summary() on a 4K summary
screenshot of Persian and expects {"persian"}. The image goes in the
CommandLineTests repo at
PokemonSwSh/MaxLair_SummaryOpponentReader/English_Persian.jpg.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
The summary's type box holds the type badge, e.g. "(O) NORMAL". The
letter "O" of the "NORMAL" label is a separate white ring that matches
the Normal icon (Persian: 0.368, next to 0.076 for the real icon), and
find_type_symbols() drops only overlapping matches. A single-type Normal
Pokemon was read as Normal/Normal, matched nothing, and the summary read
returned empty. No Pokemon has the same type twice, so treat a repeated
type as one type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
dayfine and others added 2 commits November 10, 2026 07:01
@dayfine

dayfine commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Merged upstream as PokemonAutomation#1882 (in main as 9f19ad7); the diff against main is empty, so closing.

@dayfine dayfine closed this Nov 12, 2026
@dayfine
dayfine deleted the upstream/swsh-maxlair-type-dupe branch November 13, 2026 05:44
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