Fixed evolutions that use held items to evolve not working when using Rare Candies. (#2565)
This commit is contained in:
parent
79ea2e8074
commit
fcf13aab2b
1 changed files with 14 additions and 3 deletions
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue