Fix consumable item form change
This commit is contained in:
parent
07af84db8a
commit
f49da96f1d
3 changed files with 18 additions and 4 deletions
|
@ -60,6 +60,7 @@ void ItemUseCB_RareCandy(u8 taskId, TaskFunc task);
|
|||
void ItemUseCB_SacredAsh(u8 taskId, TaskFunc task);
|
||||
void ItemUseCB_EvolutionStone(u8 taskId, TaskFunc task);
|
||||
void ItemUseCB_FormChange(u8 taskId, TaskFunc task);
|
||||
void ItemUseCB_FormChange_ConsumedOnUse(u8 taskId, TaskFunc task);
|
||||
u8 GetItemEffectType(u16 item);
|
||||
void CB2_PartyMenuFromStartMenu(void);
|
||||
void CB2_ChooseMonToGiveItem(void);
|
||||
|
|
|
@ -1127,7 +1127,7 @@ void ItemUseOutOfBattle_FormChange(u8 taskId)
|
|||
|
||||
void ItemUseOutOfBattle_FormChange_ConsumedOnUse(u8 taskId)
|
||||
{
|
||||
gItemUseCB = ItemUseCB_FormChange;
|
||||
gItemUseCB = ItemUseCB_FormChange_ConsumedOnUse;
|
||||
gTasks[taskId].data[0] = TRUE;
|
||||
SetUpItemUseCallback(taskId);
|
||||
}
|
||||
|
|
|
@ -5167,7 +5167,7 @@ void ItemUseCB_EvolutionStone(u8 taskId, TaskFunc task)
|
|||
}
|
||||
}
|
||||
|
||||
void ItemUseCB_FormChange(u8 taskId, TaskFunc task)
|
||||
bool32 TryItemUseFormChange(u8 taskId, TaskFunc task)
|
||||
{
|
||||
struct Pokemon *mon = &gPlayerParty[gPartyMenu.slotId];
|
||||
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||
|
@ -5184,10 +5184,9 @@ void ItemUseCB_FormChange(u8 taskId, TaskFunc task)
|
|||
GetMonNickname(mon, gStringVar1);
|
||||
StringExpandPlaceholders(gStringVar4, ChangedForm);
|
||||
DisplayPartyMenuMessage(gStringVar4, FALSE);
|
||||
if (gTasks[taskId].data[0] == TRUE)
|
||||
RemoveBagItem(gSpecialVar_ItemId, 1);
|
||||
ScheduleBgCopyTilemapToVram(2);
|
||||
gTasks[taskId].func = task;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5196,6 +5195,20 @@ void ItemUseCB_FormChange(u8 taskId, TaskFunc task)
|
|||
DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE);
|
||||
ScheduleBgCopyTilemapToVram(2);
|
||||
gTasks[taskId].func = task;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void ItemUseCB_FormChange(u8 taskId, TaskFunc task)
|
||||
{
|
||||
TryItemUseFormChange(taskId, task);
|
||||
}
|
||||
|
||||
void ItemUseCB_FormChange_ConsumedOnUse(u8 taskId, TaskFunc task)
|
||||
{
|
||||
if (TryItemUseFormChange(taskId, task))
|
||||
{
|
||||
RemoveBagItem(gSpecialVar_ItemId, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue