Merge pull request #949 from GriffinRichards/doc-dome
Document Battle Dome and add facility party constants
This commit is contained in:
@@ -2676,8 +2676,9 @@ static void PlayerHandleHealthBarUpdate(void)
|
||||
LoadBattleBarGfx(0);
|
||||
hpVal = gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8);
|
||||
|
||||
// gPlayerPartyLostHP used by Battle Dome, but never read
|
||||
if (hpVal > 0)
|
||||
gUnknown_0203CD70 += hpVal;
|
||||
gPlayerPartyLostHP += hpVal;
|
||||
|
||||
if (hpVal != INSTANT_HP_BAR_DROP)
|
||||
{
|
||||
|
||||
+2598
-2597
File diff suppressed because it is too large
Load Diff
@@ -12,6 +12,7 @@
|
||||
#include "constants/battle_ai.h"
|
||||
#include "constants/battle_factory.h"
|
||||
#include "constants/battle_frontier.h"
|
||||
#include "constants/battle_frontier_mons.h"
|
||||
#include "constants/frontier_util.h"
|
||||
#include "constants/layouts.h"
|
||||
#include "constants/trainers.h"
|
||||
@@ -304,7 +305,7 @@ static void GenerateOpponentMons(void)
|
||||
|
||||
do
|
||||
{
|
||||
trainerId = sub_8162548(challengeNum, gSaveBlock2Ptr->frontier.curChallengeBattleNum);
|
||||
trainerId = GetRandomScaledFrontierTrainerId(challengeNum, gSaveBlock2Ptr->frontier.curChallengeBattleNum);
|
||||
for (i = 0; i < gSaveBlock2Ptr->frontier.curChallengeBattleNum; i++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId)
|
||||
@@ -331,7 +332,7 @@ static void GenerateOpponentMons(void)
|
||||
if (j != 6)
|
||||
continue;
|
||||
|
||||
if (lvlMode == FRONTIER_LVL_50 && monSetId > 849)
|
||||
if (lvlMode == FRONTIER_LVL_50 && monSetId > FRONTIER_MONS_HIGH_TIER)
|
||||
continue;
|
||||
|
||||
for (k = firstMonId; k < firstMonId + i; k++)
|
||||
@@ -727,7 +728,7 @@ void FillFactoryBrainParty(void)
|
||||
|
||||
if (gFacilityTrainerMons[monSetId].species == SPECIES_UNOWN)
|
||||
continue;
|
||||
if (monLevel == 50 && monSetId > 849)
|
||||
if (monLevel == 50 && monSetId > FRONTIER_MONS_HIGH_TIER)
|
||||
continue;
|
||||
|
||||
for (j = 0; j < 6; j++)
|
||||
|
||||
+1
-1
@@ -159,7 +159,7 @@ static void SetPalaceOpponent(void)
|
||||
|
||||
static void BufferOpponentIntroSpeech(void)
|
||||
{
|
||||
if (gTrainerBattleOpponent_A < TRAINER_RECORD_MIXING_FRIEND)
|
||||
if (gTrainerBattleOpponent_A < FRONTIER_TRAINERS_COUNT)
|
||||
FrontierSpeechToString(gFacilityTrainers[gTrainerBattleOpponent_A].speechBefore);
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -1400,7 +1400,7 @@ static void PrepareOneTrainer(bool8 difficult)
|
||||
challengeNum = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] / 14;
|
||||
do
|
||||
{
|
||||
trainerId = sub_8162548(challengeNum, battleNum);
|
||||
trainerId = GetRandomScaledFrontierTrainerId(challengeNum, battleNum);
|
||||
for (i = 0; i < gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1; i++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId)
|
||||
@@ -1425,7 +1425,7 @@ static void PrepareTwoTrainers(void)
|
||||
gFacilityTrainers = gBattleFrontierTrainers;
|
||||
do
|
||||
{
|
||||
trainerId = sub_8162548(challengeNum, 1);
|
||||
trainerId = GetRandomScaledFrontierTrainerId(challengeNum, 1);
|
||||
for (i = 0; i < gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1; i++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId)
|
||||
@@ -1440,7 +1440,7 @@ static void PrepareTwoTrainers(void)
|
||||
|
||||
do
|
||||
{
|
||||
trainerId = sub_8162548(challengeNum, 1);
|
||||
trainerId = GetRandomScaledFrontierTrainerId(challengeNum, 1);
|
||||
for (i = 0; i < gSaveBlock2Ptr->frontier.curChallengeBattleNum; i++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId)
|
||||
@@ -1466,12 +1466,12 @@ static void BufferTrainerIntro(void)
|
||||
{
|
||||
if (gSpecialVar_0x8005 == 0)
|
||||
{
|
||||
if (gTrainerBattleOpponent_A < TRAINER_RECORD_MIXING_FRIEND)
|
||||
if (gTrainerBattleOpponent_A < FRONTIER_TRAINERS_COUNT)
|
||||
FrontierSpeechToString(gFacilityTrainers[gTrainerBattleOpponent_A].speechBefore);
|
||||
}
|
||||
else if (gSpecialVar_0x8005 == 1)
|
||||
{
|
||||
if (gTrainerBattleOpponent_B < TRAINER_RECORD_MIXING_FRIEND)
|
||||
if (gTrainerBattleOpponent_B < FRONTIER_TRAINERS_COUNT)
|
||||
FrontierSpeechToString(gFacilityTrainers[gTrainerBattleOpponent_B].speechBefore);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1493,7 +1493,7 @@ static u16 GetUniqueTrainerId(u8 eventObjectId)
|
||||
{
|
||||
do
|
||||
{
|
||||
trainerId = sub_8162548(challengeNum + 1, battleNum);
|
||||
trainerId = GetRandomScaledFrontierTrainerId(challengeNum + 1, battleNum);
|
||||
for (i = 0; i < eventObjectId; i++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId)
|
||||
@@ -1505,7 +1505,7 @@ static u16 GetUniqueTrainerId(u8 eventObjectId)
|
||||
{
|
||||
do
|
||||
{
|
||||
trainerId = sub_8162548(challengeNum, battleNum);
|
||||
trainerId = GetRandomScaledFrontierTrainerId(challengeNum, battleNum);
|
||||
for (i = 0; i < eventObjectId; i++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId)
|
||||
|
||||
+6
-6
@@ -961,12 +961,12 @@ static u8 TrainerBattleLoadArg8(const u8 *ptr)
|
||||
|
||||
static u16 GetTrainerAFlag(void)
|
||||
{
|
||||
return FLAG_TRAINER_FLAG_START + gTrainerBattleOpponent_A;
|
||||
return TRAINER_FLAGS_START + gTrainerBattleOpponent_A;
|
||||
}
|
||||
|
||||
static u16 GetTrainerBFlag(void)
|
||||
{
|
||||
return FLAG_TRAINER_FLAG_START + gTrainerBattleOpponent_B;
|
||||
return TRAINER_FLAGS_START + gTrainerBattleOpponent_B;
|
||||
}
|
||||
|
||||
static bool32 IsPlayerDefeated(u32 battleOutcome)
|
||||
@@ -1193,7 +1193,7 @@ void SetUpTwoTrainersBattle(void)
|
||||
bool32 GetTrainerFlagFromScriptPointer(const u8 *data)
|
||||
{
|
||||
u32 flag = TrainerBattleLoadArg16(data + 2);
|
||||
return FlagGet(FLAG_TRAINER_FLAG_START + flag);
|
||||
return FlagGet(TRAINER_FLAGS_START + flag);
|
||||
}
|
||||
|
||||
void SetUpTrainerMovement(void)
|
||||
@@ -1232,17 +1232,17 @@ static void SetBattledTrainerFlag(void)
|
||||
|
||||
bool8 HasTrainerBeenFought(u16 trainerId)
|
||||
{
|
||||
return FlagGet(FLAG_TRAINER_FLAG_START + trainerId);
|
||||
return FlagGet(TRAINER_FLAGS_START + trainerId);
|
||||
}
|
||||
|
||||
void SetTrainerFlag(u16 trainerId)
|
||||
{
|
||||
FlagSet(FLAG_TRAINER_FLAG_START + trainerId);
|
||||
FlagSet(TRAINER_FLAGS_START + trainerId);
|
||||
}
|
||||
|
||||
void ClearTrainerFlag(u16 trainerId)
|
||||
{
|
||||
FlagClear(FLAG_TRAINER_FLAG_START + trainerId);
|
||||
FlagClear(TRAINER_FLAGS_START + trainerId);
|
||||
}
|
||||
|
||||
void BattleSetup_StartTrainerBattle(void)
|
||||
|
||||
+13
-11
@@ -12,6 +12,8 @@
|
||||
#include "frontier_util.h"
|
||||
#include "string_util.h"
|
||||
#include "constants/battle_tent.h"
|
||||
#include "constants/battle_tent_trainers.h"
|
||||
#include "constants/battle_tent_mons.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/layouts.h"
|
||||
#include "constants/region_map_sections.h"
|
||||
@@ -134,7 +136,7 @@ static void SetVerdanturfTentTrainerGfx(void)
|
||||
|
||||
static void BufferVerdanturfTentTrainerIntro(void)
|
||||
{
|
||||
if (gTrainerBattleOpponent_A < TRAINER_RECORD_MIXING_FRIEND)
|
||||
if (gTrainerBattleOpponent_A < FRONTIER_TRAINERS_COUNT)
|
||||
FrontierSpeechToString(gFacilityTrainers[gTrainerBattleOpponent_A].speechBefore);
|
||||
}
|
||||
|
||||
@@ -311,7 +313,7 @@ static void GenerateInitialRentalMons(void)
|
||||
while (i != PARTY_SIZE)
|
||||
{
|
||||
// Cannot have two pokemon of the same species.
|
||||
monSetId = Random() % 70;
|
||||
monSetId = Random() % NUM_SLATEPORT_TENT_MONS;
|
||||
for (j = firstMonId; j < firstMonId + i; j++)
|
||||
{
|
||||
u16 monId = monIds[j];
|
||||
@@ -353,10 +355,10 @@ static void GenerateOpponentMons(void)
|
||||
{
|
||||
u16 trainerId;
|
||||
s32 i, j, k;
|
||||
register const u16 *monSets asm("r9"); // Fix me. Compiler insists on moving that variable into stack.
|
||||
register const u16 *monSet asm("r9"); // Fix me. Compiler insists on moving that variable into stack.
|
||||
u16 species[FRONTIER_PARTY_SIZE];
|
||||
u16 heldItems[FRONTIER_PARTY_SIZE];
|
||||
s32 setsCount = 0;
|
||||
s32 monId = 0;
|
||||
|
||||
gFacilityTrainers = gSlateportBattleTentTrainers;
|
||||
gFacilityTrainerMons = gSlateportBattleTentMons;
|
||||
@@ -365,7 +367,7 @@ static void GenerateOpponentMons(void)
|
||||
{
|
||||
do
|
||||
{
|
||||
trainerId = Random() % 30;
|
||||
trainerId = Random() % NUM_BATTLE_TENT_TRAINERS;
|
||||
for (i = 0; i < gSaveBlock2Ptr->frontier.curChallengeBattleNum; i++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId)
|
||||
@@ -374,21 +376,21 @@ static void GenerateOpponentMons(void)
|
||||
} while (i != gSaveBlock2Ptr->frontier.curChallengeBattleNum);
|
||||
|
||||
gTrainerBattleOpponent_A = trainerId;
|
||||
while (gFacilityTrainers[gTrainerBattleOpponent_A].monSets[setsCount] != 0xFFFF)
|
||||
setsCount++;
|
||||
if (setsCount > 8)
|
||||
while (gFacilityTrainers[gTrainerBattleOpponent_A].monSet[monId] != 0xFFFF)
|
||||
monId++;
|
||||
if (monId > 8)
|
||||
break;
|
||||
setsCount = 0;
|
||||
monId = 0;
|
||||
}
|
||||
|
||||
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < 2)
|
||||
gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum] = gTrainerBattleOpponent_A;
|
||||
|
||||
monSets = gFacilityTrainers[gTrainerBattleOpponent_A].monSets;
|
||||
monSet = gFacilityTrainers[gTrainerBattleOpponent_A].monSet;
|
||||
i = 0;
|
||||
while (i != FRONTIER_PARTY_SIZE)
|
||||
{
|
||||
sRandMonSetId = monSets[Random() % setsCount];
|
||||
sRandMonSetId = monSet[Random() % monId];
|
||||
for (j = 0; j < 6; j++)
|
||||
{
|
||||
if (gFacilityTrainerMons[sRandMonSetId].species == gFacilityTrainerMons[gSaveBlock2Ptr->frontier.rentalMons[j].monId].species)
|
||||
|
||||
+182
-165
@@ -25,6 +25,9 @@
|
||||
#include "battle_factory.h"
|
||||
#include "constants/apprentice.h"
|
||||
#include "constants/battle_frontier.h"
|
||||
#include "constants/battle_frontier_mons.h"
|
||||
#include "constants/battle_tent_mons.h"
|
||||
#include "constants/battle_tent_trainers.h"
|
||||
#include "constants/battle_tower.h"
|
||||
#include "constants/frontier_util.h"
|
||||
#include "constants/items.h"
|
||||
@@ -849,30 +852,37 @@ static const u8 sBattleTowerPartySizes2[] =
|
||||
[FRONTIER_MODE_LINK_MULTIS] = FRONTIER_MULTI_PARTY_SIZE,
|
||||
};
|
||||
|
||||
static const u16 gUnknown_085DF9FA[][2] =
|
||||
// Trainer ID ranges for possible frontier trainers to encounter on particular challenges
|
||||
// Trainers are scaled by difficulty, so higher trainer IDs have better teams
|
||||
static const u16 sFrontierTrainerIdRanges[][2] =
|
||||
{
|
||||
{0x0000, 0x0063},
|
||||
{0x0050, 0x0077},
|
||||
{0x0064, 0x008b},
|
||||
{0x0078, 0x009f},
|
||||
{0x008c, 0x00b3},
|
||||
{0x00a0, 0x00c7},
|
||||
{0x00b4, 0x00db},
|
||||
{0x00c8, 0x012b},
|
||||
{FRONTIER_TRAINER_BRADY, FRONTIER_TRAINER_JILL}, // 0 - 99
|
||||
{FRONTIER_TRAINER_TREVIN, FRONTIER_TRAINER_CHLOE}, // 80 - 119
|
||||
{FRONTIER_TRAINER_ERIK, FRONTIER_TRAINER_SOFIA}, // 100 - 139
|
||||
{FRONTIER_TRAINER_NORTON, FRONTIER_TRAINER_JAZLYN}, // 120 - 159
|
||||
{FRONTIER_TRAINER_BRADEN, FRONTIER_TRAINER_ALISON}, // 140 - 179
|
||||
{FRONTIER_TRAINER_ZACHERY, FRONTIER_TRAINER_LAMAR}, // 160 - 199
|
||||
{FRONTIER_TRAINER_HANK, FRONTIER_TRAINER_TESS}, // 180 - 219
|
||||
{FRONTIER_TRAINER_JAXON, FRONTIER_TRAINER_GRETEL}, // 200 - 299
|
||||
};
|
||||
|
||||
static const u16 gUnknown_085DFA1A[][2] =
|
||||
static const u16 sFrontierTrainerIdRangesHard[][2] =
|
||||
{
|
||||
{0x0064, 0x0077},
|
||||
{0x0078, 0x008b},
|
||||
{0x008c, 0x009f},
|
||||
{0x00a0, 0x00b3},
|
||||
{0x00b4, 0x00c7},
|
||||
{0x00c8, 0x00db},
|
||||
{0x00dc, 0x00ef},
|
||||
{0x00c8, 0x012b},
|
||||
{0x00b3, 0x008d},
|
||||
{0x00c8, 0x00b7},
|
||||
{FRONTIER_TRAINER_ERIK, FRONTIER_TRAINER_CHLOE}, // 100 - 119
|
||||
{FRONTIER_TRAINER_NORTON, FRONTIER_TRAINER_SOFIA}, // 120 - 139
|
||||
{FRONTIER_TRAINER_BRADEN, FRONTIER_TRAINER_JAZLYN}, // 140 - 159
|
||||
{FRONTIER_TRAINER_ZACHERY, FRONTIER_TRAINER_ALISON}, // 160 - 179
|
||||
{FRONTIER_TRAINER_HANK, FRONTIER_TRAINER_LAMAR}, // 180 - 199
|
||||
{FRONTIER_TRAINER_JAXON, FRONTIER_TRAINER_TESS}, // 200 - 219
|
||||
{FRONTIER_TRAINER_LEON, FRONTIER_TRAINER_RAUL}, // 220 - 239
|
||||
{FRONTIER_TRAINER_JAXON, FRONTIER_TRAINER_GRETEL}, // 200 - 299
|
||||
};
|
||||
|
||||
// Trainer IDs? Don't make sense as part of previous array, min/max relationship reversed and never accessed
|
||||
static const u16 sUnused_085DFA1A[][2] =
|
||||
{
|
||||
{179, 141}, // FRONTIER_TRAINER_ALISON - FRONTIER_TRAINER_KAYDEN
|
||||
{200, 183}, // FRONTIER_TRAINER_JAXON - FRONTIER_TRAINER_HUNTER
|
||||
};
|
||||
|
||||
static const u8 sBattleTowerPartySizes[FRONTIER_MODE_COUNT] =
|
||||
@@ -1077,7 +1087,7 @@ static void SetNextFacilityOpponent(void)
|
||||
s32 i;
|
||||
while (1)
|
||||
{
|
||||
id = sub_8162548(challengeNum, gSaveBlock2Ptr->frontier.curChallengeBattleNum);
|
||||
id = GetRandomScaledFrontierTrainerId(challengeNum, gSaveBlock2Ptr->frontier.curChallengeBattleNum);
|
||||
|
||||
// Ensure trainer wasn't previously fought in this challenge.
|
||||
for (i = 0; i < gSaveBlock2Ptr->frontier.curChallengeBattleNum; i++)
|
||||
@@ -1097,7 +1107,7 @@ static void SetNextFacilityOpponent(void)
|
||||
}
|
||||
}
|
||||
|
||||
u16 sub_8162548(u8 challengeNum, u8 battleNum)
|
||||
u16 GetRandomScaledFrontierTrainerId(u8 challengeNum, u8 battleNum)
|
||||
{
|
||||
u16 trainerId;
|
||||
|
||||
@@ -1105,49 +1115,54 @@ u16 sub_8162548(u8 challengeNum, u8 battleNum)
|
||||
{
|
||||
if (battleNum == 6)
|
||||
{
|
||||
trainerId = (gUnknown_085DFA1A[challengeNum][1] - gUnknown_085DFA1A[challengeNum][0]) + 1;
|
||||
trainerId = gUnknown_085DFA1A[challengeNum][0] + (Random() % trainerId);
|
||||
// The last battle in each challenge has a jump in difficulty, pulls from a table with higher ranges
|
||||
trainerId = (sFrontierTrainerIdRangesHard[challengeNum][1] - sFrontierTrainerIdRangesHard[challengeNum][0]) + 1;
|
||||
trainerId = sFrontierTrainerIdRangesHard[challengeNum][0] + (Random() % trainerId);
|
||||
}
|
||||
else
|
||||
{
|
||||
trainerId = (gUnknown_085DF9FA[challengeNum][1] - gUnknown_085DF9FA[challengeNum][0]) + 1;
|
||||
trainerId = gUnknown_085DF9FA[challengeNum][0] + (Random() % trainerId);
|
||||
trainerId = (sFrontierTrainerIdRanges[challengeNum][1] - sFrontierTrainerIdRanges[challengeNum][0]) + 1;
|
||||
trainerId = sFrontierTrainerIdRanges[challengeNum][0] + (Random() % trainerId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
trainerId = (gUnknown_085DF9FA[7][1] - gUnknown_085DF9FA[7][0]) + 1;
|
||||
trainerId = gUnknown_085DF9FA[7][0] + (Random() % trainerId);
|
||||
// After challenge 7, trainer IDs always come from the last, hardest range, which is the same for both trainer ID tables
|
||||
trainerId = (sFrontierTrainerIdRanges[7][1] - sFrontierTrainerIdRanges[7][0]) + 1;
|
||||
trainerId = sFrontierTrainerIdRanges[7][0] + (Random() % trainerId);
|
||||
}
|
||||
|
||||
return trainerId;
|
||||
}
|
||||
|
||||
static void sub_81625B4(u8 challengeNum, u8 battleNum, u16 *trainerIdPtr, u8 *arg3) // Unused
|
||||
// Unused
|
||||
static void GetRandomScaledFrontierTrainerIdRange(u8 challengeNum, u8 battleNum, u16 *trainerIdPtr, u8 *rangePtr)
|
||||
{
|
||||
u16 trainerId, count;
|
||||
u16 trainerId, range;
|
||||
|
||||
if (challengeNum <= 7)
|
||||
{
|
||||
if (battleNum == 6)
|
||||
{
|
||||
count = (gUnknown_085DFA1A[challengeNum][1] - gUnknown_085DFA1A[challengeNum][0]) + 1;
|
||||
trainerId = gUnknown_085DFA1A[challengeNum][0];
|
||||
// The last battle in each challenge has a jump in difficulty, pulls from a table with higher ranges
|
||||
range = (sFrontierTrainerIdRangesHard[challengeNum][1] - sFrontierTrainerIdRangesHard[challengeNum][0]) + 1;
|
||||
trainerId = sFrontierTrainerIdRangesHard[challengeNum][0];
|
||||
}
|
||||
else
|
||||
{
|
||||
count = (gUnknown_085DF9FA[challengeNum][1] - gUnknown_085DF9FA[challengeNum][0]) + 1;
|
||||
trainerId = gUnknown_085DF9FA[challengeNum][0];
|
||||
range = (sFrontierTrainerIdRanges[challengeNum][1] - sFrontierTrainerIdRanges[challengeNum][0]) + 1;
|
||||
trainerId = sFrontierTrainerIdRanges[challengeNum][0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
count = (gUnknown_085DF9FA[7][1] - gUnknown_085DF9FA[7][0]) + 1;
|
||||
trainerId = gUnknown_085DF9FA[7][0];
|
||||
// After challenge 7, trainer IDs always come from the last, hardest range, which is the same for both trainer ID tables
|
||||
range = (sFrontierTrainerIdRanges[7][1] - sFrontierTrainerIdRanges[7][0]) + 1;
|
||||
trainerId = sFrontierTrainerIdRanges[7][0];
|
||||
}
|
||||
|
||||
*trainerIdPtr = trainerId;
|
||||
*arg3 = count;
|
||||
*rangePtr = range;
|
||||
}
|
||||
|
||||
void SetBattleFacilityTrainerGfxId(u16 trainerId, u8 tempVarId)
|
||||
@@ -1166,7 +1181,7 @@ void SetBattleFacilityTrainerGfxId(u16 trainerId, u8 tempVarId)
|
||||
SetFrontierBrainEventObjGfx_2();
|
||||
return;
|
||||
}
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
else if (trainerId < FRONTIER_TRAINERS_COUNT)
|
||||
{
|
||||
facilityClass = gFacilityTrainers[trainerId].facilityClass;
|
||||
}
|
||||
@@ -1258,7 +1273,7 @@ u8 GetBattleFacilityTrainerGfxId(u16 trainerId)
|
||||
{
|
||||
facilityClass = gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass;
|
||||
}
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
else if (trainerId < FRONTIER_TRAINERS_COUNT)
|
||||
{
|
||||
facilityClass = gFacilityTrainers[trainerId].facilityClass;
|
||||
}
|
||||
@@ -1400,7 +1415,7 @@ u8 GetFrontierTrainerFrontSpriteId(u16 trainerId)
|
||||
{
|
||||
return GetFrontierBrainTrainerPicIndex();
|
||||
}
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
else if (trainerId < FRONTIER_TRAINERS_COUNT)
|
||||
{
|
||||
return gFacilityClassToPicIndex[gFacilityTrainers[trainerId].facilityClass];
|
||||
}
|
||||
@@ -1437,7 +1452,7 @@ u8 GetFrontierOpponentClass(u16 trainerId)
|
||||
{
|
||||
trainerClass = gTrainers[TRAINER_STEVEN].trainerClass;
|
||||
}
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
else if (trainerId < FRONTIER_TRAINERS_COUNT)
|
||||
{
|
||||
trainerClass = gFacilityClassToTrainerClass[gFacilityTrainers[trainerId].facilityClass];
|
||||
}
|
||||
@@ -1478,7 +1493,7 @@ static u8 GetFrontierTrainerFacilityClass(u16 trainerId)
|
||||
{
|
||||
facilityClass = gSaveBlock2Ptr->frontier.ereaderTrainer.facilityClass;
|
||||
}
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
else if (trainerId < FRONTIER_TRAINERS_COUNT)
|
||||
{
|
||||
facilityClass = gFacilityTrainers[trainerId].facilityClass;
|
||||
}
|
||||
@@ -1520,7 +1535,7 @@ void GetFrontierTrainerName(u8 *dst, u16 trainerId)
|
||||
for (i = 0; i < PLAYER_NAME_LENGTH; i++)
|
||||
dst[i] = gTrainers[TRAINER_STEVEN].trainerName[i];
|
||||
}
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
else if (trainerId < FRONTIER_TRAINERS_COUNT)
|
||||
{
|
||||
for (i = 0; i < PLAYER_NAME_LENGTH; i++)
|
||||
dst[i] = gFacilityTrainers[trainerId].trainerName[i];
|
||||
@@ -1575,7 +1590,7 @@ static bool8 IsFrontierTrainerFemale(u16 trainerId)
|
||||
{
|
||||
return IsFrontierBrainFemale();
|
||||
}
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
else if (trainerId < FRONTIER_TRAINERS_COUNT)
|
||||
{
|
||||
facilityClass = gFacilityTrainers[trainerId].facilityClass;
|
||||
}
|
||||
@@ -1623,18 +1638,18 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
{
|
||||
s32 i, j;
|
||||
u16 chosenMonIndices[4];
|
||||
u8 friendship = 0xFF;
|
||||
u8 friendship = MAX_FRIENDSHIP;
|
||||
u8 level = SetFacilityPtrsGetLevel();
|
||||
u8 fixedIV = 0;
|
||||
u8 bfMonCount;
|
||||
const u16 *monSets = NULL;
|
||||
const u16 *monSet = NULL;
|
||||
u32 otID = 0;
|
||||
|
||||
if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
if (trainerId < FRONTIER_TRAINERS_COUNT)
|
||||
{
|
||||
// Normal battle frontier trainer.
|
||||
fixedIV = GetFrontierTrainerFixedIvs(trainerId);
|
||||
monSets = gFacilityTrainers[gTrainerBattleOpponent_A].monSets;
|
||||
monSet = gFacilityTrainers[gTrainerBattleOpponent_A].monSet;
|
||||
}
|
||||
else if (trainerId == TRAINER_EREADER)
|
||||
{
|
||||
@@ -1672,20 +1687,20 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
// Attempt to fill the trainer's party with random Pokemon until 3 have been
|
||||
// successfully chosen. The trainer's party may not have duplicate pokemon species
|
||||
// or duplicate held items.
|
||||
for (bfMonCount = 0; monSets[bfMonCount] != 0xFFFF; bfMonCount++)
|
||||
for (bfMonCount = 0; monSet[bfMonCount] != 0xFFFF; bfMonCount++)
|
||||
;
|
||||
i = 0;
|
||||
otID = Random32();
|
||||
while (i != monCount)
|
||||
{
|
||||
u16 monSetId = monSets[Random() % bfMonCount];
|
||||
if ((level == 50 || level == 20) && monSetId > 849)
|
||||
u16 monId = monSet[Random() % bfMonCount];
|
||||
if ((level == 50 || level == 20) && monId > FRONTIER_MONS_HIGH_TIER)
|
||||
continue;
|
||||
|
||||
// Ensure this pokemon species isn't a duplicate.
|
||||
for (j = 0; j < i + firstMonId; j++)
|
||||
{
|
||||
if (GetMonData(&gEnemyParty[j], MON_DATA_SPECIES, NULL) == gFacilityTrainerMons[monSetId].species)
|
||||
if (GetMonData(&gEnemyParty[j], MON_DATA_SPECIES, NULL) == gFacilityTrainerMons[monId].species)
|
||||
break;
|
||||
}
|
||||
if (j != i + firstMonId)
|
||||
@@ -1695,7 +1710,7 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
for (j = 0; j < i + firstMonId; j++)
|
||||
{
|
||||
if (GetMonData(&gEnemyParty[j], MON_DATA_HELD_ITEM, NULL) != 0
|
||||
&& GetMonData(&gEnemyParty[j], MON_DATA_HELD_ITEM, NULL) == gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId])
|
||||
&& GetMonData(&gEnemyParty[j], MON_DATA_HELD_ITEM, NULL) == gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId])
|
||||
break;
|
||||
}
|
||||
if (j != i + firstMonId)
|
||||
@@ -1705,34 +1720,34 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
// because the species and held items were already checked directly above.
|
||||
for (j = 0; j < i; j++)
|
||||
{
|
||||
if (chosenMonIndices[j] == monSetId)
|
||||
if (chosenMonIndices[j] == monId)
|
||||
break;
|
||||
}
|
||||
if (j != i)
|
||||
continue;
|
||||
|
||||
chosenMonIndices[i] = monSetId;
|
||||
chosenMonIndices[i] = monId;
|
||||
|
||||
// Place the chosen pokemon into the trainer's party.
|
||||
CreateMonWithEVSpreadNatureOTID(&gEnemyParty[i + firstMonId],
|
||||
gFacilityTrainerMons[monSetId].species,
|
||||
gFacilityTrainerMons[monId].species,
|
||||
level,
|
||||
gFacilityTrainerMons[monSetId].nature,
|
||||
gFacilityTrainerMons[monId].nature,
|
||||
fixedIV,
|
||||
gFacilityTrainerMons[monSetId].evSpread,
|
||||
gFacilityTrainerMons[monId].evSpread,
|
||||
otID);
|
||||
|
||||
friendship = 255;
|
||||
friendship = MAX_FRIENDSHIP;
|
||||
// Give the chosen pokemon its specified moves.
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
SetMonMoveSlot(&gEnemyParty[i + firstMonId], gFacilityTrainerMons[monSetId].moves[j], j);
|
||||
if (gFacilityTrainerMons[monSetId].moves[j] == MOVE_FRUSTRATION)
|
||||
SetMonMoveSlot(&gEnemyParty[i + firstMonId], gFacilityTrainerMons[monId].moves[j], j);
|
||||
if (gFacilityTrainerMons[monId].moves[j] == MOVE_FRUSTRATION)
|
||||
friendship = 0; // Frustration is more powerful the lower the pokemon's friendship is.
|
||||
}
|
||||
|
||||
SetMonData(&gEnemyParty[i + firstMonId], MON_DATA_FRIENDSHIP, &friendship);
|
||||
SetMonData(&gEnemyParty[i + firstMonId], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId]);
|
||||
SetMonData(&gEnemyParty[i + firstMonId], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]);
|
||||
|
||||
// The pokemon was successfully added to the trainer's party, so it's safe to move on to
|
||||
// the next party slot.
|
||||
@@ -1744,7 +1759,7 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
static void Unused_CreateApprenticeMons(u16 trainerId, u8 firstMonId)
|
||||
{
|
||||
s32 i, j;
|
||||
u8 friendship = 0xFF;
|
||||
u8 friendship = MAX_FRIENDSHIP;
|
||||
u8 level = 0;
|
||||
u8 fixedIV = 0;
|
||||
struct Apprentice *apprentice = &gSaveBlock2Ptr->apprentices[0];
|
||||
@@ -1762,7 +1777,7 @@ static void Unused_CreateApprenticeMons(u16 trainerId, u8 firstMonId)
|
||||
for (i = 0; i != 3; i++)
|
||||
{
|
||||
CreateMonWithEVSpread(&gEnemyParty[firstMonId + i], apprentice->party[i].species, level, fixedIV, 8);
|
||||
friendship = 0xFF;
|
||||
friendship = MAX_FRIENDSHIP;
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
if (apprentice->party[i].moves[j] == MOVE_FRUSTRATION)
|
||||
@@ -1773,27 +1788,27 @@ static void Unused_CreateApprenticeMons(u16 trainerId, u8 firstMonId)
|
||||
}
|
||||
}
|
||||
|
||||
u16 RandomizeFacilityTrainerMonSet(u16 trainerId)
|
||||
u16 GetRandomFrontierMonFromSet(u16 trainerId)
|
||||
{
|
||||
u8 level = SetFacilityPtrsGetLevel();
|
||||
const u16 *monSets = gFacilityTrainers[trainerId].monSets;
|
||||
u8 bfMonCount = 0;
|
||||
u32 monSetId = monSets[bfMonCount];
|
||||
const u16 *monSet = gFacilityTrainers[trainerId].monSet;
|
||||
u8 numMons = 0;
|
||||
u32 monId = monSet[numMons];
|
||||
|
||||
while (monSetId != 0xFFFF)
|
||||
while (monId != 0xFFFF)
|
||||
{
|
||||
bfMonCount++;
|
||||
monSetId = monSets[bfMonCount];
|
||||
if (monSetId == 0xFFFF)
|
||||
numMons++;
|
||||
monId = monSet[numMons];
|
||||
if (monId == 0xFFFF)
|
||||
break;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
monSetId = monSets[Random() % bfMonCount];
|
||||
} while((level == 50 || level == 20) && monSetId > 849);
|
||||
monId = monSet[Random() % numMons];
|
||||
} while((level == 50 || level == 20) && monId > FRONTIER_MONS_HIGH_TIER);
|
||||
|
||||
return monSetId;
|
||||
return monId;
|
||||
}
|
||||
|
||||
static void FillFactoryTrainerParty(void)
|
||||
@@ -1813,7 +1828,7 @@ static void FillFactoryFrontierTrainerParty(u16 trainerId, u8 firstMonId)
|
||||
u8 fixedIV;
|
||||
u32 otID;
|
||||
|
||||
if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
if (trainerId < FRONTIER_TRAINERS_COUNT)
|
||||
{
|
||||
u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; // Unused variable.
|
||||
u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
|
||||
@@ -1843,21 +1858,21 @@ static void FillFactoryFrontierTrainerParty(u16 trainerId, u8 firstMonId)
|
||||
otID = T1_READ_32(gSaveBlock2Ptr->playerTrainerId);
|
||||
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
|
||||
{
|
||||
u16 monSetId = gUnknown_03006298[i];
|
||||
u16 monId = gUnknown_03006298[i];
|
||||
CreateMonWithEVSpreadNatureOTID(&gEnemyParty[firstMonId + i],
|
||||
gFacilityTrainerMons[monSetId].species,
|
||||
gFacilityTrainerMons[monId].species,
|
||||
level,
|
||||
gFacilityTrainerMons[monSetId].nature,
|
||||
gFacilityTrainerMons[monId].nature,
|
||||
fixedIV,
|
||||
gFacilityTrainerMons[monSetId].evSpread,
|
||||
gFacilityTrainerMons[monId].evSpread,
|
||||
otID);
|
||||
|
||||
friendship = 0;
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
SetMonMoveAvoidReturn(&gEnemyParty[firstMonId + i], gFacilityTrainerMons[monSetId].moves[j], j);
|
||||
SetMonMoveAvoidReturn(&gEnemyParty[firstMonId + i], gFacilityTrainerMons[monId].moves[j], j);
|
||||
|
||||
SetMonData(&gEnemyParty[firstMonId + i], MON_DATA_FRIENDSHIP, &friendship);
|
||||
SetMonData(&gEnemyParty[firstMonId + i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId]);
|
||||
SetMonData(&gEnemyParty[firstMonId + i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1871,25 +1886,25 @@ static void FillFactoryTentTrainerParty(u16 trainerId, u8 firstMonId)
|
||||
|
||||
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
|
||||
{
|
||||
u16 monSetId = gUnknown_03006298[i];
|
||||
u16 monId = gUnknown_03006298[i];
|
||||
CreateMonWithEVSpreadNatureOTID(&gEnemyParty[firstMonId + i],
|
||||
gFacilityTrainerMons[monSetId].species,
|
||||
gFacilityTrainerMons[monId].species,
|
||||
level,
|
||||
gFacilityTrainerMons[monSetId].nature,
|
||||
gFacilityTrainerMons[monId].nature,
|
||||
fixedIV,
|
||||
gFacilityTrainerMons[monSetId].evSpread,
|
||||
gFacilityTrainerMons[monId].evSpread,
|
||||
otID);
|
||||
|
||||
friendship = 0;
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
SetMonMoveAvoidReturn(&gEnemyParty[firstMonId + i], gFacilityTrainerMons[monSetId].moves[j], j);
|
||||
if (gFacilityTrainerMons[monSetId].moves[j] == MOVE_FRUSTRATION)
|
||||
SetMonMoveAvoidReturn(&gEnemyParty[firstMonId + i], gFacilityTrainerMons[monId].moves[j], j);
|
||||
if (gFacilityTrainerMons[monId].moves[j] == MOVE_FRUSTRATION)
|
||||
friendship = 0;
|
||||
}
|
||||
|
||||
SetMonData(&gEnemyParty[firstMonId + i], MON_DATA_FRIENDSHIP, &friendship);
|
||||
SetMonData(&gEnemyParty[firstMonId + i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId]);
|
||||
SetMonData(&gEnemyParty[firstMonId + i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1922,7 +1937,7 @@ static void GetOpponentIntroSpeech(void)
|
||||
|
||||
if (trainerId == TRAINER_EREADER)
|
||||
FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.greeting);
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
else if (trainerId < FRONTIER_TRAINERS_COUNT)
|
||||
FrontierSpeechToString(gFacilityTrainers[trainerId].speechBefore);
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
|
||||
FrontierSpeechToString(gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].greeting);
|
||||
@@ -2150,7 +2165,7 @@ static void sub_8163EE4(void)
|
||||
StringCopy7(playerRecord->name, gSaveBlock2Ptr->playerName);
|
||||
playerRecord->winStreak = GetCurrentBattleTowerWinStreak(lvlMode, battleMode);
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
for (i = 0; i < EASY_CHAT_BATTLE_WORDS_COUNT; i++)
|
||||
{
|
||||
playerRecord->greeting[i] = gSaveBlock1Ptr->easyChatBattleStart[i];
|
||||
playerRecord->speechWon[i] = gSaveBlock1Ptr->easyChatBattleWon[i];
|
||||
@@ -2252,7 +2267,7 @@ static void LoadMultiPartnerCandidatesData(void)
|
||||
u32 spArray[5];
|
||||
s32 r10;
|
||||
u16 trainerId;
|
||||
u16 monSetId;
|
||||
u16 monId;
|
||||
u32 lvlMode, battleMode;
|
||||
s32 challengeNum;
|
||||
u32 species1, species2;
|
||||
@@ -2272,7 +2287,7 @@ static void LoadMultiPartnerCandidatesData(void)
|
||||
{
|
||||
do
|
||||
{
|
||||
trainerId = sub_8162548(challengeNum, 0);
|
||||
trainerId = GetRandomScaledFrontierTrainerId(challengeNum, 0);
|
||||
for (i = 0; i < j; i++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId)
|
||||
@@ -2294,24 +2309,24 @@ static void LoadMultiPartnerCandidatesData(void)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
monSetId = RandomizeFacilityTrainerMonSet(trainerId);
|
||||
if (j % 2 != 0 && gFacilityTrainerMons[gSaveBlock2Ptr->frontier.trainerIds[r10 - 1]].itemTableId == gFacilityTrainerMons[monSetId].itemTableId)
|
||||
monId = GetRandomFrontierMonFromSet(trainerId);
|
||||
if (j % 2 != 0 && gFacilityTrainerMons[gSaveBlock2Ptr->frontier.trainerIds[r10 - 1]].itemTableId == gFacilityTrainerMons[monId].itemTableId)
|
||||
continue;
|
||||
|
||||
for (k = 8; k < r10; k++)
|
||||
{
|
||||
if (gFacilityTrainerMons[gSaveBlock2Ptr->frontier.trainerIds[k]].species == gFacilityTrainerMons[monSetId].species)
|
||||
if (gFacilityTrainerMons[gSaveBlock2Ptr->frontier.trainerIds[k]].species == gFacilityTrainerMons[monId].species)
|
||||
break;
|
||||
if (species1 == gFacilityTrainerMons[monSetId].species)
|
||||
if (species1 == gFacilityTrainerMons[monId].species)
|
||||
break;
|
||||
if (species2 == gFacilityTrainerMons[monSetId].species)
|
||||
if (species2 == gFacilityTrainerMons[monId].species)
|
||||
break;
|
||||
}
|
||||
if (k == r10)
|
||||
break;
|
||||
}
|
||||
|
||||
gSaveBlock2Ptr->frontier.trainerIds[r10] = monSetId;
|
||||
gSaveBlock2Ptr->frontier.trainerIds[r10] = monId;
|
||||
r10++;
|
||||
}
|
||||
}
|
||||
@@ -2392,7 +2407,7 @@ static void LoadMultiPartnerCandidatesData(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81646BC(u16 trainerId, u16 monSetId)
|
||||
static void sub_81646BC(u16 trainerId, u16 monId)
|
||||
{
|
||||
u16 move = 0;
|
||||
u16 species = 0;
|
||||
@@ -2400,10 +2415,10 @@ static void sub_81646BC(u16 trainerId, u16 monSetId)
|
||||
|
||||
if (trainerId != TRAINER_EREADER)
|
||||
{
|
||||
if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
if (trainerId < FRONTIER_TRAINERS_COUNT)
|
||||
{
|
||||
move = gFacilityTrainerMons[monSetId].moves[0];
|
||||
species = gFacilityTrainerMons[monSetId].species;
|
||||
move = gFacilityTrainerMons[monId].moves[0];
|
||||
species = gFacilityTrainerMons[monId].species;
|
||||
}
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
|
||||
{
|
||||
@@ -2430,7 +2445,7 @@ static void sub_81646BC(u16 trainerId, u16 monSetId)
|
||||
static void ShowPartnerCandidateMessage(void)
|
||||
{
|
||||
s32 i, j, partnerId;
|
||||
s32 monSetId;
|
||||
s32 monId;
|
||||
s32 level = SetFacilityPtrsGetLevel();
|
||||
u16 winStreak = GetCurrentFacilityWinStreak();
|
||||
s32 challengeNum = winStreak / 7;
|
||||
@@ -2448,7 +2463,7 @@ static void ShowPartnerCandidateMessage(void)
|
||||
case PARTNER_MSGID_INTRO:
|
||||
if (trainerId == TRAINER_EREADER)
|
||||
return;
|
||||
if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
if (trainerId < FRONTIER_TRAINERS_COUNT)
|
||||
{
|
||||
GetFrontierTrainerName(gStringVar1, trainerId);
|
||||
}
|
||||
@@ -2468,16 +2483,16 @@ static void ShowPartnerCandidateMessage(void)
|
||||
}
|
||||
break;
|
||||
case PARTNER_MSGID_MON1:
|
||||
monSetId = gSaveBlock2Ptr->frontier.trainerIds[8 + k * 2];
|
||||
sub_81646BC(trainerId, monSetId);
|
||||
monId = gSaveBlock2Ptr->frontier.trainerIds[8 + k * 2];
|
||||
sub_81646BC(trainerId, monId);
|
||||
break;
|
||||
case PARTNER_MSGID_MON2_ASK:
|
||||
monSetId = gSaveBlock2Ptr->frontier.trainerIds[9 + k * 2];
|
||||
sub_81646BC(trainerId, monSetId);
|
||||
monId = gSaveBlock2Ptr->frontier.trainerIds[9 + k * 2];
|
||||
sub_81646BC(trainerId, monId);
|
||||
break;
|
||||
case PARTNER_MSGID_ACCEPT:
|
||||
gPartnerTrainerId = trainerId;
|
||||
if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
if (trainerId < FRONTIER_TRAINERS_COUNT)
|
||||
{
|
||||
gSaveBlock2Ptr->frontier.trainerIds[18] = gSaveBlock2Ptr->frontier.trainerIds[8 + k * 2];
|
||||
gSaveBlock2Ptr->frontier.trainerIds[19] = gSaveBlock2Ptr->frontier.trainerIds[9 + k * 2];
|
||||
@@ -2496,7 +2511,7 @@ static void ShowPartnerCandidateMessage(void)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
i = sub_8162548(challengeNum, k / 2);
|
||||
i = GetRandomScaledFrontierTrainerId(challengeNum, k / 2);
|
||||
if (gPartnerTrainerId == i)
|
||||
continue;
|
||||
|
||||
@@ -2520,7 +2535,7 @@ static void ShowPartnerCandidateMessage(void)
|
||||
return;
|
||||
|
||||
// First check is redundant, only needs to make sure it's not an Apprentice
|
||||
if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
if (trainerId < FRONTIER_TRAINERS_COUNT)
|
||||
{
|
||||
ShowFieldMessage(sPartnerTrainerTextTables[partnerId].strings[gSpecialVar_0x8005]);
|
||||
}
|
||||
@@ -2575,7 +2590,7 @@ static void LoadLinkMultiOpponentsData(void)
|
||||
{
|
||||
do
|
||||
{
|
||||
trainerId = sub_8162548(challengeNum, i / 2);
|
||||
trainerId = GetRandomScaledFrontierTrainerId(challengeNum, i / 2);
|
||||
for (j = 0; j < i; j++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->frontier.trainerIds[j] == trainerId)
|
||||
@@ -2926,7 +2941,7 @@ static void FillPartnerParty(u16 trainerId)
|
||||
s32 i, j;
|
||||
u32 ivs, level;
|
||||
u32 friendship;
|
||||
u16 monSetId;
|
||||
u16 monId;
|
||||
u32 otID;
|
||||
u8 trainerName[PLAYER_NAME_LENGTH + 1];
|
||||
SetFacilityPtrsGetLevel();
|
||||
@@ -2960,30 +2975,30 @@ static void FillPartnerParty(u16 trainerId)
|
||||
// Scrapped, lol.
|
||||
trainerName[0] = gGameLanguage;
|
||||
}
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
else if (trainerId < FRONTIER_TRAINERS_COUNT)
|
||||
{
|
||||
level = SetFacilityPtrsGetLevel();
|
||||
ivs = GetFrontierTrainerFixedIvs(trainerId);
|
||||
otID = Random32();
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
monSetId = gSaveBlock2Ptr->frontier.trainerIds[i + 18];
|
||||
monId = gSaveBlock2Ptr->frontier.trainerIds[i + 18];
|
||||
CreateMonWithEVSpreadNatureOTID(&gPlayerParty[3 + i],
|
||||
gFacilityTrainerMons[monSetId].species,
|
||||
gFacilityTrainerMons[monId].species,
|
||||
level,
|
||||
gFacilityTrainerMons[monSetId].nature,
|
||||
gFacilityTrainerMons[monId].nature,
|
||||
ivs,
|
||||
gFacilityTrainerMons[monSetId].evSpread,
|
||||
gFacilityTrainerMons[monId].evSpread,
|
||||
otID);
|
||||
friendship = 0xFF;
|
||||
friendship = MAX_FRIENDSHIP;
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
SetMonMoveSlot(&gPlayerParty[3 + i], gFacilityTrainerMons[monSetId].moves[j], j);
|
||||
if (gFacilityTrainerMons[monSetId].moves[j] == MOVE_FRUSTRATION)
|
||||
SetMonMoveSlot(&gPlayerParty[3 + 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[monSetId].itemTableId]);
|
||||
SetMonData(&gPlayerParty[3 + 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);
|
||||
@@ -3164,7 +3179,7 @@ void GetBattleTowerTrainerLanguage(u8 *dst, u16 trainerId)
|
||||
{
|
||||
*dst = gGameLanguage;
|
||||
}
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
else if (trainerId < FRONTIER_TRAINERS_COUNT)
|
||||
{
|
||||
*dst = gGameLanguage;
|
||||
}
|
||||
@@ -3237,28 +3252,30 @@ s32 GetHighestLevelInPlayerParty(void)
|
||||
return highestLevel;
|
||||
}
|
||||
|
||||
// Frontier Trainer parties are roughly scaled in difficulty with higher trainer IDs, so scale IVs as well
|
||||
// Duplicated in Battle Dome as GetDomeTrainerMonIvs
|
||||
static u8 GetFrontierTrainerFixedIvs(u16 trainerId)
|
||||
{
|
||||
u8 fixedIV = 0;
|
||||
u8 fixedIv;
|
||||
|
||||
if (trainerId < 100)
|
||||
fixedIV = 3;
|
||||
else if (trainerId < 120)
|
||||
fixedIV = 6;
|
||||
else if (trainerId < 140)
|
||||
fixedIV = 9;
|
||||
else if (trainerId < 160)
|
||||
fixedIV = 12;
|
||||
else if (trainerId < 180)
|
||||
fixedIV = 15;
|
||||
else if (trainerId < 200)
|
||||
fixedIV = 18;
|
||||
else if (trainerId < 220)
|
||||
fixedIV = 21;
|
||||
else
|
||||
fixedIV = 31;
|
||||
if (trainerId <= FRONTIER_TRAINER_JILL) // 0 - 99
|
||||
fixedIv = 3;
|
||||
else if (trainerId <= FRONTIER_TRAINER_CHLOE) // 100 - 119
|
||||
fixedIv = 6;
|
||||
else if (trainerId <= FRONTIER_TRAINER_SOFIA) // 120 - 139
|
||||
fixedIv = 9;
|
||||
else if (trainerId <= FRONTIER_TRAINER_JAZLYN) // 140 - 159
|
||||
fixedIv = 12;
|
||||
else if (trainerId <= FRONTIER_TRAINER_ALISON) // 160 - 179
|
||||
fixedIv = 15;
|
||||
else if (trainerId <= FRONTIER_TRAINER_LAMAR) // 180 - 199
|
||||
fixedIv = 18;
|
||||
else if (trainerId <= FRONTIER_TRAINER_TESS) // 200 - 219
|
||||
fixedIv = 21;
|
||||
else // 220+ (- 299)
|
||||
fixedIv = 31;
|
||||
|
||||
return fixedIV;
|
||||
return fixedIv;
|
||||
}
|
||||
|
||||
static u16 sub_8165D40(void)
|
||||
@@ -3280,19 +3297,19 @@ static u16 sub_8165D40(void)
|
||||
static u8 SetTentPtrsGetLevel(void)
|
||||
{
|
||||
u8 level = 30;
|
||||
u32 tentFacility = VarGet(VAR_FRONTIER_FACILITY);
|
||||
u32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
||||
|
||||
if (tentFacility == TENT_SLATEPORT)
|
||||
if (facility == FRONTIER_FACILITY_FACTORY)
|
||||
{
|
||||
gFacilityTrainers = gSlateportBattleTentTrainers;
|
||||
gFacilityTrainerMons = gSlateportBattleTentMons;
|
||||
}
|
||||
else if (tentFacility == TENT_VERDANTURF)
|
||||
else if (facility == FRONTIER_FACILITY_PALACE)
|
||||
{
|
||||
gFacilityTrainers = gVerdanturfBattleTentTrainers;
|
||||
gFacilityTrainerMons = gVerdanturfBattleTentMons;
|
||||
}
|
||||
else if (tentFacility == TENT_FALLARBOR)
|
||||
else if (facility == FRONTIER_FACILITY_ARENA)
|
||||
{
|
||||
gFacilityTrainers = gFallarborBattleTentTrainers;
|
||||
gFacilityTrainerMons = gFallarborBattleTentMons;
|
||||
@@ -3339,19 +3356,19 @@ static void FillTentTrainerParty_(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
u8 level = SetTentPtrsGetLevel();
|
||||
u8 fixedIV = 0;
|
||||
u8 bfMonCount;
|
||||
const u16 *monSets = NULL;
|
||||
const u16 *monSet = NULL;
|
||||
u32 otID = 0;
|
||||
u16 monSetId;
|
||||
u16 monId;
|
||||
|
||||
monSets = gFacilityTrainers[gTrainerBattleOpponent_A].monSets;
|
||||
monSet = gFacilityTrainers[gTrainerBattleOpponent_A].monSet;
|
||||
|
||||
bfMonCount = 0;
|
||||
monSetId = monSets[bfMonCount];
|
||||
while (monSetId != 0xFFFF)
|
||||
monId = monSet[bfMonCount];
|
||||
while (monId != 0xFFFF)
|
||||
{
|
||||
bfMonCount++;
|
||||
monSetId = monSets[bfMonCount];
|
||||
if (monSetId == 0xFFFF)
|
||||
monId = monSet[bfMonCount];
|
||||
if (monId == 0xFFFF)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3359,12 +3376,12 @@ static void FillTentTrainerParty_(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
otID = Random32();
|
||||
while (i != monCount)
|
||||
{
|
||||
u16 monSetId = monSets[Random() % bfMonCount];
|
||||
u16 monId = monSet[Random() % bfMonCount];
|
||||
|
||||
// Ensure this pokemon species isn't a duplicate.
|
||||
for (j = 0; j < i + firstMonId; j++)
|
||||
{
|
||||
if (GetMonData(&gEnemyParty[j], MON_DATA_SPECIES, NULL) == gFacilityTrainerMons[monSetId].species)
|
||||
if (GetMonData(&gEnemyParty[j], MON_DATA_SPECIES, NULL) == gFacilityTrainerMons[monId].species)
|
||||
break;
|
||||
}
|
||||
if (j != i + firstMonId)
|
||||
@@ -3374,7 +3391,7 @@ static void FillTentTrainerParty_(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
for (j = 0; j < i + firstMonId; j++)
|
||||
{
|
||||
if (GetMonData(&gEnemyParty[j], MON_DATA_HELD_ITEM, NULL) != 0
|
||||
&& GetMonData(&gEnemyParty[j], MON_DATA_HELD_ITEM, NULL) == gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId])
|
||||
&& GetMonData(&gEnemyParty[j], MON_DATA_HELD_ITEM, NULL) == gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId])
|
||||
break;
|
||||
}
|
||||
if (j != i + firstMonId)
|
||||
@@ -3384,34 +3401,34 @@ static void FillTentTrainerParty_(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
// because the species and held items were already checked directly above.
|
||||
for (j = 0; j < i; j++)
|
||||
{
|
||||
if (chosenMonIndices[j] == monSetId)
|
||||
if (chosenMonIndices[j] == monId)
|
||||
break;
|
||||
}
|
||||
if (j != i)
|
||||
continue;
|
||||
|
||||
chosenMonIndices[i] = monSetId;
|
||||
chosenMonIndices[i] = monId;
|
||||
|
||||
// Place the chosen pokemon into the trainer's party.
|
||||
CreateMonWithEVSpreadNatureOTID(&gEnemyParty[i + firstMonId],
|
||||
gFacilityTrainerMons[monSetId].species,
|
||||
gFacilityTrainerMons[monId].species,
|
||||
level,
|
||||
gFacilityTrainerMons[monSetId].nature,
|
||||
gFacilityTrainerMons[monId].nature,
|
||||
fixedIV,
|
||||
gFacilityTrainerMons[monSetId].evSpread,
|
||||
gFacilityTrainerMons[monId].evSpread,
|
||||
otID);
|
||||
|
||||
friendship = 255;
|
||||
friendship = MAX_FRIENDSHIP;
|
||||
// Give the chosen pokemon its specified moves.
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
SetMonMoveSlot(&gEnemyParty[i + firstMonId], gFacilityTrainerMons[monSetId].moves[j], j);
|
||||
if (gFacilityTrainerMons[monSetId].moves[j] == MOVE_FRUSTRATION)
|
||||
SetMonMoveSlot(&gEnemyParty[i + firstMonId], gFacilityTrainerMons[monId].moves[j], j);
|
||||
if (gFacilityTrainerMons[monId].moves[j] == MOVE_FRUSTRATION)
|
||||
friendship = 0; // Frustration is more powerful the lower the pokemon's friendship is.
|
||||
}
|
||||
|
||||
SetMonData(&gEnemyParty[i + firstMonId], MON_DATA_FRIENDSHIP, &friendship);
|
||||
SetMonData(&gEnemyParty[i + firstMonId], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId]);
|
||||
SetMonData(&gEnemyParty[i + firstMonId], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]);
|
||||
|
||||
// The pokemon was successfully added to the trainer's party, so it's safe to move on to
|
||||
// the next party slot.
|
||||
|
||||
+1
-1
@@ -5093,7 +5093,7 @@ static void sub_80DE864(u8 a)
|
||||
gContestResources->field_18->unk4_0 = 1;
|
||||
break;
|
||||
case MOVE_RETURN:
|
||||
gAnimFriendship = 0xFF;
|
||||
gAnimFriendship = MAX_FRIENDSHIP;
|
||||
break;
|
||||
case MOVE_FRUSTRATION:
|
||||
gAnimFriendship = 0;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+1035
-1035
File diff suppressed because it is too large
Load Diff
@@ -995,7 +995,7 @@ u16 GetWeekCount(void)
|
||||
u8 GetLeadMonFriendshipScore(void)
|
||||
{
|
||||
struct Pokemon *pokemon = &gPlayerParty[GetLeadMonIndex()];
|
||||
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) == 255)
|
||||
if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) == MAX_FRIENDSHIP)
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
@@ -1221,18 +1221,18 @@ void EndLotteryCornerComputerEffect(void)
|
||||
DrawWholeMapView();
|
||||
}
|
||||
|
||||
void SetTrickHouseEndRoomFlag(void)
|
||||
void SetTrickHouseNuggetFlag(void)
|
||||
{
|
||||
u16 *specVar = &gSpecialVar_0x8004;
|
||||
u16 flag = FLAG_TRICK_HOUSE_END_ROOM;
|
||||
u16 flag = FLAG_HIDDEN_ITEM_TRICK_HOUSE_NUGGET;
|
||||
*specVar = flag;
|
||||
FlagSet(flag);
|
||||
}
|
||||
|
||||
void ResetTrickHouseEndRoomFlag(void)
|
||||
void ResetTrickHouseNuggetFlag(void)
|
||||
{
|
||||
u16 *specVar = &gSpecialVar_0x8004;
|
||||
u16 flag = FLAG_TRICK_HOUSE_END_ROOM;
|
||||
u16 flag = FLAG_HIDDEN_ITEM_TRICK_HOUSE_NUGGET;
|
||||
*specVar = flag;
|
||||
FlagClear(flag);
|
||||
}
|
||||
|
||||
+10
-10
@@ -1701,7 +1701,7 @@ void CopyFrontierTrainerText(u8 whichText, u16 trainerId)
|
||||
FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.greeting);
|
||||
else if (trainerId == TRAINER_FRONTIER_BRAIN)
|
||||
CopyFrontierBrainText(FALSE);
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
else if (trainerId < FRONTIER_TRAINERS_COUNT)
|
||||
FrontierSpeechToString(gFacilityTrainers[trainerId].speechBefore);
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
|
||||
FrontierSpeechToString(gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].greeting);
|
||||
@@ -1717,7 +1717,7 @@ void CopyFrontierTrainerText(u8 whichText, u16 trainerId)
|
||||
{
|
||||
CopyFrontierBrainText(FALSE);
|
||||
}
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
else if (trainerId < FRONTIER_TRAINERS_COUNT)
|
||||
{
|
||||
FrontierSpeechToString(gFacilityTrainers[trainerId].speechWin);
|
||||
}
|
||||
@@ -1745,7 +1745,7 @@ void CopyFrontierTrainerText(u8 whichText, u16 trainerId)
|
||||
{
|
||||
CopyFrontierBrainText(TRUE);
|
||||
}
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
else if (trainerId < FRONTIER_TRAINERS_COUNT)
|
||||
{
|
||||
FrontierSpeechToString(gFacilityTrainers[trainerId].speechLose);
|
||||
}
|
||||
@@ -2490,7 +2490,7 @@ void SetFrontierBrainEventObjGfx_2(void)
|
||||
void CreateFrontierBrainPokemon(void)
|
||||
{
|
||||
s32 i, j;
|
||||
s32 monCountInBits;
|
||||
s32 selectedMonBits;
|
||||
s32 monPartyId;
|
||||
s32 monLevel = 0;
|
||||
u8 friendship;
|
||||
@@ -2498,16 +2498,16 @@ void CreateFrontierBrainPokemon(void)
|
||||
s32 symbol = GetFronterBrainSymbol();
|
||||
|
||||
if (facility == FRONTIER_FACILITY_DOME)
|
||||
monCountInBits = GetDomeTrainerMonCountInBits(TrainerIdToDomeTournamentId(TRAINER_FRONTIER_BRAIN));
|
||||
selectedMonBits = GetDomeTrainerSelectedMons(TrainerIdToDomeTournamentId(TRAINER_FRONTIER_BRAIN));
|
||||
else
|
||||
monCountInBits = 7;
|
||||
selectedMonBits = (1 << FRONTIER_PARTY_SIZE) - 1; // all 3 mons selected
|
||||
|
||||
ZeroEnemyPartyMons();
|
||||
monPartyId = 0;
|
||||
monLevel = SetFacilityPtrsGetLevel();
|
||||
for (i = 0; i < 3; monCountInBits >>= 1, i++)
|
||||
for (i = 0; i < FRONTIER_PARTY_SIZE; selectedMonBits >>= 1, i++)
|
||||
{
|
||||
if (!(monCountInBits & 1))
|
||||
if (!(selectedMonBits & 1))
|
||||
continue;
|
||||
|
||||
do
|
||||
@@ -2523,7 +2523,7 @@ void CreateFrontierBrainPokemon(void)
|
||||
SetMonData(&gEnemyParty[monPartyId], MON_DATA_HELD_ITEM, &sFrontierBrainsMons[facility][symbol][i].heldItem);
|
||||
for (j = 0; j < NUM_STATS; j++)
|
||||
SetMonData(&gEnemyParty[monPartyId], MON_DATA_HP_EV + j, &sFrontierBrainsMons[facility][symbol][i].evs[j]);
|
||||
friendship = 0xFF;
|
||||
friendship = MAX_FRIENDSHIP;
|
||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
SetMonMoveSlot(&gEnemyParty[monPartyId], sFrontierBrainsMons[facility][symbol][i].moves[j], j);
|
||||
@@ -2560,7 +2560,7 @@ void CreateFrontierBrainPokemon(void)
|
||||
bl TrainerIdToDomeTournamentId\n\
|
||||
lsls r0, 16\n\
|
||||
lsrs r0, 16\n\
|
||||
bl GetDomeTrainerMonCountInBits\n\
|
||||
bl GetDomeTrainerSelectedMons\n\
|
||||
adds r4, r0, 0\n\
|
||||
b _081A4E46\n\
|
||||
.pool\n\
|
||||
|
||||
+13
-19
@@ -964,25 +964,19 @@ const u32 gVsLettersGfx[] = INCBIN_U32("graphics/battle_transitions/vs.4bpp.lz")
|
||||
|
||||
#include "data/graphics/battle_terrain.h"
|
||||
|
||||
const u32 gUnknown_08D82F10[] = INCBIN_U32("graphics/battle_frontier/tourney_bg.4bpp.lz");
|
||||
const u32 gUnknown_08D834FC[] = INCBIN_U32("graphics/battle_frontier/tourney_line.4bpp.lz"); // the red glow mask for the tourney advancement lines
|
||||
|
||||
const u32 gUnknown_08D83900[] = INCBIN_U32("graphics/unknown/unknown_D83900.bin.lz"); // tilemaps likely
|
||||
|
||||
const u32 gUnknown_08D83B2C[] = INCBIN_U32("graphics/unknown/unknown_D83B2C.bin.lz");
|
||||
|
||||
const u32 gUnknown_08D83C3C[] = INCBIN_U32("graphics/unknown/unknown_D83C3C.bin.lz");
|
||||
|
||||
const u32 gUnknown_08D83D50[] = INCBIN_U32("graphics/battle_frontier/misc1.4bpp.lz");
|
||||
|
||||
const u32 gUnknown_08D84970[] = INCBIN_U32("graphics/unknown/unknown_D84970.bin.lz");
|
||||
|
||||
const u32 gUnknown_08D84F00[] = INCBIN_U32("graphics/unknown/unknown_D84F00.bin.lz");
|
||||
|
||||
const u32 gBattleFrontierGfx_DomeOptions[] = INCBIN_U32("graphics/battle_frontier/options.4bpp.lz");
|
||||
const u32 gUnknown_08D85358[] = INCBIN_U32("graphics/battle_frontier/options_pal1.gbapal.lz");
|
||||
const u32 gUnknown_08D85444[] = INCBIN_U32("graphics/battle_frontier/options_pal2.gbapal.lz"); // pokeball pal
|
||||
const u32 gUnknown_08D854C8[] = INCBIN_U32("graphics/battle_frontier/options_pal3.gbapal.lz"); // arrow pal
|
||||
// Battle Dome
|
||||
const u32 gDomeTourneyBg_Gfx[] = INCBIN_U32("graphics/battle_frontier/tourney_bg.4bpp.lz");
|
||||
const u32 gDomeTourneyLine_Gfx[] = INCBIN_U32("graphics/battle_frontier/tourney_line.4bpp.lz"); // the red glow mask for the tourney advancement lines
|
||||
const u32 gDomeTourneyLineMask_Tilemap[] = INCBIN_U32("graphics/battle_frontier/tourney_line_mask_map.bin.lz");
|
||||
const u32 gDomeTourneyLineDown_Tilemap[] = INCBIN_U32("graphics/battle_frontier/tourney_line_down_map.bin.lz");
|
||||
const u32 gDomeTourneyLineUp_Tilemap[] = INCBIN_U32("graphics/battle_frontier/tourney_line_up_map.bin.lz");
|
||||
const u32 gDomeTourneyInfoCard_Gfx[] = INCBIN_U32("graphics/battle_frontier/tourney_info_card.4bpp.lz");
|
||||
const u32 gDomeTourneyInfoCard_Tilemap[] = INCBIN_U32("graphics/battle_frontier/tourney_info_card_tilemap.bin.lz");
|
||||
const u32 gDomeTourneyInfoCardBg_Tilemap[] = INCBIN_U32("graphics/battle_frontier/tourney_info_card_bg.bin.lz");
|
||||
const u32 gDomeTourneyTreeButtons_Gfx[] = INCBIN_U32("graphics/battle_frontier/tourney_buttons.4bpp.lz"); // exit/cancel and pokeball buttons
|
||||
const u32 gDomeTourneyTree_Pal[] = INCBIN_U32("graphics/battle_frontier/tourney.gbapal.lz");
|
||||
const u32 gDomeTourneyTreeButtons_Pal[] = INCBIN_U32("graphics/battle_frontier/tourney_buttons.gbapal.lz");
|
||||
const u32 gDomeTourneyMatchCardBg_Pal[] = INCBIN_U32("graphics/battle_frontier/tourney_match_card_bg.gbapal.lz");
|
||||
|
||||
const u32 gBattleArenaJudgementSymbolsGfx[] = INCBIN_U32("graphics/battle_frontier/arena_judgement_symbols.4bpp.lz");
|
||||
const u32 gBattleArenaJudgementSymbolsPalette[] = INCBIN_U32("graphics/battle_frontier/arena_judgement_symbols.gbapal.lz");
|
||||
|
||||
+8
-7
@@ -101,7 +101,7 @@ static void SpriteCB_GetOnScreenAndAnimate(struct Sprite *sprite);
|
||||
static void HallOfFame_PrintMonInfo(struct HallofFameMon* currMon, u8 unused1, u8 unused2);
|
||||
static void HallOfFame_PrintWelcomeText(u8 unusedPossiblyWindowId, u8 unused2);
|
||||
static void HallOfFame_PrintPlayerInfo(u8 unused1, u8 unused2);
|
||||
static void sub_8175364(u8 taskId);
|
||||
static void Task_DoConfettiEffect(u8 taskId);
|
||||
static void sub_81751A4(struct Sprite* sprite);
|
||||
|
||||
// const rom data
|
||||
@@ -1387,12 +1387,13 @@ static bool8 sub_81751FC(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_8175280(void)
|
||||
// Used when a Battle Dome tourney is won
|
||||
void DoConfettiEffect(void)
|
||||
{
|
||||
u8 taskId;
|
||||
|
||||
gSpecialVar_0x8004 = 180;
|
||||
taskId = CreateTask(sub_8175364, 0);
|
||||
taskId = CreateTask(Task_DoConfettiEffect, 0);
|
||||
if (taskId != 0xFF)
|
||||
{
|
||||
gTasks[taskId].data[1] = gSpecialVar_0x8004;
|
||||
@@ -1400,11 +1401,11 @@ void sub_8175280(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81752C0(void)
|
||||
static void StopConfettiEffect(void)
|
||||
{
|
||||
u8 taskId;
|
||||
|
||||
if ((taskId = FindTaskIdByFunc(sub_8175364)) != 0xFF)
|
||||
if ((taskId = FindTaskIdByFunc(Task_DoConfettiEffect)) != 0xFF)
|
||||
DestroyTask(taskId);
|
||||
|
||||
sub_8152254();
|
||||
@@ -1437,7 +1438,7 @@ static void sub_81752F4(struct UnkStruct_81520A8 *structPtr)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_8175364(u8 taskId)
|
||||
static void Task_DoConfettiEffect(u8 taskId)
|
||||
{
|
||||
u32 var = 0;
|
||||
u16 *data = gTasks[taskId].data;
|
||||
@@ -1475,7 +1476,7 @@ static void sub_8175364(u8 taskId)
|
||||
data[0] = 0xFF;
|
||||
break;
|
||||
case 0xFF:
|
||||
sub_81752C0();
|
||||
StopConfettiEffect();
|
||||
gSpecialVar_0x8004 = var;
|
||||
gSpecialVar_0x8005 = 0xFFFF;
|
||||
break;
|
||||
|
||||
+1
-1
@@ -542,7 +542,7 @@ static void CB2_ExitMailReadFreeVars(void)
|
||||
case 1:
|
||||
case 2:
|
||||
FreeMonIconPalette(sub_80D2E84(sMailRead->mail->species));
|
||||
sub_80D2EF8(&gSprites[sMailRead->monIconSprite]);
|
||||
FreeAndDestroyMonIconSprite(&gSprites[sMailRead->monIconSprite]);
|
||||
}
|
||||
memset(sMailRead, 0, sizeof(*sMailRead));
|
||||
ResetPaletteFade();
|
||||
|
||||
@@ -445,7 +445,7 @@ void sub_801C61C(void)
|
||||
{
|
||||
u8 r6 = 0;
|
||||
if (sWonderCardData->unk_017C != 0xFF)
|
||||
sub_80D2EF8(&gSprites[sWonderCardData->unk_017C]);
|
||||
FreeAndDestroyMonIconSprite(&gSprites[sWonderCardData->unk_017C]);
|
||||
if (sWonderCardData->unk_0000.unk_09 != 0 && sWonderCardData->unk_0000.unk_08_0 == 1)
|
||||
{
|
||||
for (; r6 < sWonderCardData->unk_0000.unk_09; r6++)
|
||||
@@ -456,7 +456,7 @@ void sub_801C61C(void)
|
||||
}
|
||||
if (sWonderCardData->unk_017D[r6][1] != 0xFF)
|
||||
{
|
||||
sub_80D2EF8(&gSprites[sWonderCardData->unk_017D[r6][1]]);
|
||||
FreeAndDestroyMonIconSprite(&gSprites[sWonderCardData->unk_017D[r6][1]]);
|
||||
}
|
||||
}
|
||||
FreeSpriteTilesByTag(0x8000);
|
||||
|
||||
+11
-10
@@ -1334,7 +1334,7 @@ const struct SpindaSpot gSpindaSpotGraphics[] =
|
||||
|
||||
#include "data/pokemon/item_effects.h"
|
||||
|
||||
const s8 gNatureStatTable[][5] =
|
||||
const s8 gNatureStatTable[][NUM_EV_STATS] =
|
||||
{
|
||||
// Atk Def Spd Sp.Atk Sp.Def
|
||||
{ 0, 0, 0, 0, 0}, // Hardy
|
||||
@@ -5086,8 +5086,8 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
}
|
||||
if (friendship < 0)
|
||||
friendship = 0;
|
||||
if (friendship > 255)
|
||||
friendship = 255;
|
||||
if (friendship > MAX_FRIENDSHIP)
|
||||
friendship = MAX_FRIENDSHIP;
|
||||
SetMonData(mon, MON_DATA_FRIENDSHIP, &friendship);
|
||||
retVal = FALSE;
|
||||
}
|
||||
@@ -5112,8 +5112,8 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
}
|
||||
if (friendship < 0)
|
||||
friendship = 0;
|
||||
if (friendship > 255)
|
||||
friendship = 255;
|
||||
if (friendship > MAX_FRIENDSHIP)
|
||||
friendship = MAX_FRIENDSHIP;
|
||||
SetMonData(mon, MON_DATA_FRIENDSHIP, &friendship);
|
||||
retVal = FALSE;
|
||||
}
|
||||
@@ -5137,8 +5137,8 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
}
|
||||
if (friendship < 0)
|
||||
friendship = 0;
|
||||
if (friendship > 255)
|
||||
friendship = 255;
|
||||
if (friendship > MAX_FRIENDSHIP)
|
||||
friendship = MAX_FRIENDSHIP;
|
||||
SetMonData(mon, MON_DATA_FRIENDSHIP, &friendship);
|
||||
retVal = FALSE;
|
||||
}
|
||||
@@ -5717,7 +5717,8 @@ u8 GetTrainerEncounterMusicId(u16 trainerOpponentId)
|
||||
|
||||
u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex)
|
||||
{
|
||||
if (statIndex < 1 || statIndex > 5)
|
||||
// Dont modify HP, Accuracy, or Evasion by nature
|
||||
if (statIndex <= STAT_HP || statIndex > NUM_EV_STATS)
|
||||
{
|
||||
// Should just be "return n", but it wouldn't match without this.
|
||||
u16 retVal = n;
|
||||
@@ -5788,8 +5789,8 @@ void AdjustFriendship(struct Pokemon *mon, u8 event)
|
||||
}
|
||||
if (friendship < 0)
|
||||
friendship = 0;
|
||||
if (friendship > 255)
|
||||
friendship = 255;
|
||||
if (friendship > MAX_FRIENDSHIP)
|
||||
friendship = MAX_FRIENDSHIP;
|
||||
SetMonData(mon, MON_DATA_FRIENDSHIP, &friendship);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1128,7 +1128,7 @@ const u8 *GetMonIconPtr(u16 species, u32 personality, bool32 handleDeoxys)
|
||||
return GetMonIconTiles(GetIconSpecies(species, personality), handleDeoxys);
|
||||
}
|
||||
|
||||
void sub_80D2EF8(struct Sprite *sprite)
|
||||
void FreeAndDestroyMonIconSprite(struct Sprite *sprite)
|
||||
{
|
||||
sub_80D328C(sprite);
|
||||
}
|
||||
|
||||
@@ -706,20 +706,20 @@ static void CB2_ReturnFromChooseBattleFrontierParty(void)
|
||||
|
||||
void ReducePlayerPartyToSelectedMons(void)
|
||||
{
|
||||
struct Pokemon party[4];
|
||||
struct Pokemon party[MAX_FRONTIER_PARTY_SIZE];
|
||||
int i;
|
||||
|
||||
CpuFill32(0, party, sizeof party);
|
||||
|
||||
// copy the selected pokemon according to the order.
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_FRONTIER_PARTY_SIZE; i++)
|
||||
if (gSelectedOrderFromParty[i]) // as long as the order keeps going (did the player select 1 mon? 2? 3?), do not stop
|
||||
party[i] = gPlayerParty[gSelectedOrderFromParty[i] - 1]; // index is 0 based, not literal
|
||||
|
||||
CpuFill32(0, gPlayerParty, sizeof gPlayerParty);
|
||||
|
||||
// overwrite the first 4 with the order copied to.
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < MAX_FRONTIER_PARTY_SIZE; i++)
|
||||
gPlayerParty[i] = party[i];
|
||||
|
||||
CalculatePlayerPartyCount();
|
||||
|
||||
Reference in New Issue
Block a user