From 47b013fc22472ebdcad7e23325595a0d92939be1 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Thu, 9 Mar 2023 08:17:29 -0300 Subject: [PATCH 1/7] Debug menu to give items based on max quantity and map number 3digits display (#2807) --- src/debug.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) 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)) From d922ac43e9c6be89cd46cbcd4a945bc6c558bba4 Mon Sep 17 00:00:00 2001 From: AgustinGDLV <103095241+AgustinGDLV@users.noreply.github.com> Date: Thu, 23 Mar 2023 01:50:44 -0700 Subject: [PATCH 2/7] changed CanBeConfused to actually check its argument (#2855) --- src/battle_util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index 3c4201f467..66a5ca6221 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; From e176fd285ed866f6e9d79a99997f2e4dc7d48feb Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Thu, 23 Mar 2023 05:58:26 -0300 Subject: [PATCH 3/7] Fixed erroneous uses of non e-reader Enigma Berries (#2839) --- src/battle_util.c | 6 +++--- src/battle_z_move.c | 2 +- src/pokemon.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index 66a5ca6221..6801e6b293 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -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/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; From 69f58adbb22bde492a0d66593bd93c5a66fbff39 Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Sun, 26 Mar 2023 15:03:56 -0400 Subject: [PATCH 4/7] add check for Gorilla Tactics when resetting choicedMove from knock off (#2854) --- src/battle_script_commands.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 8b8d4f1e94..f9c117842a 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -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); From c283eacd08eb97f4abfc6ed9fcd37f2515e76a7d Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Mon, 27 Mar 2023 21:48:50 -0400 Subject: [PATCH 5/7] Fixed instances of gSideTimers not using side constants (#2867) --- src/battle_script_commands.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index f9c117842a..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) { From e89dc0dd0068b7a7c3883e0b29c51aa62d40241c Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 8 Apr 2023 13:01:42 -0400 Subject: [PATCH 6/7] Fixes Ominous Wind targeting (#2896) --- src/data/battle_moves.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, From a845eb1dfad616f3b32415885438df0481814493 Mon Sep 17 00:00:00 2001 From: Frank DeBlasio <35279583+fdeblasio@users.noreply.github.com> Date: Tue, 18 Apr 2023 16:28:02 -0400 Subject: [PATCH 7/7] Fixed Budew evolution method (#2928) --- src/data/pokemon/evolution.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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},