diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 8b8d4f1e94..5452a6836d 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3863,14 +3863,14 @@ static void Cmd_tryfaintmon(void) if (gBattleResults.playerFaintCounter < 255) gBattleResults.playerFaintCounter++; AdjustFriendshipOnBattleFaint(gActiveBattler); - gSideTimers[0].retaliateTimer = 2; + gSideTimers[B_SIDE_PLAYER].retaliateTimer = 2; } else { if (gBattleResults.opponentFaintCounter < 255) gBattleResults.opponentFaintCounter++; gBattleResults.lastOpponentSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES, NULL); - gSideTimers[1].retaliateTimer = 2; + gSideTimers[B_SIDE_OPPONENT].retaliateTimer = 2; } if ((gHitMarker & HITMARKER_DESTINYBOND) && gBattleMons[gBattlerAttacker].hp != 0) { @@ -5304,7 +5304,8 @@ static bool32 TryKnockOffBattleScript(u32 battlerDef) gLastUsedItem = gBattleMons[battlerDef].item; gBattleMons[battlerDef].item = 0; - gBattleStruct->choicedMove[battlerDef] = 0; + if (gBattleMons[battlerDef].ability != ABILITY_GORILLA_TACTICS) + gBattleStruct->choicedMove[battlerDef] = 0; gWishFutureKnock.knockedOffMons[side] |= gBitTable[gBattlerPartyIndexes[battlerDef]]; CheckSetUnburden(battlerDef); diff --git a/src/battle_util.c b/src/battle_util.c index 3c4201f467..6801e6b293 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -6524,8 +6524,8 @@ bool32 CanBeFrozen(u8 battlerId) bool32 CanBeConfused(u8 battlerId) { - if (GetBattlerAbility(gEffectBattler) == ABILITY_OWN_TEMPO - || gBattleMons[gEffectBattler].status2 & STATUS2_CONFUSION + if (GetBattlerAbility(battlerId) == ABILITY_OWN_TEMPO + || gBattleMons[battlerId].status2 & STATUS2_CONFUSION || IsBattlerTerrainAffected(battlerId, STATUS_FIELD_MISTY_TERRAIN)) return FALSE; return TRUE; @@ -8172,7 +8172,7 @@ u32 GetBattlerHoldEffect(u8 battlerId, bool32 checkNegating) return gBattleStruct->debugHoldEffects[battlerId]; else #endif - if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY) + if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY_E_READER) return gEnigmaBerries[battlerId].holdEffect; else return ItemId_GetHoldEffect(gBattleMons[battlerId].item); @@ -8181,7 +8181,7 @@ u32 GetBattlerHoldEffect(u8 battlerId, bool32 checkNegating) // static u32 GetBattlerItemHoldEffectParam(u8 battlerId, u16 item) { - if (item == ITEM_ENIGMA_BERRY) + if (item == ITEM_ENIGMA_BERRY_E_READER) return gEnigmaBerries[battlerId].holdEffectParam; else return ItemId_GetHoldEffectParam(item); @@ -8189,7 +8189,7 @@ static u32 GetBattlerItemHoldEffectParam(u8 battlerId, u16 item) u32 GetBattlerHoldEffectParam(u8 battlerId) { - if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY) + if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY_E_READER) return gEnigmaBerries[battlerId].holdEffectParam; else return ItemId_GetHoldEffectParam(gBattleMons[battlerId].item); diff --git a/src/battle_z_move.c b/src/battle_z_move.c index 536080aa96..0fe777a2ba 100644 --- a/src/battle_z_move.c +++ b/src/battle_z_move.c @@ -199,7 +199,7 @@ bool32 IsViableZMove(u8 battlerId, u16 move) holdEffect = gBattleStruct->debugHoldEffects[battlerId]; else #endif - if (item == ITEM_ENIGMA_BERRY) + if (item == ITEM_ENIGMA_BERRY_E_READER) return FALSE; // HoldEffect = gEnigmaBerries[battlerId].holdEffect; else holdEffect = ItemId_GetHoldEffect(item); diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 9fdf268d6f..0f2aa1ffa4 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -8399,7 +8399,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = .accuracy = 100, .pp = 5, .secondaryEffectChance = 10, - .target = MOVE_TARGET_BOTH, + .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, diff --git a/src/data/pokemon/evolution.h b/src/data/pokemon/evolution.h index 4f09867a6c..a0e5024f5b 100644 --- a/src/data/pokemon/evolution.h +++ b/src/data/pokemon/evolution.h @@ -311,7 +311,7 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] = [SPECIES_KRICKETOT] = {{EVO_LEVEL, 10, SPECIES_KRICKETUNE}}, [SPECIES_SHINX] = {{EVO_LEVEL, 15, SPECIES_LUXIO}}, [SPECIES_LUXIO] = {{EVO_LEVEL, 30, SPECIES_LUXRAY}}, - [SPECIES_BUDEW] = {{EVO_FRIENDSHIP, 0, SPECIES_ROSELIA}}, + [SPECIES_BUDEW] = {{EVO_FRIENDSHIP_DAY, 0, SPECIES_ROSELIA}}, [SPECIES_CRANIDOS] = {{EVO_LEVEL, 30, SPECIES_RAMPARDOS}}, [SPECIES_SHIELDON] = {{EVO_LEVEL, 30, SPECIES_BASTIODON}}, [SPECIES_BURMY] = {{EVO_LEVEL_FEMALE, 20, SPECIES_WORMADAM}, diff --git a/src/debug.c b/src/debug.c index 90081eb617..759341d866 100644 --- a/src/debug.c +++ b/src/debug.c @@ -147,7 +147,7 @@ enum { //Sound #define DEBUG_NUMBER_DIGITS_VARIABLES 5 #define DEBUG_NUMBER_DIGITS_VARIABLE_VALUE 5 #define DEBUG_NUMBER_DIGITS_ITEMS 4 -#define DEBUG_NUMBER_DIGITS_ITEM_QUANTITY 2 +#define DEBUG_NUMBER_DIGITS_ITEM_QUANTITY 3 #define DEBUG_NUMBER_ICON_X 210 #define DEBUG_NUMBER_ICON_Y 50 @@ -1015,8 +1015,8 @@ static void DebugAction_Util_Warp_SelectMapGroup(u8 taskId) gTasks[taskId].data[3] = 0; gTasks[taskId].data[4] = 0; - ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); - ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1, STR_CONV_MODE_LEADING_ZEROS, 2); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, (MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1 >= 100) ? 3 : 2); + ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1, STR_CONV_MODE_LEADING_ZEROS, (MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1 >= 100) ? 3 : 2); StringExpandPlaceholders(gStringVar1, sDebugText_Util_WarpToMap_SelMax); GetMapName(gStringVar2, Overworld_GetMapHeaderByGroupAndId(gTasks[taskId].data[5], gTasks[taskId].data[3])->regionMapSectionId, 0); StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); @@ -1061,8 +1061,8 @@ static void DebugAction_Util_Warp_SelectMap(u8 taskId) gTasks[taskId].data[4] += 1; } - ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2); - ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1, STR_CONV_MODE_LEADING_ZEROS, 2); + ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, (max_value >= 100) ? 3 : 2); + ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].data[5]] - 1, STR_CONV_MODE_LEADING_ZEROS, (max_value >= 100) ? 3 : 2); StringExpandPlaceholders(gStringVar1, sDebugText_Util_WarpToMap_SelMax); GetMapName(gStringVar2, Overworld_GetMapHeaderByGroupAndId(gTasks[taskId].data[5], gTasks[taskId].data[3])->regionMapSectionId, 0); StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]); @@ -1905,15 +1905,18 @@ static void DebugAction_Give_Item_SelectId(u8 taskId) } static void DebugAction_Give_Item_SelectQuantity(u8 taskId) { + u32 itemId = gTasks[taskId].data[5]; + if (JOY_NEW(DPAD_ANY)) { PlaySE(SE_SELECT); if (JOY_NEW(DPAD_UP)) { + u32 maxCapacity = (ItemId_GetPocket(itemId) - 1 == BERRIES_POCKET) ? MAX_BERRY_CAPACITY : MAX_BAG_ITEM_CAPACITY; gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]]; - if (gTasks[taskId].data[3] >= 100) - gTasks[taskId].data[3] = 99; + if (gTasks[taskId].data[3] > maxCapacity) + gTasks[taskId].data[3] = maxCapacity; } if (JOY_NEW(DPAD_DOWN)) { @@ -1947,7 +1950,7 @@ static void DebugAction_Give_Item_SelectQuantity(u8 taskId) DestroySprite(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon PlaySE(MUS_OBTAIN_ITEM); - AddBagItem(gTasks[taskId].data[5], gTasks[taskId].data[3]); + AddBagItem(itemId, gTasks[taskId].data[3]); DebugAction_DestroyExtraWindow(taskId); } else if (JOY_NEW(B_BUTTON)) diff --git a/src/pokemon.c b/src/pokemon.c index 71dcb5bcbc..afb6e90278 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6543,7 +6543,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem, s partnerSpecies = GetMonData(tradePartner, MON_DATA_SPECIES, 0); partnerHeldItem = GetMonData(tradePartner, MON_DATA_HELD_ITEM, 0); - if (partnerHeldItem == ITEM_ENIGMA_BERRY) + if (partnerHeldItem == ITEM_ENIGMA_BERRY_E_READER) partnerHoldEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect; else partnerHoldEffect = ItemId_GetHoldEffect(partnerHeldItem); @@ -7213,7 +7213,7 @@ void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies) u8 bonus; heldItem = GetMonData(mon, MON_DATA_HELD_ITEM, 0); - if (heldItem == ITEM_ENIGMA_BERRY) + if (heldItem == ITEM_ENIGMA_BERRY_E_READER) { if (gMain.inBattle) holdEffect = gEnigmaBerries[0].holdEffect;