Random Pyramid Encounter fixes

This commit is contained in:
Alex 2024-04-01 20:31:01 +02:00
parent 8f6f744e7f
commit f58bec2397

View File

@ -1413,7 +1413,12 @@ void GenerateBattlePyramidWildMon(void)
while (1) while (1)
{ {
species = Random() % FORMS_START; species = Random() % NUM_SPECIES;
// check if base species
if (!GET_BASE_SPECIES_ID(species))
continue;
// check type // check type
if (reqs->type != TYPE_MYSTERY && gSpeciesInfo[species].types[0] != reqs->type && gSpeciesInfo[species].types[1] != reqs->type) if (reqs->type != TYPE_MYSTERY && gSpeciesInfo[species].types[0] != reqs->type && gSpeciesInfo[species].types[1] != reqs->type)
continue; continue;
@ -1460,7 +1465,7 @@ void GenerateBattlePyramidWildMon(void)
continue; continue;
} }
// check evos // check evos
if (reqs->evoItems[0] != 0 && !CheckBattlePyramidEvoRequirement(species, reqs->evoItems, reqs->nEvoItems)) if (reqs->evoItems != NULL && !CheckBattlePyramidEvoRequirement(species, reqs->evoItems, reqs->nEvoItems))
continue; continue;
// we found a species we can use! // we found a species we can use!
@ -1533,8 +1538,11 @@ void GenerateBattlePyramidWildMon(void)
{ {
// Set this ability num // Set this ability num
SetMonData(&gEnemyParty[0], MON_DATA_ABILITY_NUM, &id); SetMonData(&gEnemyParty[0], MON_DATA_ABILITY_NUM, &id);
break;
} }
} }
if (id >= NUM_ABILITY_SLOTS - 1)
break;
} }
Free(abilities); Free(abilities);
} }