Fixed evolutions that use held items to evolve not working when using Rare Candies. (#2565)

This commit is contained in:
Eduardo Quezada D'Ottone 2023-02-19 06:40:55 -03:00 committed by GitHub
parent 79ea2e8074
commit fcf13aab2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5165,7 +5165,6 @@ void ItemUseCB_RareCandy(u8 taskId, TaskFunc task)
u16 *itemPtr = &gSpecialVar_ItemId;
bool8 cannotUseEffect;
u8 holdEffectParam = ItemId_GetHoldEffectParam(*itemPtr);
u16 targetSpecies = GetEvolutionTargetSpecies(mon, EVO_MODE_NORMAL, ITEM_NONE, NULL);
sInitialLevel = GetMonData(mon, MON_DATA_LEVEL);
if (sInitialLevel != MAX_LEVEL)
@ -5181,10 +5180,22 @@ void ItemUseCB_RareCandy(u8 taskId, TaskFunc task)
PlaySE(SE_SELECT);
if (cannotUseEffect)
{
if (targetSpecies != SPECIES_NONE && holdEffectParam == 0)
u16 targetSpecies = SPECIES_NONE;
// Resets values to 0 so other means of teaching moves doesn't overwrite levels
sInitialLevel = 0;
sFinalLevel = 0;
if (holdEffectParam == 0)
targetSpecies = GetEvolutionTargetSpecies(mon, EVO_MODE_NORMAL, ITEM_NONE, NULL);
if (targetSpecies != SPECIES_NONE)
{
PartyMenuTryEvolution(taskId);
RemoveBagItem(gSpecialVar_ItemId, 1);
FreePartyPointers();
gCB2_AfterEvolution = gPartyMenu.exitCallback;
BeginEvolutionScene(mon, targetSpecies, TRUE, gPartyMenu.slotId);
DestroyTask(taskId);
}
else
{