Use AI_PARTY->mons in SetBattlerData (#2986)

This commit is contained in:
ghoulslash 2023-05-22 12:05:39 -04:00 committed by GitHub
commit 0ac203f2e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -591,7 +591,8 @@ void SetBattlerData(u8 battlerId)
{
if (!BattlerHasAi(battlerId))
{
u32 i, species, illusionSpecies;
u32 i, species, illusionSpecies, side;
side = GetBattlerSide(battlerId);
// Simulate Illusion
species = gBattleMons[battlerId].species;
@ -609,22 +610,22 @@ void SetBattlerData(u8 battlerId)
}
// Use the known battler's ability.
if (BATTLE_HISTORY->abilities[battlerId] != ABILITY_NONE)
gBattleMons[battlerId].ability = BATTLE_HISTORY->abilities[battlerId];
if (AI_PARTY->mons[side][gBattlerPartyIndexes[battlerId]].ability != ABILITY_NONE)
gBattleMons[battlerId].ability = AI_PARTY->mons[side][gBattlerPartyIndexes[battlerId]].ability;
// Check if mon can only have one ability.
else if (gSpeciesInfo[species].abilities[1] == ABILITY_NONE
|| gSpeciesInfo[species].abilities[1] == gSpeciesInfo[species].abilities[0])
|| gSpeciesInfo[species].abilities[1] == gSpeciesInfo[species].abilities[0])
gBattleMons[battlerId].ability = gSpeciesInfo[species].abilities[0];
// The ability is unknown.
else
gBattleMons[battlerId].ability = ABILITY_NONE;
if (BATTLE_HISTORY->itemEffects[battlerId] == 0)
if (AI_PARTY->mons[side][gBattlerPartyIndexes[battlerId]].heldEffect == 0)
gBattleMons[battlerId].item = 0;
for (i = 0; i < 4; i++)
for (i = 0; i < MAX_MON_MOVES; i++)
{
if (BATTLE_HISTORY->usedMoves[battlerId][i] == 0)
if (AI_PARTY->mons[side][gBattlerPartyIndexes[battlerId]].moves[i] == 0)
gBattleMons[battlerId].moves[i] = 0;
}
}