Skip to content

Commit

Permalink
fix: better checks for random species id
Browse files Browse the repository at this point in the history
- fixes issue with using old unown ids
- checks for egg
  • Loading branch information
indeedhat committed Sep 30, 2023
1 parent fac6e61 commit d27e233
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ This is a decompilation of Pokémon Emerald.
- [ ] fix the instant text speed setting
- [ ] update settings page to have more nuzlocke specific settings
- [ ] update settings page to be scrollable for more settings
- [ ] don't let rare candies level you up higher than the highest pokemon you have defeated
- [ ] limit each route to only a few species

It builds the following ROM:

Expand Down
9 changes: 7 additions & 2 deletions src/pokemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -7136,8 +7136,13 @@ u16 RandomPokemonSpecies()
{
u16 species = SPECIES_NONE;
do {
species = (Random() % (NUM_SPECIES - 1)) +1;
} while (species < SPECIES_BULBASAUR || species > SPECIES_CHIMECHO);
species = (Random() % SPECIES_UNOWN_QMARK) +1;
} while (
species < SPECIES_BULBASAUR
|| species > SPECIES_UNOWN_QMARK
|| species == SPECIES_EGG
|| (species >= SPECIES_OLD_UNOWN_B && species <= SPECIES_OLD_UNOWN_Z)
);

return species;
}

0 comments on commit d27e233

Please sign in to comment.