From pokefirered

This commit is contained in:
Eduardo Quezada 2022-08-15 18:27:37 -04:00
parent 4b08a511c3
commit 44b26cc8aa
2 changed files with 26 additions and 29 deletions

View File

@ -772,8 +772,7 @@ static void SetPlayerBerryDataInBattleStruct(void)
static void SetAllPlayersBerryData(void)
{
s32 i;
s32 j;
s32 i, j;
if (!(gBattleTypeFlags & BATTLE_TYPE_LINK))
{

View File

@ -1109,8 +1109,7 @@ u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check)
#define ALL_MOVES_MASK ((1 << MAX_MON_MOVES) - 1)
bool8 AreAllMovesUnusable(void)
{
u8 unusable;
unusable = CheckMoveLimitations(gActiveBattler, 0, MOVE_LIMITATIONS_ALL);
u8 unusable = CheckMoveLimitations(gActiveBattler, 0, MOVE_LIMITATIONS_ALL);
if (unusable == ALL_MOVES_MASK) // All moves are unusable.
{
@ -1261,8 +1260,7 @@ u8 DoFieldEndTurnEffects(void)
{
side = gBattleStruct->turnSideTracker;
gActiveBattler = gBattlerAttacker = gSideTimers[side].mistBattlerId;
if (gSideTimers[side].mistTimer != 0
&& --gSideTimers[side].mistTimer == 0)
if (gSideTimers[side].mistTimer != 0 && --gSideTimers[side].mistTimer == 0)
{
gSideStatuses[side] &= ~SIDE_STATUS_MIST;
BattleScriptExecute(BattleScript_SideStatusWoreOff);
@ -2262,8 +2260,8 @@ u8 AtkCanceller_UnableToUseMove(void)
bool8 HasNoMonsToSwitch(u8 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2)
{
u8 playerId, flankId;
struct Pokemon *party;
u8 id1, id2;
s32 i;
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
@ -2276,15 +2274,15 @@ bool8 HasNoMonsToSwitch(u8 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2)
else
party = gEnemyParty;
id1 = ((battler & BIT_FLANK) / 2);
for (i = id1 * MULTI_PARTY_SIZE; i < id1 * MULTI_PARTY_SIZE + MULTI_PARTY_SIZE; i++)
playerId = ((battler & BIT_FLANK) / 2);
for (i = playerId * MULTI_PARTY_SIZE; i < playerId * MULTI_PARTY_SIZE + MULTI_PARTY_SIZE; i++)
{
if (GetMonData(&party[i], MON_DATA_HP) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG)
break;
}
return (i == id1 * MULTI_PARTY_SIZE + MULTI_PARTY_SIZE);
return (i == playerId * MULTI_PARTY_SIZE + MULTI_PARTY_SIZE);
}
else if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{
@ -2293,76 +2291,76 @@ bool8 HasNoMonsToSwitch(u8 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2)
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
{
party = gPlayerParty;
id2 = GetBattlerMultiplayerId(battler);
id1 = GetLinkTrainerFlankId(id2);
flankId = GetBattlerMultiplayerId(battler);
playerId = GetLinkTrainerFlankId(flankId);
}
else
{
party = gEnemyParty;
if (battler == 1)
id1 = 0;
playerId = 0;
else
id1 = 1;
playerId = 1;
}
}
else
{
id2 = GetBattlerMultiplayerId(battler);
flankId = GetBattlerMultiplayerId(battler);
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
party = gPlayerParty;
else
party = gEnemyParty;
id1 = GetLinkTrainerFlankId(id2);
playerId = GetLinkTrainerFlankId(flankId);
}
for (i = id1 * MULTI_PARTY_SIZE; i < id1 * MULTI_PARTY_SIZE + MULTI_PARTY_SIZE; i++)
for (i = playerId * MULTI_PARTY_SIZE; i < playerId * MULTI_PARTY_SIZE + MULTI_PARTY_SIZE; i++)
{
if (GetMonData(&party[i], MON_DATA_HP) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG)
break;
}
return (i == id1 * MULTI_PARTY_SIZE + MULTI_PARTY_SIZE);
return (i == playerId * MULTI_PARTY_SIZE + MULTI_PARTY_SIZE);
}
else if ((gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) && GetBattlerSide(battler) == B_SIDE_OPPONENT)
{
party = gEnemyParty;
if (battler == 1)
id1 = 0;
playerId = 0;
else
id1 = MULTI_PARTY_SIZE;
playerId = MULTI_PARTY_SIZE;
for (i = id1; i < id1 + MULTI_PARTY_SIZE; i++)
for (i = playerId; i < playerId + MULTI_PARTY_SIZE; i++)
{
if (GetMonData(&party[i], MON_DATA_HP) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG)
break;
}
return (i == id1 + 3);
return (i == playerId + 3);
}
else
{
if (GetBattlerSide(battler) == B_SIDE_OPPONENT)
{
id2 = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
id1 = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
flankId = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
playerId = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
party = gEnemyParty;
}
else
{
id2 = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
id1 = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
flankId = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
playerId = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
party = gPlayerParty;
}
if (partyIdBattlerOn1 == PARTY_SIZE)
partyIdBattlerOn1 = gBattlerPartyIndexes[id2];
partyIdBattlerOn1 = gBattlerPartyIndexes[flankId];
if (partyIdBattlerOn2 == PARTY_SIZE)
partyIdBattlerOn2 = gBattlerPartyIndexes[id1];
partyIdBattlerOn2 = gBattlerPartyIndexes[playerId];
for (i = 0; i < PARTY_SIZE; i++)
{
@ -2370,7 +2368,7 @@ bool8 HasNoMonsToSwitch(u8 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2)
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG
&& i != partyIdBattlerOn1 && i != partyIdBattlerOn2
&& i != *(gBattleStruct->monToSwitchIntoId + id2) && i != id1[gBattleStruct->monToSwitchIntoId])
&& i != *(gBattleStruct->monToSwitchIntoId + flankId) && i != playerId[gBattleStruct->monToSwitchIntoId])
break;
}
return (i == PARTY_SIZE);