Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.4.3 #2968

Merged
merged 7 commits into from
May 1, 2023
7 changes: 4 additions & 3 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);

Expand Down
10 changes: 5 additions & 5 deletions src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -8181,15 +8181,15 @@ 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);
}

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);
Expand Down
2 changes: 1 addition & 1 deletion src/battle_z_move.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/data/battle_moves.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/data/pokemon/evolution.h
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
19 changes: 11 additions & 8 deletions src/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]]);
Expand Down Expand Up @@ -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]]);
Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions src/pokemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down