From pokefirered
This commit is contained in:
parent
4b08a511c3
commit
44b26cc8aa
2 changed files with 26 additions and 29 deletions
|
@ -772,8 +772,7 @@ static void SetPlayerBerryDataInBattleStruct(void)
|
||||||
|
|
||||||
static void SetAllPlayersBerryData(void)
|
static void SetAllPlayersBerryData(void)
|
||||||
{
|
{
|
||||||
s32 i;
|
s32 i, j;
|
||||||
s32 j;
|
|
||||||
|
|
||||||
if (!(gBattleTypeFlags & BATTLE_TYPE_LINK))
|
if (!(gBattleTypeFlags & BATTLE_TYPE_LINK))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1109,8 +1109,7 @@ u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check)
|
||||||
#define ALL_MOVES_MASK ((1 << MAX_MON_MOVES) - 1)
|
#define ALL_MOVES_MASK ((1 << MAX_MON_MOVES) - 1)
|
||||||
bool8 AreAllMovesUnusable(void)
|
bool8 AreAllMovesUnusable(void)
|
||||||
{
|
{
|
||||||
u8 unusable;
|
u8 unusable = CheckMoveLimitations(gActiveBattler, 0, MOVE_LIMITATIONS_ALL);
|
||||||
unusable = CheckMoveLimitations(gActiveBattler, 0, MOVE_LIMITATIONS_ALL);
|
|
||||||
|
|
||||||
if (unusable == ALL_MOVES_MASK) // All moves are unusable.
|
if (unusable == ALL_MOVES_MASK) // All moves are unusable.
|
||||||
{
|
{
|
||||||
|
@ -1261,8 +1260,7 @@ u8 DoFieldEndTurnEffects(void)
|
||||||
{
|
{
|
||||||
side = gBattleStruct->turnSideTracker;
|
side = gBattleStruct->turnSideTracker;
|
||||||
gActiveBattler = gBattlerAttacker = gSideTimers[side].mistBattlerId;
|
gActiveBattler = gBattlerAttacker = gSideTimers[side].mistBattlerId;
|
||||||
if (gSideTimers[side].mistTimer != 0
|
if (gSideTimers[side].mistTimer != 0 && --gSideTimers[side].mistTimer == 0)
|
||||||
&& --gSideTimers[side].mistTimer == 0)
|
|
||||||
{
|
{
|
||||||
gSideStatuses[side] &= ~SIDE_STATUS_MIST;
|
gSideStatuses[side] &= ~SIDE_STATUS_MIST;
|
||||||
BattleScriptExecute(BattleScript_SideStatusWoreOff);
|
BattleScriptExecute(BattleScript_SideStatusWoreOff);
|
||||||
|
@ -2262,8 +2260,8 @@ u8 AtkCanceller_UnableToUseMove(void)
|
||||||
|
|
||||||
bool8 HasNoMonsToSwitch(u8 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2)
|
bool8 HasNoMonsToSwitch(u8 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2)
|
||||||
{
|
{
|
||||||
|
u8 playerId, flankId;
|
||||||
struct Pokemon *party;
|
struct Pokemon *party;
|
||||||
u8 id1, id2;
|
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
|
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
|
||||||
|
@ -2276,15 +2274,15 @@ bool8 HasNoMonsToSwitch(u8 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2)
|
||||||
else
|
else
|
||||||
party = gEnemyParty;
|
party = gEnemyParty;
|
||||||
|
|
||||||
id1 = ((battler & BIT_FLANK) / 2);
|
playerId = ((battler & BIT_FLANK) / 2);
|
||||||
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
|
if (GetMonData(&party[i], MON_DATA_HP) != 0
|
||||||
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE
|
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE
|
||||||
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG)
|
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG)
|
||||||
break;
|
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)
|
else if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
|
||||||
{
|
{
|
||||||
|
@ -2293,76 +2291,76 @@ bool8 HasNoMonsToSwitch(u8 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2)
|
||||||
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
|
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
|
||||||
{
|
{
|
||||||
party = gPlayerParty;
|
party = gPlayerParty;
|
||||||
id2 = GetBattlerMultiplayerId(battler);
|
flankId = GetBattlerMultiplayerId(battler);
|
||||||
id1 = GetLinkTrainerFlankId(id2);
|
playerId = GetLinkTrainerFlankId(flankId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
party = gEnemyParty;
|
party = gEnemyParty;
|
||||||
if (battler == 1)
|
if (battler == 1)
|
||||||
id1 = 0;
|
playerId = 0;
|
||||||
else
|
else
|
||||||
id1 = 1;
|
playerId = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
id2 = GetBattlerMultiplayerId(battler);
|
flankId = GetBattlerMultiplayerId(battler);
|
||||||
|
|
||||||
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
|
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
|
||||||
party = gPlayerParty;
|
party = gPlayerParty;
|
||||||
else
|
else
|
||||||
party = gEnemyParty;
|
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
|
if (GetMonData(&party[i], MON_DATA_HP) != 0
|
||||||
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE
|
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE
|
||||||
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG)
|
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG)
|
||||||
break;
|
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)
|
else if ((gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) && GetBattlerSide(battler) == B_SIDE_OPPONENT)
|
||||||
{
|
{
|
||||||
party = gEnemyParty;
|
party = gEnemyParty;
|
||||||
|
|
||||||
if (battler == 1)
|
if (battler == 1)
|
||||||
id1 = 0;
|
playerId = 0;
|
||||||
else
|
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
|
if (GetMonData(&party[i], MON_DATA_HP) != 0
|
||||||
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE
|
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE
|
||||||
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG)
|
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return (i == id1 + 3);
|
return (i == playerId + 3);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (GetBattlerSide(battler) == B_SIDE_OPPONENT)
|
if (GetBattlerSide(battler) == B_SIDE_OPPONENT)
|
||||||
{
|
{
|
||||||
id2 = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
|
flankId = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
|
||||||
id1 = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
|
playerId = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
|
||||||
party = gEnemyParty;
|
party = gEnemyParty;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
id2 = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
|
flankId = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
|
||||||
id1 = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
|
playerId = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
|
||||||
party = gPlayerParty;
|
party = gPlayerParty;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (partyIdBattlerOn1 == PARTY_SIZE)
|
if (partyIdBattlerOn1 == PARTY_SIZE)
|
||||||
partyIdBattlerOn1 = gBattlerPartyIndexes[id2];
|
partyIdBattlerOn1 = gBattlerPartyIndexes[flankId];
|
||||||
if (partyIdBattlerOn2 == PARTY_SIZE)
|
if (partyIdBattlerOn2 == PARTY_SIZE)
|
||||||
partyIdBattlerOn2 = gBattlerPartyIndexes[id1];
|
partyIdBattlerOn2 = gBattlerPartyIndexes[playerId];
|
||||||
|
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
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_NONE
|
||||||
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG
|
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG
|
||||||
&& i != partyIdBattlerOn1 && i != partyIdBattlerOn2
|
&& i != partyIdBattlerOn1 && i != partyIdBattlerOn2
|
||||||
&& i != *(gBattleStruct->monToSwitchIntoId + id2) && i != id1[gBattleStruct->monToSwitchIntoId])
|
&& i != *(gBattleStruct->monToSwitchIntoId + flankId) && i != playerId[gBattleStruct->monToSwitchIntoId])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return (i == PARTY_SIZE);
|
return (i == PARTY_SIZE);
|
||||||
|
|
Loading…
Reference in a new issue