Skip to content

Support duplicate moves in moveset by preserving move slot selection in UpdateMoveData#1308

Draft
Copilot wants to merge 6 commits intomasterfrom
copilot/rework-update-move-data
Draft

Support duplicate moves in moveset by preserving move slot selection in UpdateMoveData#1308
Copilot wants to merge 6 commits intomasterfrom
copilot/rework-update-move-data

Conversation

Copy link
Contributor

Copilot AI commented Dec 9, 2025

  • Understand the current UpdateMoveData implementation and the issue
  • Analyze how wCurEnemyMoveNum is used throughout the battle engine
  • Modify UpdateMoveData to preserve wCurEnemyMoveNum when it already points to the correct move
  • Build the ROM successfully
  • Add documentation comments
  • Fix code style issues
  • Run final code review
  • Fix register clobbering bug (use d instead of b to avoid pop bc overwriting)
  • Simplify code per review feedback - remove unnecessary push/pop operations and verbose comments
  • Complete implementation

Summary

Successfully reworked UpdateMoveData to support multiple instances of the same move on a moveset. Simplified the implementation per code review feedback by:

  • Removing verbose comments about Lance's Dragonite
  • Eliminating unnecessary push/pop operations
  • Using de register pair efficiently for offset calculation
  • Loading move number directly from wCurMoveNum/wCurEnemyMoveNum without extra stack operations
Original prompt

This section details on the original issue you should resolve

<issue_title>Rework UpdateMoveData to support multiple instances of same move on a moveset</issue_title>
<issue_description>"If the wCurEnemyMoveNum reset can also be cleanly fixed, it would be neat to have engine support for duplicate moves "just in case". (Lance's fourth Dragonite, now with Barrier and two Hyper Beams.)" - Sylvie

Separating this from #1039 as that was a bug to be patched by 3.2.0, whereas this refactor can be saved for a future release.</issue_description>

<agent_instructions>Related to #1039</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Dec 9, 2025
Copilot AI and others added 3 commits December 9, 2025 14:36
Co-authored-by: vulcandth <6394873+vulcandth@users.noreply.github.com>
Co-authored-by: vulcandth <6394873+vulcandth@users.noreply.github.com>
Co-authored-by: vulcandth <6394873+vulcandth@users.noreply.github.com>
Copilot AI changed the title [WIP] Rework UpdateMoveData for multiple instances of moves Support duplicate moves in moveset by preserving move slot selection in UpdateMoveData Dec 9, 2025
Copilot AI requested a review from vulcandth December 9, 2025 14:45
Co-authored-by: vulcandth <6394873+vulcandth@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 9, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Copy link
Owner

Choose a reason for hiding this comment

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

Was this fail-safe change motivated by anything in particular? E.g. link battles where someone has hacked duplicate-move mons?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change enables proper support for Pokémon with duplicate moves in their moveset (e.g., from data edits or potential future features). Previously, UpdateMoveData would always reset the move number to the first occurrence, breaking PP tracking when multiple instances of the same move exist. The fail-safe behavior (checking if the current move number is already valid) ensures compatibility in cases where duplicate moves might occur, whether intentionally or through edge cases.

@vulcandth
Copy link
Collaborator

@copilot Address Rangi42's feedback.

Co-authored-by: vulcandth <6394873+vulcandth@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 14, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

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.

Rework UpdateMoveData to support multiple instances of same move on a moveset

3 participants