Skip to content

PokemonFRLG: battle move choice - #1889

Open
thewhitewolfking wants to merge 1 commit into
PokemonAutomation:mainfrom
thewhitewolfking:frlg-move-choice
Open

thewhitewolfking wants to merge 1 commit into
PokemonAutomation:mainfrom
thewhitewolfking:frlg-move-choice

Conversation

@thewhitewolfking

Copy link
Copy Markdown
Contributor

Second split-up piece of #1887: choosing and using moves in battle. Nothing uses it yet (EXP Farmer will). Needs the data in PokemonAutomation/Packages#93.

  • Resources/PokemonFRLG_BattleData: loads BattleMoves.json, BattleSpecies.json and BaseStats.json; Gen 3 type chart. Uses Pokemon::PokemonType.
  • Inference/PokemonFRLG_BattleMoveReader: reads the FIGHT move list with per-language Gen 3 move names (BattleMovesOCR.json), and the species, name and level in the player's HP box.
  • Programs/PokemonFRLG_BattleMoveChoice: scores moves (power, accuracy, multi-hit, STAB, type chart, Levitate/Flash Fire/Water Absorb/Volt Absorb/Wonder Guard, base stats), and from the battle menu uses the best one. It handles moves out of PP, moves that can't be used right now, Grudge, and target confirmation in double battles.

Language changes from #1887: no English text is read anymore. A move that can't be used is detected by the message waiting for a button right after the move is chosen. (Before, it read "disabled" in English.) That detection isn't tested on hardware yet.

Still to do in a later PR: the rest of the battle loop (yes/no prompts, level tracking, Grudge message, end of battle) still reads English text in #1887. Open to suggestions on how you'd like that handled.

logger.log("Battling Pokemon's level: " + std::to_string(level));
return level;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests for new inference

ImageViewRGB32 game_screen = extract_box_reference(frame, GameSettings::instance().GAME_BOX);
ImageViewRGB32 box = extract_box_reference(game_screen, m_own_level_box);

// "Lv" and digits, the same in every language: read as English.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all languages use Lv, make sure it works with/accounts for misreads in other languages.

screenshot-20260312-110218544963

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.

3 participants