Add misc party constant usage
This commit is contained in:
+27
-26
@@ -24,6 +24,7 @@
|
||||
#include "tv.h"
|
||||
#include "battle_factory.h"
|
||||
#include "constants/apprentice.h"
|
||||
#include "constants/battle_dome.h"
|
||||
#include "constants/battle_frontier.h"
|
||||
#include "constants/battle_frontier_mons.h"
|
||||
#include "constants/battle_tent_mons.h"
|
||||
@@ -2054,7 +2055,7 @@ void DoSpecialTrainerBattle(void)
|
||||
if (VarGet(VAR_FRONTIER_BATTLE_MODE) == FRONTIER_MODE_DOUBLES)
|
||||
gBattleTypeFlags |= BATTLE_TYPE_DOUBLE;
|
||||
if (gTrainerBattleOpponent_A == TRAINER_FRONTIER_BRAIN)
|
||||
FillFrontierTrainerParty(2);
|
||||
FillFrontierTrainerParty(DOME_BATTLE_PARTY_SIZE);
|
||||
CreateTask(Task_StartBattleAfterTransition, 1);
|
||||
sub_806E694(0);
|
||||
BattleTransition_StartOnField(sub_80B100C(3));
|
||||
@@ -2211,12 +2212,12 @@ static void nullsub_116(void)
|
||||
static void GetApprenticeMultiPartnerParty(u16 trainerId)
|
||||
{
|
||||
s32 i, count;
|
||||
u32 validSpecies[3];
|
||||
u32 validSpecies[MULTI_PARTY_SIZE];
|
||||
u16 species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES, NULL);
|
||||
u16 species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES, NULL);
|
||||
|
||||
count = 0;
|
||||
for (i = 0; i < 3; i++)
|
||||
for (i = 0; i < MULTI_PARTY_SIZE; i++)
|
||||
{
|
||||
u16 apprenticeSpecies = gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].party[i].species;
|
||||
if (apprenticeSpecies != species1 && apprenticeSpecies != species2)
|
||||
@@ -2340,7 +2341,7 @@ static void LoadMultiPartnerCandidatesData(void)
|
||||
&& gSaveBlock2Ptr->apprentices[i].lvlMode - 1 == lvlMode)
|
||||
{
|
||||
k = 0;
|
||||
for (j = 0; j < 3; j++)
|
||||
for (j = 0; j < MULTI_PARTY_SIZE; j++)
|
||||
{
|
||||
if (species1 != gSaveBlock2Ptr->apprentices[i].party[j].species
|
||||
&& species2 != gSaveBlock2Ptr->apprentices[i].party[j].species)
|
||||
@@ -2948,26 +2949,26 @@ static void FillPartnerParty(u16 trainerId)
|
||||
|
||||
if (trainerId == TRAINER_STEVEN_PARTNER)
|
||||
{
|
||||
for (i = 0; i < 3; i++)
|
||||
for (i = 0; i < MULTI_PARTY_SIZE; i++)
|
||||
{
|
||||
do
|
||||
{
|
||||
j = Random32();
|
||||
} while (IsShinyOtIdPersonality(STEVEN_OTID, j) || sStevenMons[i].nature != GetNatureFromPersonality(j));
|
||||
CreateMon(&gPlayerParty[3 + i],
|
||||
CreateMon(&gPlayerParty[MULTI_PARTY_SIZE + i],
|
||||
sStevenMons[i].species,
|
||||
sStevenMons[i].level,
|
||||
sStevenMons[i].fixedIV,
|
||||
TRUE, i, // BUG: personality was stored in the 'j' variable. As a result, Steven's pokemon do not have the intended natures.
|
||||
OT_ID_PRESET, STEVEN_OTID);
|
||||
for (j = 0; j < PARTY_SIZE; j++)
|
||||
SetMonData(&gPlayerParty[3 + i], MON_DATA_HP_EV + j, &sStevenMons[i].evs[j]);
|
||||
SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_HP_EV + j, &sStevenMons[i].evs[j]);
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
SetMonMoveSlot(&gPlayerParty[3 + i], sStevenMons[i].moves[j], j);
|
||||
SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_NAME, gTrainers[TRAINER_STEVEN].trainerName);
|
||||
SetMonMoveSlot(&gPlayerParty[MULTI_PARTY_SIZE + i], sStevenMons[i].moves[j], j);
|
||||
SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_OT_NAME, gTrainers[TRAINER_STEVEN].trainerName);
|
||||
j = MALE;
|
||||
SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_GENDER, &j);
|
||||
CalculateMonStats(&gPlayerParty[3 + i]);
|
||||
SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_OT_GENDER, &j);
|
||||
CalculateMonStats(&gPlayerParty[MULTI_PARTY_SIZE + i]);
|
||||
}
|
||||
}
|
||||
else if (trainerId == TRAINER_EREADER)
|
||||
@@ -2980,10 +2981,10 @@ static void FillPartnerParty(u16 trainerId)
|
||||
level = SetFacilityPtrsGetLevel();
|
||||
ivs = GetFrontierTrainerFixedIvs(trainerId);
|
||||
otID = Random32();
|
||||
for (i = 0; i < 2; i++)
|
||||
for (i = 0; i < FRONTIER_MULTI_PARTY_SIZE; i++)
|
||||
{
|
||||
monId = gSaveBlock2Ptr->frontier.trainerIds[i + 18];
|
||||
CreateMonWithEVSpreadNatureOTID(&gPlayerParty[3 + i],
|
||||
CreateMonWithEVSpreadNatureOTID(&gPlayerParty[MULTI_PARTY_SIZE + i],
|
||||
gFacilityTrainerMons[monId].species,
|
||||
level,
|
||||
gFacilityTrainerMons[monId].nature,
|
||||
@@ -2993,23 +2994,23 @@ static void FillPartnerParty(u16 trainerId)
|
||||
friendship = MAX_FRIENDSHIP;
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
SetMonMoveSlot(&gPlayerParty[3 + i], gFacilityTrainerMons[monId].moves[j], j);
|
||||
SetMonMoveSlot(&gPlayerParty[MULTI_PARTY_SIZE + i], gFacilityTrainerMons[monId].moves[j], j);
|
||||
if (gFacilityTrainerMons[monId].moves[j] == MOVE_FRUSTRATION)
|
||||
friendship = 0;
|
||||
}
|
||||
SetMonData(&gPlayerParty[3 + i], MON_DATA_FRIENDSHIP, &friendship);
|
||||
SetMonData(&gPlayerParty[3 + i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]);
|
||||
SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_FRIENDSHIP, &friendship);
|
||||
SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]);
|
||||
for (j = 0; j < PLAYER_NAME_LENGTH + 1; j++)
|
||||
trainerName[j] = gFacilityTrainers[trainerId].trainerName[j];
|
||||
SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_NAME, &trainerName);
|
||||
SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_OT_NAME, &trainerName);
|
||||
j = IsFrontierTrainerFemale(trainerId);
|
||||
SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_GENDER, &j);
|
||||
SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_OT_GENDER, &j);
|
||||
}
|
||||
}
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
|
||||
{
|
||||
trainerId -= TRAINER_RECORD_MIXING_FRIEND;
|
||||
for (i = 0; i < 2; i++)
|
||||
for (i = 0; i < FRONTIER_MULTI_PARTY_SIZE; i++)
|
||||
{
|
||||
struct EmeraldBattleTowerRecord *record = &gSaveBlock2Ptr->frontier.towerRecords[trainerId];
|
||||
struct BattleTowerPokemon monData = record->party[gSaveBlock2Ptr->frontier.trainerIds[18 + i]];
|
||||
@@ -3027,20 +3028,20 @@ static void FillPartnerParty(u16 trainerId)
|
||||
if (monData.nickname[0] == EXT_CTRL_CODE_BEGIN && monData.nickname[1] == EXT_CTRL_CODE_JPN)
|
||||
trainerName[5] = EOS;
|
||||
}
|
||||
CreateBattleTowerMon2(&gPlayerParty[3 + i], &monData, TRUE);
|
||||
SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_NAME, trainerName);
|
||||
CreateBattleTowerMon2(&gPlayerParty[MULTI_PARTY_SIZE + i], &monData, TRUE);
|
||||
SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_OT_NAME, trainerName);
|
||||
j = IsFrontierTrainerFemale(trainerId + TRAINER_RECORD_MIXING_FRIEND);
|
||||
SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_GENDER, &j);
|
||||
SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_OT_GENDER, &j);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
trainerId -= TRAINER_RECORD_MIXING_APPRENTICE;
|
||||
for (i = 0; i < 2; i++)
|
||||
for (i = 0; i < FRONTIER_MULTI_PARTY_SIZE; i++)
|
||||
{
|
||||
CreateApprenticeMon(&gPlayerParty[3 + i], &gSaveBlock2Ptr->apprentices[trainerId], gSaveBlock2Ptr->frontier.trainerIds[18 + i]);
|
||||
CreateApprenticeMon(&gPlayerParty[MULTI_PARTY_SIZE + i], &gSaveBlock2Ptr->apprentices[trainerId], gSaveBlock2Ptr->frontier.trainerIds[18 + i]);
|
||||
j = IsFrontierTrainerFemale(trainerId + TRAINER_RECORD_MIXING_APPRENTICE);
|
||||
SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_GENDER, &j);
|
||||
SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_OT_GENDER, &j);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3351,7 +3352,7 @@ static void SetNextBattleTentOpponent(void)
|
||||
static void FillTentTrainerParty_(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
{
|
||||
s32 i, j;
|
||||
u16 chosenMonIndices[4];
|
||||
u16 chosenMonIndices[MAX_FRONTIER_PARTY_SIZE];
|
||||
u8 friendship;
|
||||
u8 level = SetTentPtrsGetLevel();
|
||||
u8 fixedIV = 0;
|
||||
|
||||
Reference in New Issue
Block a user