mirror of
https://github.com/pret/pokeemerald.git
synced 2026-05-09 04:13:03 -05:00
Fixed curing status2 with items in double battles (#6335)
Co-authored-by: Hedara <hedara90@gmail.com>
This commit is contained in:
parent
ce0491dffa
commit
766b9b00ca
|
|
@ -1171,6 +1171,15 @@ void ItemUseInBattle_PartyMenuChooseMove(u8 taskId)
|
|||
ItemUseInBattle_ShowPartyMenu(taskId);
|
||||
}
|
||||
|
||||
static bool32 SelectedMonHasStatus2(u16 itemId)
|
||||
{
|
||||
if (gPartyMenu.slotId == 0)
|
||||
return gBattleMons[0].status2 & GetItemStatus2Mask(itemId);
|
||||
else if (gBattleTypeFlags & (BATTLE_TYPE_DOUBLE | BATTLE_TYPE_MULTI) && gPartyMenu.slotId == 1)
|
||||
return gBattleMons[2].status2 & GetItemStatus2Mask(itemId);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Returns whether an item can be used in battle and sets the fail text.
|
||||
bool32 CannotUseItemsInBattle(u16 itemId, struct Pokemon *mon)
|
||||
{
|
||||
|
|
@ -1243,13 +1252,13 @@ bool32 CannotUseItemsInBattle(u16 itemId, struct Pokemon *mon)
|
|||
break;
|
||||
case EFFECT_ITEM_CURE_STATUS:
|
||||
if (!((GetMonData(mon, MON_DATA_STATUS) & GetItemStatus1Mask(itemId))
|
||||
|| (gPartyMenu.slotId == 0 && gBattleMons[gBattlerInMenuId].status2 & GetItemStatus2Mask(itemId))))
|
||||
|| SelectedMonHasStatus2(itemId)))
|
||||
cannotUse = TRUE;
|
||||
break;
|
||||
case EFFECT_ITEM_HEAL_AND_CURE_STATUS:
|
||||
if ((hp == 0 || hp == GetMonData(mon, MON_DATA_MAX_HP))
|
||||
&& !((GetMonData(mon, MON_DATA_STATUS) & GetItemStatus1Mask(itemId))
|
||||
|| (gPartyMenu.slotId == 0 && gBattleMons[gBattlerInMenuId].status2 & GetItemStatus2Mask(itemId))))
|
||||
|| SelectedMonHasStatus2(itemId)))
|
||||
cannotUse = TRUE;
|
||||
break;
|
||||
case EFFECT_ITEM_REVIVE:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user