From 056f801a8fddadc9c4cbb0551e0eb48531aed32c Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 26 Sep 2024 14:08:57 -0400 Subject: [PATCH] fix duplicating flute glitch --- include/party_menu.h | 1 + src/battle_controller_player.c | 4 ++-- src/party_menu.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/party_menu.h b/include/party_menu.h index a34f06cec6bb..abea29b6bbbe 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -102,5 +102,6 @@ void MoveDeleterForgetMove(void); void BufferMoveDeleterNicknameAndMove(void); void GetNumMovesSelectedMonHas(void); void MoveDeleterChooseMoveToForget(void); +bool32 IsItemFlute(u16 item); #endif // GUARD_PARTY_MENU_H diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index bcdab75081b9..8907d9473374 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -387,8 +387,8 @@ static void HandleInputChooseAction(u32 battler) && !(gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(B_POSITION_PLAYER_LEFT)]) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) { - // Return item to bag if partner had selected one. - if (gBattleResources->bufferA[battler][1] == B_ACTION_USE_ITEM) + // Return item to bag if partner had selected one (except flutes). + if (gBattleResources->bufferA[battler][1] == B_ACTION_USE_ITEM && !IsItemFlute(itemId)) { AddBagItem(itemId, 1); } diff --git a/src/party_menu.c b/src/party_menu.c index 32ccd6ca19f2..3fef46580408 100644 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -4578,7 +4578,7 @@ static bool8 NotUsingHPEVItemOnShedinja(struct Pokemon *mon, u16 item) return TRUE; } -static bool8 IsItemFlute(u16 item) +bool32 IsItemFlute(u16 item) { if (item == ITEM_BLUE_FLUTE || item == ITEM_RED_FLUTE || item == ITEM_YELLOW_FLUTE) return TRUE;