summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorghoulslash <41651341+ghoulslash@users.noreply.github.com>2021-09-19 18:42:07 -0600
committerghoulslash <41651341+ghoulslash@users.noreply.github.com>2021-09-19 18:42:07 -0600
commit9abb1cdf4d3439e78edaed0a06968af84e2e1969 (patch)
tree4192a997801c1c1d3596dbfd812ce260745d777c
parent60139b87450ecc15c47314224cd8e33357885606 (diff)
Updated Repeated Field Medicine Use (markdown)
-rw-r--r--Repeated-Field-Medicine-Use.md41
1 files changed, 30 insertions, 11 deletions
diff --git a/Repeated-Field-Medicine-Use.md b/Repeated-Field-Medicine-Use.md
index ac50049..aa6286a 100644
--- a/Repeated-Field-Medicine-Use.md
+++ b/Repeated-Field-Medicine-Use.md
@@ -98,20 +98,39 @@ Finally, find `Task_DisplayHPRestoredMessage`. Replace `gTasks[taskId].func = Ta
## Addendum: Rare Candies
-Credit: AsparagusEduardo
+Credit: AsparagusEduardo, ghoulslash
-You may also want to use this for Rare Candies, so all you have to do is find `PartyMenuTryEvolution` and replace `gTasks[taskId].func = Task_ClosePartyMenuAfterText;` with:
+You may also want to use this for Rare Candies, so all you have to do is find `PartyMenuTryEvolution` and replace it with:
```c
- if (gPartyMenu.menuType == PARTY_MENU_TYPE_FIELD && CheckBagHasItem(gSpecialVar_ItemId, 1))
- gTasks[taskId].func = Task_ReturnToChooseMonAfterText;
+static void PartyMenuTryEvolution(u8 taskId)
+{
+ struct Pokemon *mon = &gPlayerParty[gPartyMenu.slotId];
+ u16 targetSpecies = GetEvolutionTargetSpecies(mon, 0, 0);
+
+ if (targetSpecies != SPECIES_NONE)
+ {
+ FreePartyPointers();
+ if (gSpecialVar_ItemId == ITEM_RARE_CANDY && gPartyMenu.menuType == PARTY_MENU_TYPE_FIELD && CheckBagHasItem(gSpecialVar_ItemId, 1))
+ gCB2_AfterEvolution = CB2_ReturnToPartyMenuUsingRareCandy;
+ else
+ gCB2_AfterEvolution = gPartyMenu.exitCallback;
+ BeginEvolutionScene(mon, targetSpecies, 1, gPartyMenu.slotId);
+ DestroyTask(taskId);
+ }
else
- gTasks[taskId].func = Task_ClosePartyMenuAfterText;
+ {
+ if (gPartyMenu.menuType == PARTY_MENU_TYPE_FIELD && CheckBagHasItem(gSpecialVar_ItemId, 1))
+ gTasks[taskId].func = Task_ReturnToChooseMonAfterText;
+ else
+ gTasks[taskId].func = Task_ClosePartyMenuAfterText;
+ }
+}
```
-
-And finally, when using a Rare Candy on a Level 100 Pokémon it would normally go back to the Bag menu. To avoid that, we search for `ItemUseCB_RareCandy` and replace `gTasks[taskId].func = task;` with:
+And add the function, `CB2_ReturnToPartyMenuUsingRareCandy`, somewhere in the file:
```c
- if (gPartyMenu.menuType == PARTY_MENU_TYPE_FIELD)
- gTasks[taskId].func = Task_ReturnToChooseMonAfterText;
- else
- gTasks[taskId].func = task;
+static void CB2_ReturnToPartyMenuUsingRareCandy(void)
+{
+ gItemUseCB = ItemUseCB_RareCandy;
+ SetMainCallback2(CB2_ShowPartyMenuForItemUse);
+}
``` \ No newline at end of file