mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Merge pull request #389 from DizzyEggg/num_stats
Use PARTY_SIZE and rename BATTLE_STATS_NO to NUM_BATTLE_STATS
This commit is contained in:
commit
963989d760
@ -74,7 +74,10 @@
|
|||||||
#define STAT_SPEED 3
|
#define STAT_SPEED 3
|
||||||
#define STAT_SPATK 4
|
#define STAT_SPATK 4
|
||||||
#define STAT_SPDEF 5
|
#define STAT_SPDEF 5
|
||||||
#define STAT_ACC 6 // only in battles
|
#define STAT_ACC 6 // Only in battles.
|
||||||
#define STAT_EVASION 7 // only in battles
|
#define STAT_EVASION 7 // Only in battles.
|
||||||
|
|
||||||
|
#define NUM_STATS 6
|
||||||
|
#define NUM_BATTLE_STATS 8
|
||||||
|
|
||||||
#endif // GUARD_CONSTANTS_POKEMON_H
|
#endif // GUARD_CONSTANTS_POKEMON_H
|
||||||
|
@ -151,7 +151,6 @@
|
|||||||
#define STATUS_PRIMARY_FAINTED 0x7
|
#define STATUS_PRIMARY_FAINTED 0x7
|
||||||
|
|
||||||
#define MAX_TOTAL_EVS 510
|
#define MAX_TOTAL_EVS 510
|
||||||
#define NUM_STATS 6
|
|
||||||
#define UNOWN_FORM_COUNT 28
|
#define UNOWN_FORM_COUNT 28
|
||||||
|
|
||||||
struct PokemonSubstruct0
|
struct PokemonSubstruct0
|
||||||
@ -293,8 +292,6 @@ struct Unknown_806F160_Struct
|
|||||||
struct SpriteFrameImage *frameImages;
|
struct SpriteFrameImage *frameImages;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BATTLE_STATS_NO 8
|
|
||||||
|
|
||||||
struct BattlePokemon
|
struct BattlePokemon
|
||||||
{
|
{
|
||||||
/*0x00*/ u16 species;
|
/*0x00*/ u16 species;
|
||||||
@ -312,7 +309,7 @@ struct BattlePokemon
|
|||||||
/*0x17*/ u32 spDefenseIV:5;
|
/*0x17*/ u32 spDefenseIV:5;
|
||||||
/*0x17*/ u32 isEgg:1;
|
/*0x17*/ u32 isEgg:1;
|
||||||
/*0x17*/ u32 altAbility:1;
|
/*0x17*/ u32 altAbility:1;
|
||||||
/*0x18*/ s8 statStages[BATTLE_STATS_NO];
|
/*0x18*/ s8 statStages[NUM_BATTLE_STATS];
|
||||||
/*0x20*/ u8 ability;
|
/*0x20*/ u8 ability;
|
||||||
/*0x21*/ u8 type1;
|
/*0x21*/ u8 type1;
|
||||||
/*0x22*/ u8 type2;
|
/*0x22*/ u8 type2;
|
||||||
|
@ -310,7 +310,7 @@ static bool8 AreStatsRaised(void)
|
|||||||
u8 buffedStatsValue = 0;
|
u8 buffedStatsValue = 0;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = 0; i < BATTLE_STATS_NO; i++)
|
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||||
{
|
{
|
||||||
if (gBattleMons[gActiveBattler].statStages[i] > 6)
|
if (gBattleMons[gActiveBattler].statStages[i] > 6)
|
||||||
buffedStatsValue += gBattleMons[gActiveBattler].statStages[i] - 6;
|
buffedStatsValue += gBattleMons[gActiveBattler].statStages[i] - 6;
|
||||||
|
@ -558,7 +558,7 @@ static void LinkOpponentHandleGetMonData(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
monToCheck = gBattleBufferA[gActiveBattler][2];
|
monToCheck = gBattleBufferA[gActiveBattler][2];
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (monToCheck & 1)
|
if (monToCheck & 1)
|
||||||
size += CopyLinkOpponentMonData(i, monData + size);
|
size += CopyLinkOpponentMonData(i, monData + size);
|
||||||
@ -892,7 +892,7 @@ static void LinkOpponentHandleSetMonData(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
monToCheck = gBattleBufferA[gActiveBattler][2];
|
monToCheck = gBattleBufferA[gActiveBattler][2];
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (monToCheck & 1)
|
if (monToCheck & 1)
|
||||||
SetLinkOpponentMonData(i);
|
SetLinkOpponentMonData(i);
|
||||||
|
@ -444,7 +444,7 @@ static void LinkPartnerHandleGetMonData(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
monToCheck = gBattleBufferA[gActiveBattler][2];
|
monToCheck = gBattleBufferA[gActiveBattler][2];
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (monToCheck & 1)
|
if (monToCheck & 1)
|
||||||
size += CopyLinkPartnerMonData(i, monData + size);
|
size += CopyLinkPartnerMonData(i, monData + size);
|
||||||
@ -778,7 +778,7 @@ static void LinkPartnerHandleSetMonData(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
monToCheck = gBattleBufferA[gActiveBattler][2];
|
monToCheck = gBattleBufferA[gActiveBattler][2];
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (monToCheck & 1)
|
if (monToCheck & 1)
|
||||||
SetLinkPartnerMonData(i);
|
SetLinkPartnerMonData(i);
|
||||||
|
@ -541,7 +541,7 @@ static void OpponentHandleGetMonData(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
monToCheck = gBattleBufferA[gActiveBattler][2];
|
monToCheck = gBattleBufferA[gActiveBattler][2];
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (monToCheck & 1)
|
if (monToCheck & 1)
|
||||||
size += GetOpponentMonData(i, monData + size);
|
size += GetOpponentMonData(i, monData + size);
|
||||||
@ -884,7 +884,7 @@ static void OpponentHandleSetMonData(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
monToCheck = gBattleBufferA[gActiveBattler][2];
|
monToCheck = gBattleBufferA[gActiveBattler][2];
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (monToCheck & 1)
|
if (monToCheck & 1)
|
||||||
SetOpponentMonData(i);
|
SetOpponentMonData(i);
|
||||||
|
@ -1589,7 +1589,7 @@ static void PlayerHandleGetMonData(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
monToCheck = gBattleBufferA[gActiveBattler][2];
|
monToCheck = gBattleBufferA[gActiveBattler][2];
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (monToCheck & 1)
|
if (monToCheck & 1)
|
||||||
size += CopyPlayerMonData(i, monData + size);
|
size += CopyPlayerMonData(i, monData + size);
|
||||||
@ -1932,7 +1932,7 @@ static void PlayerHandleSetMonData(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
monToCheck = gBattleBufferA[gActiveBattler][2];
|
monToCheck = gBattleBufferA[gActiveBattler][2];
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (monToCheck & 1)
|
if (monToCheck & 1)
|
||||||
SetPlayerMonData(i);
|
SetPlayerMonData(i);
|
||||||
|
@ -632,7 +632,7 @@ static void PlayerPartnerHandleGetMonData(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
monToCheck = gBattleBufferA[gActiveBattler][2];
|
monToCheck = gBattleBufferA[gActiveBattler][2];
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (monToCheck & 1)
|
if (monToCheck & 1)
|
||||||
size += CopyPlayerPartnerMonData(i, monData + size);
|
size += CopyPlayerPartnerMonData(i, monData + size);
|
||||||
@ -966,7 +966,7 @@ static void PlayerPartnerHandleSetMonData(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
monToCheck = gBattleBufferA[gActiveBattler][2];
|
monToCheck = gBattleBufferA[gActiveBattler][2];
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (monToCheck & 1)
|
if (monToCheck & 1)
|
||||||
SetPlayerPartnerMonData(i);
|
SetPlayerPartnerMonData(i);
|
||||||
|
@ -542,7 +542,7 @@ static void RecordedOpponentHandleGetMonData(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
monToCheck = gBattleBufferA[gActiveBattler][2];
|
monToCheck = gBattleBufferA[gActiveBattler][2];
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (monToCheck & 1)
|
if (monToCheck & 1)
|
||||||
size += CopyRecordedOpponentMonData(i, monData + size);
|
size += CopyRecordedOpponentMonData(i, monData + size);
|
||||||
@ -876,7 +876,7 @@ static void RecordedOpponentHandleSetMonData(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
monToCheck = gBattleBufferA[gActiveBattler][2];
|
monToCheck = gBattleBufferA[gActiveBattler][2];
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (monToCheck & 1)
|
if (monToCheck & 1)
|
||||||
SetRecordedOpponentMonData(i);
|
SetRecordedOpponentMonData(i);
|
||||||
|
@ -527,7 +527,7 @@ static void RecordedPlayerHandleGetMonData(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
monToCheck = gBattleBufferA[gActiveBattler][2];
|
monToCheck = gBattleBufferA[gActiveBattler][2];
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (monToCheck & 1)
|
if (monToCheck & 1)
|
||||||
size += CopyRecordedPlayerMonData(i, monData + size);
|
size += CopyRecordedPlayerMonData(i, monData + size);
|
||||||
@ -861,7 +861,7 @@ static void RecordedPlayerHandleSetMonData(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
monToCheck = gBattleBufferA[gActiveBattler][2];
|
monToCheck = gBattleBufferA[gActiveBattler][2];
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (monToCheck & 1)
|
if (monToCheck & 1)
|
||||||
SetRecordedPlayerMonData(i);
|
SetRecordedPlayerMonData(i);
|
||||||
|
@ -442,7 +442,7 @@ static void WallyHandleGetMonData(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
monToCheck = gBattleBufferA[gActiveBattler][2];
|
monToCheck = gBattleBufferA[gActiveBattler][2];
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (monToCheck & 1)
|
if (monToCheck & 1)
|
||||||
size += CopyWallyMonData(i, monData + size);
|
size += CopyWallyMonData(i, monData + size);
|
||||||
@ -776,7 +776,7 @@ static void WallyHandleSetMonData(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
monToCheck = gBattleBufferA[gActiveBattler][2];
|
monToCheck = gBattleBufferA[gActiveBattler][2];
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (monToCheck & 1)
|
if (monToCheck & 1)
|
||||||
SetWallyMonData(i);
|
SetWallyMonData(i);
|
||||||
|
@ -2756,17 +2756,17 @@ static void CalcDomeMonStats(u16 species, s32 level, s32 ivs, u8 evBits, u8 natu
|
|||||||
s32 i, count;
|
s32 i, count;
|
||||||
u8 bits;
|
u8 bits;
|
||||||
u16 resultingEvs;
|
u16 resultingEvs;
|
||||||
s32 evs[6];
|
s32 evs[NUM_STATS];
|
||||||
|
|
||||||
count = 0, bits = evBits;
|
count = 0, bits = evBits;
|
||||||
for (i = 0; i < 6; bits >>= 1, i++)
|
for (i = 0; i < NUM_STATS; bits >>= 1, i++)
|
||||||
{
|
{
|
||||||
if (bits & 1)
|
if (bits & 1)
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
resultingEvs = MAX_TOTAL_EVS / count;
|
resultingEvs = MAX_TOTAL_EVS / count;
|
||||||
for (i = 0; i < 6; bits <<= 1, i++)
|
for (i = 0; i < NUM_STATS; bits <<= 1, i++)
|
||||||
{
|
{
|
||||||
evs[i] = 0;
|
evs[i] = 0;
|
||||||
if (evBits & bits)
|
if (evBits & bits)
|
||||||
@ -4953,7 +4953,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
|
|||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
s32 evBits = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]].evSpread;
|
s32 evBits = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]].evSpread;
|
||||||
for (k = 0, j = 0; j < 6; j++)
|
for (k = 0, j = 0; j < NUM_STATS; j++)
|
||||||
{
|
{
|
||||||
allocatedArray[j] = 0;
|
allocatedArray[j] = 0;
|
||||||
if (evBits & 1)
|
if (evBits & 1)
|
||||||
@ -4962,7 +4962,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
|
|||||||
}
|
}
|
||||||
k = MAX_TOTAL_EVS / k;
|
k = MAX_TOTAL_EVS / k;
|
||||||
evBits = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]].evSpread;
|
evBits = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]].evSpread;
|
||||||
for (j = 0; j < 6; j++)
|
for (j = 0; j < NUM_STATS; j++)
|
||||||
{
|
{
|
||||||
if (evBits & 1)
|
if (evBits & 1)
|
||||||
allocatedArray[j] = k;
|
allocatedArray[j] = k;
|
||||||
|
@ -3094,7 +3094,7 @@ void SwitchInClearSetData(void)
|
|||||||
|
|
||||||
if (gBattleMoves[gCurrentMove].effect != EFFECT_BATON_PASS)
|
if (gBattleMoves[gCurrentMove].effect != EFFECT_BATON_PASS)
|
||||||
{
|
{
|
||||||
for (i = 0; i < BATTLE_STATS_NO; i++)
|
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||||
gBattleMons[gActiveBattler].statStages[i] = 6;
|
gBattleMons[gActiveBattler].statStages[i] = 6;
|
||||||
for (i = 0; i < gBattlersCount; i++)
|
for (i = 0; i < gBattlersCount; i++)
|
||||||
{
|
{
|
||||||
@ -3203,7 +3203,7 @@ void FaintClearSetData(void)
|
|||||||
s32 i;
|
s32 i;
|
||||||
u8 *ptr;
|
u8 *ptr;
|
||||||
|
|
||||||
for (i = 0; i < BATTLE_STATS_NO; i++)
|
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||||
gBattleMons[gActiveBattler].statStages[i] = 6;
|
gBattleMons[gActiveBattler].statStages[i] = 6;
|
||||||
|
|
||||||
gBattleMons[gActiveBattler].status2 = 0;
|
gBattleMons[gActiveBattler].status2 = 0;
|
||||||
@ -3357,7 +3357,7 @@ static void BattleIntroDrawTrainersOrMonsSprites(void)
|
|||||||
gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].altAbility);
|
gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].altAbility);
|
||||||
hpOnSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)];
|
hpOnSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)];
|
||||||
*hpOnSwitchout = gBattleMons[gActiveBattler].hp;
|
*hpOnSwitchout = gBattleMons[gActiveBattler].hp;
|
||||||
for (i = 0; i < BATTLE_STATS_NO; i++)
|
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||||
gBattleMons[gActiveBattler].statStages[i] = 6;
|
gBattleMons[gActiveBattler].statStages[i] = 6;
|
||||||
gBattleMons[gActiveBattler].status2 = 0;
|
gBattleMons[gActiveBattler].status2 = 0;
|
||||||
}
|
}
|
||||||
|
@ -3283,7 +3283,7 @@ static void atk23_getexp(void)
|
|||||||
u16 calculatedExp;
|
u16 calculatedExp;
|
||||||
s32 viaSentIn;
|
s32 viaSentIn;
|
||||||
|
|
||||||
for (viaSentIn = 0, i = 0; i < 6; i++)
|
for (viaSentIn = 0, i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE || GetMonData(&gPlayerParty[i], MON_DATA_HP) == 0)
|
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE || GetMonData(&gPlayerParty[i], MON_DATA_HP) == 0)
|
||||||
continue;
|
continue;
|
||||||
@ -3541,7 +3541,7 @@ static void atk24(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)
|
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)
|
||||||
&& (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || !(gBattleStruct->arenaLostPlayerMons & gBitTable[i])))
|
&& (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || !(gBattleStruct->arenaLostPlayerMons & gBitTable[i])))
|
||||||
@ -3554,7 +3554,7 @@ static void atk24(void)
|
|||||||
if (HP_count == 0)
|
if (HP_count == 0)
|
||||||
gBattleOutcome |= B_OUTCOME_LOST;
|
gBattleOutcome |= B_OUTCOME_LOST;
|
||||||
|
|
||||||
for (HP_count = 0, i = 0; i < 6; i++)
|
for (HP_count = 0, i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&gEnemyParty[i], MON_DATA_SPECIES) && !GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG)
|
if (GetMonData(&gEnemyParty[i], MON_DATA_SPECIES) && !GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG)
|
||||||
&& (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || !(gBattleStruct->arenaLostOpponentMons & gBitTable[i])))
|
&& (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || !(gBattleStruct->arenaLostOpponentMons & gBitTable[i])))
|
||||||
@ -4950,7 +4950,7 @@ static void atk4D_switchindataupdate(void)
|
|||||||
|
|
||||||
if (gBattleMoves[gCurrentMove].effect == EFFECT_BATON_PASS)
|
if (gBattleMoves[gCurrentMove].effect == EFFECT_BATON_PASS)
|
||||||
{
|
{
|
||||||
for (i = 0; i < BATTLE_STATS_NO; i++)
|
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||||
{
|
{
|
||||||
gBattleMons[gActiveBattler].statStages[i] = oldData.statStages[i];
|
gBattleMons[gActiveBattler].statStages[i] = oldData.statStages[i];
|
||||||
}
|
}
|
||||||
@ -7404,7 +7404,7 @@ static void atk8A_normalisebuffs(void) // haze
|
|||||||
|
|
||||||
for (i = 0; i < gBattlersCount; i++)
|
for (i = 0; i < gBattlersCount; i++)
|
||||||
{
|
{
|
||||||
for (j = 0; j < BATTLE_STATS_NO; j++)
|
for (j = 0; j < NUM_BATTLE_STATS; j++)
|
||||||
gBattleMons[i].statStages[j] = 6;
|
gBattleMons[i].statStages[j] = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9032,7 +9032,7 @@ static void atkBD_copyfoestats(void) // psych up
|
|||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = 0; i < BATTLE_STATS_NO; i++)
|
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||||
{
|
{
|
||||||
gBattleMons[gBattlerAttacker].statStages[i] = gBattleMons[gBattlerTarget].statStages[i];
|
gBattleMons[gBattlerAttacker].statStages[i] = gBattleMons[gBattlerTarget].statStages[i];
|
||||||
}
|
}
|
||||||
|
@ -2616,7 +2616,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
|||||||
gBattleStruct->moneyMultiplier = 2;
|
gBattleStruct->moneyMultiplier = 2;
|
||||||
break;
|
break;
|
||||||
case HOLD_EFFECT_RESTORE_STATS:
|
case HOLD_EFFECT_RESTORE_STATS:
|
||||||
for (i = 0; i < BATTLE_STATS_NO; i++)
|
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||||
{
|
{
|
||||||
if (gBattleMons[battlerId].statStages[i] < 6)
|
if (gBattleMons[battlerId].statStages[i] < 6)
|
||||||
{
|
{
|
||||||
@ -2687,7 +2687,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HOLD_EFFECT_RESTORE_STATS:
|
case HOLD_EFFECT_RESTORE_STATS:
|
||||||
for (i = 0; i < BATTLE_STATS_NO; i++)
|
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||||
{
|
{
|
||||||
if (gBattleMons[battlerId].statStages[i] < 6)
|
if (gBattleMons[battlerId].statStages[i] < 6)
|
||||||
{
|
{
|
||||||
@ -3163,7 +3163,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HOLD_EFFECT_RESTORE_STATS:
|
case HOLD_EFFECT_RESTORE_STATS:
|
||||||
for (i = 0; i < BATTLE_STATS_NO; i++)
|
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||||
{
|
{
|
||||||
if (gBattleMons[battlerId].statStages[i] < 6)
|
if (gBattleMons[battlerId].statStages[i] < 6)
|
||||||
{
|
{
|
||||||
|
@ -305,7 +305,7 @@ static void CreatedHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
|
|||||||
u32 personality, pokerus;
|
u32 personality, pokerus;
|
||||||
u8 i, friendship, language, gameMet, markings, obedience;
|
u8 i, friendship, language, gameMet, markings, obedience;
|
||||||
u16 moves[4];
|
u16 moves[4];
|
||||||
u32 ivs[6];
|
u32 ivs[NUM_STATS];
|
||||||
|
|
||||||
|
|
||||||
species = GetMonData(egg, MON_DATA_SPECIES);
|
species = GetMonData(egg, MON_DATA_SPECIES);
|
||||||
@ -317,7 +317,7 @@ static void CreatedHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
|
|||||||
|
|
||||||
personality = GetMonData(egg, MON_DATA_PERSONALITY);
|
personality = GetMonData(egg, MON_DATA_PERSONALITY);
|
||||||
|
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < NUM_STATS; i++)
|
||||||
{
|
{
|
||||||
ivs[i] = GetMonData(egg, MON_DATA_HP_IV + i);
|
ivs[i] = GetMonData(egg, MON_DATA_HP_IV + i);
|
||||||
}
|
}
|
||||||
@ -335,7 +335,7 @@ static void CreatedHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
|
|||||||
SetMonData(temp, MON_DATA_MOVE1 + i, &moves[i]);
|
SetMonData(temp, MON_DATA_MOVE1 + i, &moves[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < NUM_STATS; i++)
|
||||||
{
|
{
|
||||||
SetMonData(temp, MON_DATA_HP_IV + i, &ivs[i]);
|
SetMonData(temp, MON_DATA_HP_IV + i, &ivs[i]);
|
||||||
}
|
}
|
||||||
|
@ -2559,7 +2559,7 @@ struct EventObjectTemplate *GetBaseTemplateForEventObject(const struct EventObje
|
|||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
for (i = 0; i < 64; i++) // Using ARRAY_COUNT here results in the wrong conditional branch instruction (bls instead of ble)
|
for (i = 0; i < EVENT_OBJECT_TEMPLATES_COUNT; i++)
|
||||||
{
|
{
|
||||||
if (eventObject->localId == gSaveBlock1Ptr->eventObjectTemplates[i].localId)
|
if (eventObject->localId == gSaveBlock1Ptr->eventObjectTemplates[i].localId)
|
||||||
{
|
{
|
||||||
|
@ -1306,7 +1306,7 @@ bool8 PartyHasMonWithSurf(void)
|
|||||||
|
|
||||||
if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
|
if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
|
||||||
{
|
{
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE)
|
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE)
|
||||||
break;
|
break;
|
||||||
|
@ -2052,26 +2052,26 @@ _08139D7C:\n\
|
|||||||
void sub_8139D98(void)
|
void sub_8139D98(void)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
u32 ivStorage[6];
|
u32 ivStorage[NUM_STATS];
|
||||||
|
|
||||||
ivStorage[0] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_HP_IV);
|
ivStorage[STAT_HP] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_HP_IV);
|
||||||
ivStorage[1] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_ATK_IV);
|
ivStorage[STAT_ATK] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_ATK_IV);
|
||||||
ivStorage[2] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_DEF_IV);
|
ivStorage[STAT_DEF] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_DEF_IV);
|
||||||
ivStorage[3] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPEED_IV);
|
ivStorage[STAT_SPEED] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPEED_IV);
|
||||||
ivStorage[4] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPATK_IV);
|
ivStorage[STAT_SPATK] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPATK_IV);
|
||||||
ivStorage[5] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPDEF_IV);
|
ivStorage[STAT_SPDEF] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPDEF_IV);
|
||||||
|
|
||||||
gSpecialVar_0x8005 = 0;
|
gSpecialVar_0x8005 = 0;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_COUNT(ivStorage); i++)
|
for (i = 0; i < NUM_STATS; i++)
|
||||||
{
|
{
|
||||||
gSpecialVar_0x8005 += ivStorage[i];
|
gSpecialVar_0x8005 += ivStorage[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
gSpecialVar_0x8006 = 0;
|
gSpecialVar_0x8006 = 0;
|
||||||
gSpecialVar_0x8007 = ivStorage[0]; // HP IV
|
gSpecialVar_0x8007 = ivStorage[STAT_HP];
|
||||||
|
|
||||||
for (i = 1; i < 6; i++)
|
for (i = 1; i < NUM_STATS; i++)
|
||||||
{
|
{
|
||||||
if (ivStorage[gSpecialVar_0x8006] < ivStorage[i])
|
if (ivStorage[gSpecialVar_0x8006] < ivStorage[i])
|
||||||
{
|
{
|
||||||
@ -2081,7 +2081,7 @@ void sub_8139D98(void)
|
|||||||
else if (ivStorage[gSpecialVar_0x8006] == ivStorage[i])
|
else if (ivStorage[gSpecialVar_0x8006] == ivStorage[i])
|
||||||
{
|
{
|
||||||
u16 randomNumber = Random();
|
u16 randomNumber = Random();
|
||||||
if ((randomNumber & 1) != 0)
|
if (randomNumber & 1)
|
||||||
{
|
{
|
||||||
gSpecialVar_0x8006 = i;
|
gSpecialVar_0x8006 = i;
|
||||||
gSpecialVar_0x8007 = ivStorage[i];
|
gSpecialVar_0x8007 = ivStorage[i];
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "trainer_pokemon_sprites.h"
|
#include "trainer_pokemon_sprites.h"
|
||||||
#include "data2.h"
|
#include "data2.h"
|
||||||
#include "rom_81520A8.h"
|
#include "rom_81520A8.h"
|
||||||
|
#include "constants/rgb.h"
|
||||||
|
|
||||||
struct HallofFameMon
|
struct HallofFameMon
|
||||||
{
|
{
|
||||||
@ -388,7 +389,7 @@ static bool8 InitHallOfFameScreen(void)
|
|||||||
if (!sub_8175024())
|
if (!sub_8175024())
|
||||||
{
|
{
|
||||||
SetVBlankCallback(VBlankCB_HallOfFame);
|
SetVBlankCallback(VBlankCB_HallOfFame);
|
||||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, 0);
|
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK);
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -438,7 +439,7 @@ static void Task_Hof_InitMonData(u8 taskId)
|
|||||||
|
|
||||||
gTasks[taskId].tMonNumber = 0; // valid pokes
|
gTasks[taskId].tMonNumber = 0; // valid pokes
|
||||||
|
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
u8 nick[POKEMON_NAME_LENGTH + 2];
|
u8 nick[POKEMON_NAME_LENGTH + 2];
|
||||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES))
|
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES))
|
||||||
@ -468,7 +469,7 @@ static void Task_Hof_InitMonData(u8 taskId)
|
|||||||
gTasks[taskId].tDisplayedMonId = 0;
|
gTasks[taskId].tDisplayedMonId = 0;
|
||||||
gTasks[taskId].tPlayerSpriteID = 0xFF;
|
gTasks[taskId].tPlayerSpriteID = 0xFF;
|
||||||
|
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
gTasks[taskId].tMonSpriteId(i) = 0xFF;
|
gTasks[taskId].tMonSpriteId(i) = 0xFF;
|
||||||
}
|
}
|
||||||
@ -626,7 +627,7 @@ static void Task_Hof_TryDisplayAnotherMon(u8 taskId)
|
|||||||
if (gTasks[taskId].tDisplayedMonId <= 4 && currMon[1].species != SPECIES_NONE) // there is another pokemon to display
|
if (gTasks[taskId].tDisplayedMonId <= 4 && currMon[1].species != SPECIES_NONE) // there is another pokemon to display
|
||||||
{
|
{
|
||||||
gTasks[taskId].tDisplayedMonId++;
|
gTasks[taskId].tDisplayedMonId++;
|
||||||
BeginNormalPaletteFade(sUnknown_0203BCD4, 0, 12, 12, 0x63B0);
|
BeginNormalPaletteFade(sUnknown_0203BCD4, 0, 12, 12, RGB(16, 29, 24));
|
||||||
gSprites[gTasks[taskId].tMonSpriteId(currPokeID)].oam.priority = 1;
|
gSprites[gTasks[taskId].tMonSpriteId(currPokeID)].oam.priority = 1;
|
||||||
gTasks[taskId].func = Task_Hof_DisplayMon;
|
gTasks[taskId].func = Task_Hof_DisplayMon;
|
||||||
}
|
}
|
||||||
@ -641,8 +642,8 @@ static void Task_Hof_PaletteFadeAndPrintWelcomeText(u8 taskId)
|
|||||||
{
|
{
|
||||||
u16 i;
|
u16 i;
|
||||||
|
|
||||||
BeginNormalPaletteFade(0xFFFF0000, 0, 0, 0, 0);
|
BeginNormalPaletteFade(0xFFFF0000, 0, 0, 0, RGB_BLACK);
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (gTasks[taskId].tMonSpriteId(i) != 0xFF)
|
if (gTasks[taskId].tMonSpriteId(i) != 0xFF)
|
||||||
gSprites[gTasks[taskId].tMonSpriteId(i)].oam.priority = 0;
|
gSprites[gTasks[taskId].tMonSpriteId(i)].oam.priority = 0;
|
||||||
@ -665,12 +666,12 @@ static void sub_8173DC0(u8 taskId)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
u16 i;
|
u16 i;
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (gTasks[taskId].tMonSpriteId(i) != 0xFF)
|
if (gTasks[taskId].tMonSpriteId(i) != 0xFF)
|
||||||
gSprites[gTasks[taskId].tMonSpriteId(i)].oam.priority = 1;
|
gSprites[gTasks[taskId].tMonSpriteId(i)].oam.priority = 1;
|
||||||
}
|
}
|
||||||
BeginNormalPaletteFade(sUnknown_0203BCD4, 0, 12, 12, 0x63B0);
|
BeginNormalPaletteFade(sUnknown_0203BCD4, 0, 12, 12, RGB(16, 29, 24));
|
||||||
FillWindowPixelBuffer(0, 0);
|
FillWindowPixelBuffer(0, 0);
|
||||||
CopyWindowToVram(0, 3);
|
CopyWindowToVram(0, 3);
|
||||||
gTasks[taskId].tFrameCount = 7;
|
gTasks[taskId].tFrameCount = 7;
|
||||||
@ -738,7 +739,7 @@ static void Task_Hof_ExitOnKeyPressed(u8 taskId)
|
|||||||
static void Task_Hof_HandlePaletteOnExit(u8 taskId)
|
static void Task_Hof_HandlePaletteOnExit(u8 taskId)
|
||||||
{
|
{
|
||||||
CpuCopy16(gPlttBufferFaded, gPlttBufferUnfaded, 0x400);
|
CpuCopy16(gPlttBufferFaded, gPlttBufferUnfaded, 0x400);
|
||||||
BeginNormalPaletteFade(0xFFFFFFFF, 8, 0, 0x10, 0);
|
BeginNormalPaletteFade(0xFFFFFFFF, 8, 0, 0x10, RGB_BLACK);
|
||||||
gTasks[taskId].func = Task_Hof_HandleExit;
|
gTasks[taskId].func = Task_Hof_HandleExit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -748,7 +749,7 @@ static void Task_Hof_HandleExit(u8 taskId)
|
|||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
u8 spriteId = gTasks[taskId].tMonSpriteId(i);
|
u8 spriteId = gTasks[taskId].tMonSpriteId(i);
|
||||||
if (spriteId != 0xFF)
|
if (spriteId != 0xFF)
|
||||||
@ -844,7 +845,7 @@ void CB2_DoHallOfFamePC(void)
|
|||||||
SetGpuReg(REG_OFFSET_BLDY, 0);
|
SetGpuReg(REG_OFFSET_BLDY, 0);
|
||||||
taskId = CreateTask(Task_HofPC_CopySaveData, 0);
|
taskId = CreateTask(Task_HofPC_CopySaveData, 0);
|
||||||
|
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
gTasks[taskId].tMonSpriteId(i) = 0xFF;
|
gTasks[taskId].tMonSpriteId(i) = 0xFF;
|
||||||
}
|
}
|
||||||
@ -901,7 +902,7 @@ static void Task_HofPC_DrawSpritesPrintText(u8 taskId)
|
|||||||
gTasks[taskId].tCurrMonId = 0;
|
gTasks[taskId].tCurrMonId = 0;
|
||||||
gTasks[taskId].tMonNo = 0;
|
gTasks[taskId].tMonNo = 0;
|
||||||
|
|
||||||
for (i = 0; i < 6; i++, currMon++)
|
for (i = 0; i < PARTY_SIZE; i++, currMon++)
|
||||||
{
|
{
|
||||||
if (currMon->species != 0)
|
if (currMon->species != 0)
|
||||||
gTasks[taskId].tMonNo++;
|
gTasks[taskId].tMonNo++;
|
||||||
@ -909,7 +910,7 @@ static void Task_HofPC_DrawSpritesPrintText(u8 taskId)
|
|||||||
|
|
||||||
currMon = &savedTeams->mon[0];
|
currMon = &savedTeams->mon[0];
|
||||||
|
|
||||||
for (i = 0; i < 6; i++, currMon++)
|
for (i = 0; i < PARTY_SIZE; i++, currMon++)
|
||||||
{
|
{
|
||||||
if (currMon->species != 0)
|
if (currMon->species != 0)
|
||||||
{
|
{
|
||||||
@ -940,7 +941,7 @@ static void Task_HofPC_DrawSpritesPrintText(u8 taskId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BlendPalettes(0xFFFF0000, 0xC, 0x63B0);
|
BlendPalettes(0xFFFF0000, 0xC, RGB(16, 29, 24));
|
||||||
|
|
||||||
ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].tCurrPageNo, STR_CONV_MODE_RIGHT_ALIGN, 3);
|
ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].tCurrPageNo, STR_CONV_MODE_RIGHT_ALIGN, 3);
|
||||||
StringExpandPlaceholders(gStringVar4, gText_HOFNumber);
|
StringExpandPlaceholders(gStringVar4, gText_HOFNumber);
|
||||||
@ -963,7 +964,7 @@ static void Task_HofPC_PrintMonInfo(u8 taskId)
|
|||||||
for (i = 0; i < gTasks[taskId].tCurrTeamNo; i++)
|
for (i = 0; i < gTasks[taskId].tCurrTeamNo; i++)
|
||||||
savedTeams++;
|
savedTeams++;
|
||||||
|
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
u16 spriteId = gTasks[taskId].tMonSpriteId(i);
|
u16 spriteId = gTasks[taskId].tMonSpriteId(i);
|
||||||
if (spriteId != 0xFF)
|
if (spriteId != 0xFF)
|
||||||
@ -973,7 +974,7 @@ static void Task_HofPC_PrintMonInfo(u8 taskId)
|
|||||||
currMonID = gTasks[taskId].tMonSpriteId(gTasks[taskId].tCurrMonId);
|
currMonID = gTasks[taskId].tMonSpriteId(gTasks[taskId].tCurrMonId);
|
||||||
gSprites[currMonID].oam.priority = 0;
|
gSprites[currMonID].oam.priority = 0;
|
||||||
sUnknown_0203BCD4 = (0x10000 << gSprites[currMonID].oam.paletteNum) ^ 0xFFFF0000;
|
sUnknown_0203BCD4 = (0x10000 << gSprites[currMonID].oam.paletteNum) ^ 0xFFFF0000;
|
||||||
BlendPalettesUnfaded(sUnknown_0203BCD4, 0xC, 0x63B0);
|
BlendPalettesUnfaded(sUnknown_0203BCD4, 0xC, RGB(16, 29, 24));
|
||||||
|
|
||||||
currMon = &savedTeams->mon[gTasks[taskId].tCurrMonId];
|
currMon = &savedTeams->mon[gTasks[taskId].tCurrMonId];
|
||||||
if (currMon->species != SPECIES_EGG)
|
if (currMon->species != SPECIES_EGG)
|
||||||
@ -1056,7 +1057,7 @@ static void Task_HofPC_HandleExit(u8 taskId)
|
|||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
|
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
u16 spriteId = gTasks[taskId].tMonSpriteId(i);
|
u16 spriteId = gTasks[taskId].tMonSpriteId(i);
|
||||||
if (spriteId != 0xFF)
|
if (spriteId != 0xFF)
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "constants/species.h"
|
#include "constants/species.h"
|
||||||
#include "string_util.h"
|
#include "string_util.h"
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
|
#include "pokemon_storage_system.h"
|
||||||
|
|
||||||
static EWRAM_DATA u16 sWinNumberDigit = 0;
|
static EWRAM_DATA u16 sWinNumberDigit = 0;
|
||||||
static EWRAM_DATA u16 sOtIdDigit = 0;
|
static EWRAM_DATA u16 sOtIdDigit = 0;
|
||||||
@ -55,23 +56,22 @@ void PickLotteryCornerTicket(void)
|
|||||||
gSpecialVar_0x8004 = 0;
|
gSpecialVar_0x8004 = 0;
|
||||||
slot = 0;
|
slot = 0;
|
||||||
box = 0;
|
box = 0;
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
struct Pokemon *pkmn = &gPlayerParty[i];
|
struct Pokemon *mon = &gPlayerParty[i];
|
||||||
|
|
||||||
// UB: Too few arguments for function GetMonData
|
if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE)
|
||||||
if (GetMonData(pkmn, MON_DATA_SPECIES) != SPECIES_NONE)
|
|
||||||
{
|
{
|
||||||
// do not calculate ticket values for eggs.
|
// do not calculate ticket values for eggs.
|
||||||
if (!GetMonData(pkmn, MON_DATA_IS_EGG))
|
if (!GetMonData(mon, MON_DATA_IS_EGG))
|
||||||
{
|
{
|
||||||
u32 otId = GetMonData(pkmn, MON_DATA_OT_ID);
|
u32 otId = GetMonData(mon, MON_DATA_OT_ID);
|
||||||
u8 numMatchingDigits = GetMatchingDigits(gSpecialVar_Result, otId);
|
u8 numMatchingDigits = GetMatchingDigits(gSpecialVar_Result, otId);
|
||||||
|
|
||||||
if (numMatchingDigits > gSpecialVar_0x8004 && numMatchingDigits > 1)
|
if (numMatchingDigits > gSpecialVar_0x8004 && numMatchingDigits > 1)
|
||||||
{
|
{
|
||||||
gSpecialVar_0x8004 = numMatchingDigits - 1;
|
gSpecialVar_0x8004 = numMatchingDigits - 1;
|
||||||
box = 14;
|
box = TOTAL_BOXES_COUNT;
|
||||||
slot = i;
|
slot = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,11 +80,9 @@ void PickLotteryCornerTicket(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// player has 14 boxes.
|
for (i = 0; i < TOTAL_BOXES_COUNT; i++)
|
||||||
for (i = 0; i < 14; i++)
|
|
||||||
{
|
{
|
||||||
// player has 30 slots per box.
|
for (j = 0; j < IN_BOX_COUNT; j++)
|
||||||
for (j = 0; j < 30; j++)
|
|
||||||
{
|
{
|
||||||
if (GetBoxMonData(&gPokemonStoragePtr->boxes[i][j], MON_DATA_SPECIES) != SPECIES_NONE &&
|
if (GetBoxMonData(&gPokemonStoragePtr->boxes[i][j], MON_DATA_SPECIES) != SPECIES_NONE &&
|
||||||
!GetBoxMonData(&gPokemonStoragePtr->boxes[i][j], MON_DATA_IS_EGG))
|
!GetBoxMonData(&gPokemonStoragePtr->boxes[i][j], MON_DATA_IS_EGG))
|
||||||
@ -106,7 +104,7 @@ void PickLotteryCornerTicket(void)
|
|||||||
{
|
{
|
||||||
gSpecialVar_0x8005 = sLotteryPrizes[gSpecialVar_0x8004 - 1];
|
gSpecialVar_0x8005 = sLotteryPrizes[gSpecialVar_0x8004 - 1];
|
||||||
|
|
||||||
if (box == 14)
|
if (box == TOTAL_BOXES_COUNT)
|
||||||
{
|
{
|
||||||
gSpecialVar_0x8006 = 0;
|
gSpecialVar_0x8006 = 0;
|
||||||
GetMonData(&gPlayerParty[slot], MON_DATA_NICKNAME, gStringVar1);
|
GetMonData(&gPlayerParty[slot], MON_DATA_NICKNAME, gStringVar1);
|
||||||
|
@ -517,7 +517,7 @@ void LoadSaveblockEventObjScripts(void)
|
|||||||
struct EventObjectTemplate *savObjTemplates = gSaveBlock1Ptr->eventObjectTemplates;
|
struct EventObjectTemplate *savObjTemplates = gSaveBlock1Ptr->eventObjectTemplates;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = 0; i < 64; i++)
|
for (i = 0; i < EVENT_OBJECT_TEMPLATES_COUNT; i++)
|
||||||
savObjTemplates[i].script = mapHeaderObjTemplates[i].script;
|
savObjTemplates[i].script = mapHeaderObjTemplates[i].script;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -526,7 +526,7 @@ void Overworld_SetEventObjTemplateCoords(u8 localId, s16 x, s16 y)
|
|||||||
s32 i;
|
s32 i;
|
||||||
struct EventObjectTemplate *savObjTemplates = gSaveBlock1Ptr->eventObjectTemplates;
|
struct EventObjectTemplate *savObjTemplates = gSaveBlock1Ptr->eventObjectTemplates;
|
||||||
|
|
||||||
for (i = 0; i < 64; i++)
|
for (i = 0; i < EVENT_OBJECT_TEMPLATES_COUNT; i++)
|
||||||
{
|
{
|
||||||
struct EventObjectTemplate *eventObjectTemplate = &savObjTemplates[i];
|
struct EventObjectTemplate *eventObjectTemplate = &savObjTemplates[i];
|
||||||
if (eventObjectTemplate->localId == localId)
|
if (eventObjectTemplate->localId == localId)
|
||||||
@ -543,7 +543,7 @@ void Overworld_SetEventObjTemplateMovementType(u8 localId, u8 movementType)
|
|||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
struct EventObjectTemplate *savObjTemplates = gSaveBlock1Ptr->eventObjectTemplates;
|
struct EventObjectTemplate *savObjTemplates = gSaveBlock1Ptr->eventObjectTemplates;
|
||||||
for (i = 0; i < 64; i++)
|
for (i = 0; i < EVENT_OBJECT_TEMPLATES_COUNT; i++)
|
||||||
{
|
{
|
||||||
struct EventObjectTemplate *eventObjectTemplate = &savObjTemplates[i];
|
struct EventObjectTemplate *eventObjectTemplate = &savObjTemplates[i];
|
||||||
if (eventObjectTemplate->localId == localId)
|
if (eventObjectTemplate->localId == localId)
|
||||||
|
@ -206,13 +206,13 @@ void GiveGiftRibbonToParty(u8 index, u8 ribbonId)
|
|||||||
if (index < 11 && ribbonId < 65)
|
if (index < 11 && ribbonId < 65)
|
||||||
{
|
{
|
||||||
gSaveBlock1Ptr->giftRibbons[index] = ribbonId;
|
gSaveBlock1Ptr->giftRibbons[index] = ribbonId;
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
struct Pokemon *pkmn = &gPlayerParty[i];
|
struct Pokemon *mon = &gPlayerParty[i];
|
||||||
|
|
||||||
if (GetMonData(pkmn, MON_DATA_SPECIES) != 0 && GetMonData(pkmn, MON_DATA_SANITY_BIT3) == 0)
|
if (GetMonData(mon, MON_DATA_SPECIES) != 0 && GetMonData(mon, MON_DATA_SANITY_BIT3) == 0)
|
||||||
{
|
{
|
||||||
SetMonData(pkmn, array[index], &data);
|
SetMonData(mon, array[index], &data);
|
||||||
gotRibbon = TRUE;
|
gotRibbon = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ int GameClear(void)
|
|||||||
|
|
||||||
ribbonGet = FALSE;
|
ribbonGet = FALSE;
|
||||||
|
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
struct Pokemon *mon = &gPlayerParty[i];
|
struct Pokemon *mon = &gPlayerParty[i];
|
||||||
|
|
||||||
|
@ -1713,8 +1713,8 @@ bool8 ScrCmd_checkpartymove(struct ScriptContext *ctx)
|
|||||||
u8 i;
|
u8 i;
|
||||||
u16 moveId = ScriptReadHalfword(ctx);
|
u16 moveId = ScriptReadHalfword(ctx);
|
||||||
|
|
||||||
gSpecialVar_Result = 6;
|
gSpecialVar_Result = PARTY_SIZE;
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
u16 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL);
|
u16 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL);
|
||||||
if (!species)
|
if (!species)
|
||||||
|
Loading…
Reference in New Issue
Block a user