diff --git a/src/battle_interface.c b/src/battle_interface.c index 828b57a2f..b233627d8 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -729,6 +729,12 @@ u8 GetMegaIndicatorSpriteId(u32 healthboxSpriteId) return gSprites[spriteId].hOther_IndicatorSpriteId; } +static void InitLastUsedBallAssets(void) +{ + gBattleStruct->ballSpriteIds[0] = MAX_SPRITES; + gBattleStruct->ballSpriteIds[1] = MAX_SPRITES; +} + u8 CreateBattlerHealthboxSprites(u8 battlerId) { s16 data6 = 0; @@ -3195,6 +3201,14 @@ bool32 CanThrowLastUsedBall(void) void TryAddLastUsedBallItemSprites(void) { + if (gSaveBlock2Ptr->lastUsedBall != ITEM_NONE && !CheckBagHasItem(gSaveBlock2Ptr->lastUsedBall, 1)) + { + // we're out of the last used ball, so just set it to the first ball in the bag + // we have to compact the bag first bc it is typically only compacted when you open it + CompactItemsInBagPocket(&gBagPockets[BALLS_POCKET]); + gSaveBlock2Ptr->lastUsedBall = gBagPockets[BALLS_POCKET].itemSlots[0].itemId; + } + if (CanThrowBall() != 0 || (gBattleTypeFlags & BATTLE_TYPE_TRAINER) || !CheckBagHasItem(gSaveBlock2Ptr->lastUsedBall, 1))