Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Egg Move Refactor #4534

Merged
merged 2 commits into from
May 19, 2024
Merged

Conversation

Bassoonian
Copy link
Collaborator

Supersedes #4488 with a clean git history and a migration script

Description

Refactors Egg moves so they're not a giant array with weird offsets anymore but rather structured lists like the teachable learnsets. All functionality is otherwise kept as similar to the original as possible, so this should not cause any real issues with feature branches.

egg_moves.h as well as the gBaseStats files are exactly as they would be when running the migration script on the current version of upcoming.

Issue(s) that this PR fixes

Fixes #3653

Discord contact info

bassoonian

Copy link
Collaborator

@AlexOn1ine AlexOn1ine left a comment

Choose a reason for hiding this comment

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

Tried running the script in my repo and got this:

egg_move_refactor.py:18: SyntaxWarning: invalid escape sequence '\('
  for mon in re.findall("egg_moves\((.*),", data):
egg_move_refactor.py:26: SyntaxWarning: invalid escape sequence '\('
  data = re.sub("    egg_moves\(%s," % mon, "static const u16 s%sEggMoveLearnset[] = {" % monname, data)
egg_move_refactor.py:28: SyntaxWarning: invalid escape sequence '\)'
  data = re.sub("\),\n", ",\n        MOVE_UNAVAILABLE,\n};\n", data) # add terminator to each old macro
egg_move_refactor.py:42: SyntaxWarning: invalid escape sequence '\.'
  data = re.sub("\.teachableLearnset = s%sTeachableLearnset,\n" % mon, ".teachableLearnset = s%sTeachableLearnset,\n        .eggMoveLearnset = s%sEggMoveLearnset,\n" % (mon, mon), data)
egg_move_refactor.py:44: SyntaxWarning: invalid escape sequence '\.'
  macrocheck = re.findall("\.teachableLearnset = s%sTeachableLearnset,( *)\\\\" % mon, data)
egg_move_refactor.py:46: SyntaxWarning: invalid escape sequence '\.'
  data = re.sub("\.teachableLearnset = s%sTeachableLearnset,%s\\\\" % (mon, macrocheck[0]), ".teachableLearnset = s%sTeachableLearnset,%s\\\\\n        .eggMoveLearnset = s%sEggMoveLearnset,%s\\\\" % (mon, macrocheck[0], mon, " " * (len(macrocheck[0]) + 4)), data)

Edit: it seems like the script did it's thing though

src/data/pokemon/egg_moves.h Outdated Show resolved Hide resolved
@Bassoonian
Copy link
Collaborator Author

Bassoonian commented May 19, 2024

Tried running the script in my repo and got this:

egg_move_refactor.py:18: SyntaxWarning: invalid escape sequence '\('
  for mon in re.findall("egg_moves\((.*),", data):
egg_move_refactor.py:26: SyntaxWarning: invalid escape sequence '\('
  data = re.sub("    egg_moves\(%s," % mon, "static const u16 s%sEggMoveLearnset[] = {" % monname, data)
egg_move_refactor.py:28: SyntaxWarning: invalid escape sequence '\)'
  data = re.sub("\),\n", ",\n        MOVE_UNAVAILABLE,\n};\n", data) # add terminator to each old macro
egg_move_refactor.py:42: SyntaxWarning: invalid escape sequence '\.'
  data = re.sub("\.teachableLearnset = s%sTeachableLearnset,\n" % mon, ".teachableLearnset = s%sTeachableLearnset,\n        .eggMoveLearnset = s%sEggMoveLearnset,\n" % (mon, mon), data)
egg_move_refactor.py:44: SyntaxWarning: invalid escape sequence '\.'
  macrocheck = re.findall("\.teachableLearnset = s%sTeachableLearnset,( *)\\\\" % mon, data)
egg_move_refactor.py:46: SyntaxWarning: invalid escape sequence '\.'
  data = re.sub("\.teachableLearnset = s%sTeachableLearnset,%s\\\\" % (mon, macrocheck[0]), ".teachableLearnset = s%sTeachableLearnset,%s\\\\\n        .eggMoveLearnset = s%sEggMoveLearnset,%s\\\\" % (mon, macrocheck[0], mon, " " * (len(macrocheck[0]) + 4)), data)

Edit: it seems like the script did it's thing though

Ah, this is me not making it raw strings again. I'll try to fix it

@AlexOn1ine AlexOn1ine merged commit bc9f097 into rh-hideout:upcoming May 19, 2024
1 check passed
@Bassoonian Bassoonian deleted the eggmovesrefactor branch July 27, 2024 19:17
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.

2 participants