Fix trainers having empty movesets
This commit is contained in:
parent
dd99cb6da8
commit
4709d2b46f
1 changed files with 25 additions and 6 deletions
|
@ -122,6 +122,7 @@ static u32 Crc32B (const u8 *data, u32 size);
|
|||
static u32 GeneratePartyHash(const struct Trainer *trainer, u32 i);
|
||||
static void ModifyPersonalityForNature(u32 *personality, u32 newNature);
|
||||
static u32 GeneratePersonalityForGender(u32 gender, u32 species);
|
||||
static void CustomTrainerPartyAssignMoves(struct Pokemon *mon, const struct TrainerMonCustomized *partyEntry);
|
||||
|
||||
EWRAM_DATA u16 gBattle_BG0_X = 0;
|
||||
EWRAM_DATA u16 gBattle_BG0_Y = 0;
|
||||
|
@ -1947,6 +1948,29 @@ static u32 GeneratePersonalityForGender(u32 gender, u32 species)
|
|||
return speciesInfo->genderRatio / 2;
|
||||
}
|
||||
|
||||
static void CustomTrainerPartyAssignMoves(struct Pokemon *mon, const struct TrainerMonCustomized *partyEntry)
|
||||
{
|
||||
bool32 noMoveSet = TRUE;
|
||||
u32 j;
|
||||
|
||||
for (j = 0; j < MAX_MON_MOVES; ++j)
|
||||
{
|
||||
if (partyEntry->moves[j] != MOVE_NONE)
|
||||
noMoveSet = FALSE;
|
||||
}
|
||||
if (noMoveSet)
|
||||
{
|
||||
// TODO: Figure out a default strategy when moves are not set, to generate a good moveset
|
||||
return;
|
||||
}
|
||||
|
||||
for (j = 0; j < MAX_MON_MOVES; ++j)
|
||||
{
|
||||
SetMonData(mon, MON_DATA_MOVE1 + j, &partyEntry->moves[j]);
|
||||
SetMonData(mon, MON_DATA_PP1 + j, &gBattleMoves[partyEntry->moves[j]].pp);
|
||||
}
|
||||
}
|
||||
|
||||
u8 CreateNPCTrainerPartyFromTrainer(struct Pokemon *party, const struct Trainer *trainer, bool32 firstTrainer, u32 battleTypeFlags)
|
||||
{
|
||||
u32 personalityValue;
|
||||
|
@ -2049,12 +2073,7 @@ u8 CreateNPCTrainerPartyFromTrainer(struct Pokemon *party, const struct Trainer
|
|||
CreateMon(&party[i], partyData[i].species, partyData[i].lvl, 0, TRUE, personalityValue, otIdType, fixedOtId);
|
||||
SetMonData(&party[i], MON_DATA_HELD_ITEM, &partyData[i].heldItem);
|
||||
|
||||
// TODO: Figure out a default strategy when moves are not set, to generate a good moveset
|
||||
for (j = 0; j < MAX_MON_MOVES; ++j)
|
||||
{
|
||||
SetMonData(&party[i], MON_DATA_MOVE1 + j, &partyData[i].moves[j]);
|
||||
SetMonData(&party[i], MON_DATA_PP1 + j, &gBattleMoves[partyData[i].moves[j]].pp);
|
||||
}
|
||||
CustomTrainerPartyAssignMoves(&party[i], &partyData[i]);
|
||||
SetMonData(&party[i], MON_DATA_IVS, &(partyData[i].iv));
|
||||
if (partyData[i].ev != NULL)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue