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

Reusable TMs #2903

Merged
merged 6 commits into from
Apr 18, 2023
Merged

Conversation

Bassoonian
Copy link
Collaborator

A quick and straightforward way to make TMs reusable by assigning them an importance value of 1. Any TM that does not have this importance value functions as expected. Item removal after teaching a move is no longer based on item ID but rather on importance now. A gen-based config has been added for easy toggling for now, but perhaps a plain TRUE/FALSE config would be more straightforward to use.

This PR does NOT include retaining PP of the older move when a new one is taught, as is the case in the official games. This mechanic would also affect the move relearner if it can be accessed from the party menu and should perhaps evaluate a different config.

Discord contact info

Jasper#5206

@LOuroboros
Copy link
Collaborator

LOuroboros commented Apr 12, 2023

This PR does NOT include retaining PP of the older move when a new one is taught

You could include it though. There kind of isn't a reason not to, it's quick and it'd save the trouble of having to submit it in a separate PR, not to mention it's obviously related to the action of making TMs reusable.
EDIT: Forgot to add that TMs only started to restore PP after Gen. 5 or 6 iirc, so providing the option to make TMs not restore PP would be in accorance to certain generations of mainline games.

In include/config/item.h

#define I_TMS_RESTORE_PP          TRUE  // If TRUE, TMs will teach a move at full PP.

In src/party_menu.c, I think modifying Task_PartyMenuReplaceMove like this would be good enough, and makes the function more readable too imo.

 static void Task_PartyMenuReplaceMove(u8 taskId)
 {
     struct Pokemon *mon = &gPlayerParty[gPartyMenu.slotId];
     u16 move = gPartyMenu.data1;
     u8 oldPP = GetMonData(mon, MON_DATA_PP1 + GetMoveSlotToReplace(), NULL);
 
     if (IsPartyMenuTextPrinterActive() != TRUE)
     {
         RemoveMonPPBonus(mon, GetMoveSlotToReplace());
         SetMonMoveSlot(mon, move, GetMoveSlotToReplace());
     #if I_TMS_RESTORE_PP == TRUE
         if (GetMonData(mon, MON_DATA_PP1 + GetMoveSlotToReplace(), NULL) > oldPP)
             SetMonData(mon, MON_DATA_PP1 + GetMoveSlotToReplace(), &oldPP);
     #endif
         Task_LearnedMove(taskId);
     }
 }

@Bassoonian
Copy link
Collaborator Author

Ready for re-review. Doesn't include the PP restoration thing because tasks and my lack of expertise in regards to them.

include/config/item.h Outdated Show resolved Hide resolved
Co-authored-by: Eduardo Quezada D'Ottone <eduardo602002@gmail.com>
@AsparagusEduardo AsparagusEduardo merged commit d5b36c7 into rh-hideout:upcoming Apr 18, 2023
@AsparagusEduardo AsparagusEduardo mentioned this pull request May 31, 2023
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