Random Pyramid Encounter fixes (#4326)

This commit is contained in:
ghoulslash 2024-04-01 14:58:36 -04:00 committed by GitHub
commit e1f6480e32
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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) != 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);
} }