40Cakes / pokebot-gen3

PokéBot Gen3 is a shiny hunting bot, written in Python that runs libmgba + mGBA Python bindings under the hood. Pokémon Ruby, Sapphire, Emerald, FireRed and LeafGreen are supported.
https://www.youtube.com/@40_Cakes/streams
GNU General Public License v3.0
178 stars 54 forks source link

Add RS Roamers #328

Closed mechandtech closed 4 months ago

mechandtech commented 4 months ago

Description

Adds Ruby and Sapphire functionality to Roamer Reset Mode. ### Changes Adds run_rs() action to roamer_reset.py; adds appropriate symbols to fly_to() in higher_level_actions.py ### Notes Still needs a way to disable the mode should it be selected outside the appropriate conditions. This pull request is mainly so that the change is there and can be accessed by the original repository's contributors. Since creation, however, the process has run without issue. ### Checklist
pekempy commented 4 months ago

@mechandtech please run Black linter using the argument in the Checklist and upload the files that are changed :)

hanzi commented 4 months ago

Hi, thank you for your contribution! There are a few issues with that mode though:

  1. When playing a female character, this mode tries to walk to the wrong location: It tries to access 7/5 in the player's house, but the location in front of the TV is actually 6/5. So it just gets stuck.
    image
  2. In your code you state that 'RS changes roamer location per building entry and does not seem to care about recent maps visited.'
    That appers to be not correct: After benchmarking both options for 8 hours, I get a better encounter rate (about +33%) when running into the Contest building in Slateport instead of the cycling road entrance. As far as I can tell, the game's code in handling roamers and map transitions is the same between R/S and Emerald. It's not that the Roamer can't appear on the same map as the player has been 2 map transitions before -- it's just a lot less likely.
  3. Like pekempy said, the Black linter (a tool that checks that your code matches all of the code style guidelines) isn't quite happy with your code.
    You can run the linter yourself and get some information about what actually bothers it by following these steps:

    1. Open a command line in the bot directory (in Windows, you can do that by opening the bot's directory in the file explorer and then Shift+Right Click into some empty space. The context menu should give you some option like 'Open Command here' or 'Open PowerShell here' or something along those lines, don't quite remember.)
    2. The first time you do this, run pip install black to install the linter.
    3. Now you can run python -m black --diff --color --line-length=120 to get a preview of what it would like you to change.
    4. You can either change it manually and run step 3 again, or you can run python -m black --line-length=120 for it to change the affected files automatically.
mechandtech commented 4 months ago

Thank you so much for your feedback (and correction of my mistake with the start location in May's house). I have implemented the changes that were required (formatting) and recommended (running to the contest hall). As far as the formatting is concerned, this is my first time using GitHub in a collaborative manner, so I will keep the need to format this code in mind for any future contributions, to this repository or others that may require it.

I still have yet to develop the flag for disabling use outside of the appropriate window; I will add that soon (and format it appropriately, of course).

hanzi commented 4 months ago

Looks good now!

You should also update the Wiki entry for the Roamer Reset mode (which you can find at wiki/pages/Mode - Roamer Resets.md) since that mode now supports R/S as well.