From eadd09bebd756a801ebcdc5b5246e7f1e72bb9b8 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Sun, 25 Jul 2021 07:39:02 -0600 Subject: [PATCH] block item use under embargo --- src/battle_ai_switch_items.c | 3 +++ src/party_menu.c | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 565c0f261c..e8e3999357 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -795,6 +795,9 @@ static bool8 ShouldUseItem(void) if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT) return FALSE; + + if (gStatuses3[gActiveBattler] & STATUS3_EMBARGO) + return FALSE; if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) party = gPlayerParty; diff --git a/src/party_menu.c b/src/party_menu.c index 76ee8073f4..7712305ef2 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -4313,7 +4313,13 @@ static bool8 IsItemFlute(u16 item) static bool8 ExecuteTableBasedItemEffect_(u8 partyMonIndex, u16 item, u8 monMoveIndex) { if (gMain.inBattle) - return ExecuteTableBasedItemEffect(&gPlayerParty[partyMonIndex], item, GetPartyIdFromBattleSlot(partyMonIndex), monMoveIndex); + { + if ((partyMonIndex == 0 && gStatuses3[B_POSITION_PLAYER_LEFT] & STATUS3_EMBARGO) + || (partyMonIndex == 1 && gStatuses3[B_POSITION_PLAYER_RIGHT] & STATUS3_EMBARGO)) + return TRUE; // cannot use on this mon + else + return ExecuteTableBasedItemEffect(&gPlayerParty[partyMonIndex], item, GetPartyIdFromBattleSlot(partyMonIndex), monMoveIndex); + } else return ExecuteTableBasedItemEffect(&gPlayerParty[partyMonIndex], item, partyMonIndex, monMoveIndex); }