mirror of https://github.com/pret/pokeemerald.git
Improved section #5 code
parent
1fb208ea31
commit
678354a4b8
|
@ -108,35 +108,46 @@ We will also create an if/else statement that uses our renamed flag. If the flag
|
||||||
|
|
||||||
## 5. Exclude invalid Pokémon from list
|
## 5. Exclude invalid Pokémon from list
|
||||||
|
|
||||||
Now for a little bit of extra polish. Plenty of Pokémon are unable to learn any egg moves. This applies to Pokémon in egg groups `DITTO`, `NO_EGGS_DISCOVERED` and `GENDER UNKNOWN`. The latter doesn't actually exist in Emerald's code, but we can use `MON_GENDERLESS` instead.
|
Now for a little bit of extra polish! Plenty of Pokémon are unable to learn any egg moves. This applies to egg groups `DITTO`, `NO_EGGS_DISCOVERED` and genderless Pokémon. Furthermore, we need to ensure Pokémon who have already learned every available egg move are unable to be selected from the party screen, similar to how the original move tutor works.
|
||||||
|
|
||||||
Edit `src\pokemon.c`:
|
Edit `src\pokemon.c`:
|
||||||
|
|
||||||
|
Since we want to use GetEggMoves for this edit, we'll need to include `daycare.h`.
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
u8 GetNumberOfRelearnableMoves(struct Pokemon *mon)
|
#include "constants/trainers.h"
|
||||||
{
|
#include "constants/union_room.h"
|
||||||
|
+#include "daycare.h"
|
||||||
|
|
||||||
|
#define DAY_EVO_HOUR_BEGIN 12
|
||||||
|
#define DAY_EVO_HOUR_END HOURS_PER_DAY
|
||||||
|
```
|
||||||
|
By checking for `numEggMoves == 0`, we target any Pokémon that meet the criteria mentioned earlier.
|
||||||
|
|
||||||
|
```diff
|
||||||
|
u8 GetNumberOfRelearnableMoves(struct Pokemon *mon)
|
||||||
|
{
|
||||||
u16 learnedMoves[MAX_MON_MOVES];
|
u16 learnedMoves[MAX_MON_MOVES];
|
||||||
u16 moves[MAX_LEVEL_UP_MOVES];
|
u16 moves[MAX_LEVEL_UP_MOVES];
|
||||||
|
+ u16 eggMoves[EGG_MOVES_ARRAY_COUNT];
|
||||||
u8 numMoves = 0;
|
u8 numMoves = 0;
|
||||||
|
+ u8 numEggMoves;
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES_OR_EGG, 0);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES_OR_EGG, 0);
|
||||||
u8 level = GetMonData(mon, MON_DATA_LEVEL, 0);
|
u8 level = GetMonData(mon, MON_DATA_LEVEL, 0);
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
|
|
||||||
+ if (FlagGet(FLAG_EGG_MOVES_TUTOR))
|
+ if (FlagGet(FLAG_EGG_MOVES_TUTOR))
|
||||||
+ {
|
+ {
|
||||||
+ if (gSpeciesInfo[species].genderRatio == MON_GENDERLESS)
|
+ numEggMoves = GetEggMoves(mon, eggMoves);
|
||||||
|
+
|
||||||
|
+ if (numEggMoves == 0)
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+
|
|
||||||
+ for (i = 0; i < 2; i++)
|
|
||||||
+ if (gSpeciesInfo[species].eggGroups[i] == EGG_GROUP_DITTO ||
|
|
||||||
+ gSpeciesInfo[species].eggGroups[i] == EGG_GROUP_NO_EGGS_DISCOVERED)
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
if (species == SPECIES_EGG)
|
if (species == SPECIES_EGG)
|
||||||
return 0;
|
return 0;
|
||||||
```
|
```
|
||||||
If a Pokémon is genderless or belongs to the `DITTO` or `NO_EGGS_DISCOVERED` egg groups, it will now display "NOT ABLE!" in the party selection screen. Since Pokémon can belong to two different egg groups, we make sure to check both slots.
|
If a Pokémon's egg move list is empty, the game will now correctly display "NOT ABLE!" in the party selection screen.
|
||||||
|
|
||||||
***
|
***
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue