diff --git a/include/pokemon.h b/include/pokemon.h index 92057e9b78..b4d60dacf1 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -510,8 +510,7 @@ u8 CheckPartyHasHadPokerus(struct Pokemon *party, u8 selection); void UpdatePartyPokerusTime(u16 days); void PartySpreadPokerus(struct Pokemon *party); bool8 TryIncrementMonLevel(struct Pokemon *mon); -u32 CanMonLearnTaughtMove(struct Pokemon *mon, u16 move); -u32 CanSpeciesLearnTaughtMove(u16 species, u16 move); +u8 CanLearnTaughtMove(u16 species, u16 move); u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves); u8 GetLevelUpMovesBySpecies(u16 species, u16 *moves); u8 GetNumberOfRelearnableMoves(struct Pokemon *mon); diff --git a/src/apprentice.c b/src/apprentice.c index 71536065fa..b8a946d28d 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -338,7 +338,7 @@ static u16 GetRandomAlternateMove(u8 monId) const struct LevelUpMove *learnset; bool32 needTMs = FALSE; u16 moveId = MOVE_NONE; - bool32 shouldUseMove; + bool8 shouldUseMove; u8 level; id = APPRENTICE_SPECIES_ID(monId); @@ -376,7 +376,7 @@ static u16 GetRandomAlternateMove(u8 monId) do { id = Random() % (NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES); - shouldUseMove = CanSpeciesLearnTaughtMove(species, ItemIdToBattleMoveId(ITEM_TM01 + id)); + shouldUseMove = CanLearnTaughtMove(species, ItemIdToBattleMoveId(ITEM_TM01 + id)); } while (!shouldUseMove); diff --git a/src/daycare.c b/src/daycare.c index ffc72c41f2..a73cedc857 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -696,7 +696,7 @@ static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, stru for (j = 0; j < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; j++) { u16 moveId = ItemIdToBattleMoveId(ITEM_TM01 + j); - if (sHatchedEggFatherMoves[i] == moveId && CanMonLearnTaughtMove(egg, moveId)) + if (sHatchedEggFatherMoves[i] == moveId && CanLearnTaughtMove(GetMonData(egg, MON_DATA_SPECIES2), moveId)) { if (GiveMoveToMon(egg, sHatchedEggFatherMoves[i]) == MON_HAS_MAX_MOVES) DeleteFirstMoveAndGiveMoveToMon(egg, sHatchedEggFatherMoves[i]); diff --git a/src/party_menu.c b/src/party_menu.c index 0025e968fc..197b5f1f72 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -266,7 +266,7 @@ static void DisplayPartyPokemonHPBarCheck(struct Pokemon *, struct PartyMenuBox static void DisplayPartyPokemonDescriptionText(u8, struct PartyMenuBox *, u8); static bool8 IsMonAllowedInMinigame(u8); static void DisplayPartyPokemonDataToTeachMove(u8, u16); -static u8 CanMonLearnMove(struct Pokemon *, u16); +static u8 CanTeachMove(struct Pokemon *, u16); static void DisplayPartyPokemonBarDetail(u8, const u8 *, u8, const u8 *); static void DisplayPartyPokemonLevel(u8, struct PartyMenuBox *); static void DisplayPartyPokemonGender(u8, u16, u8 *, struct PartyMenuBox *); @@ -996,7 +996,7 @@ static bool8 DisplayPartyPokemonDataForMoveTutorOrEvolutionItem(u8 slot) static void DisplayPartyPokemonDataToTeachMove(u8 slot, u16 move) { - switch (CanMonLearnMove(&gPlayerParty[slot], move)) + switch (CanTeachMove(&gPlayerParty[slot], move)) { case CANNOT_LEARN_MOVE: case CANNOT_LEARN_MOVE_IS_EGG: @@ -2026,11 +2026,11 @@ static void Task_HandleCancelParticipationYesNoInput(u8 taskId) } } -static u8 CanMonLearnMove(struct Pokemon *mon, u16 move) +static u8 CanTeachMove(struct Pokemon *mon, u16 move) { if (GetMonData(mon, MON_DATA_IS_EGG)) return CANNOT_LEARN_MOVE_IS_EGG; - else if (!CanMonLearnTaughtMove(mon, move)) + else if (!CanLearnTaughtMove(GetMonData(mon, MON_DATA_SPECIES2), move)) return CANNOT_LEARN_MOVE; else if (MonKnowsMove(mon, move) == TRUE) return ALREADY_KNOWS_MOVE; @@ -4912,7 +4912,7 @@ void ItemUseCB_TMHM(u8 taskId, TaskFunc task) GetMonNickname(mon, gStringVar1); StringCopy(gStringVar2, gMoveNames[move]); - switch (CanMonLearnMove(mon, move)) + switch (CanTeachMove(mon, move)) { case CANNOT_LEARN_MOVE: DisplayLearnMoveMessageAndClose(taskId, gText_PkmnCantLearnMove); @@ -5646,7 +5646,7 @@ static void TryTutorSelectedMon(u8 taskId) gPartyMenu.data1 = gSpecialVar_0x8005; StringCopy(gStringVar2, gMoveNames[gPartyMenu.data1]); move[1] = 2; - switch (CanMonLearnMove(mon, gPartyMenu.data1)) + switch (CanTeachMove(mon, gPartyMenu.data1)) { case CANNOT_LEARN_MOVE: DisplayLearnMoveMessageAndClose(taskId, gText_PkmnCantLearnMove); diff --git a/src/pokemon.c b/src/pokemon.c index 723a3977e3..6ee4696684 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -7244,28 +7244,7 @@ bool8 TryIncrementMonLevel(struct Pokemon *mon) } } -u32 CanMonLearnTaughtMove(struct Pokemon *mon, u16 move) -{ - u16 species = GetMonData(mon, MON_DATA_SPECIES2, 0); - - if (species == SPECIES_EGG) - { - return FALSE; - } - else - { - u32 i; - for (i = 0; gTeachLearnsets[species][i] != MOVE_UNAVAILABLE; i++) - { - if (gTeachLearnsets[species][i] == move) { - return TRUE; - } - } - return FALSE; - } -} - -u32 CanSpeciesLearnTaughtMove(u16 species, u16 move) +u8 CanLearnTaughtMove(u16 species, u16 move) { if (species == SPECIES_EGG) { @@ -7273,7 +7252,7 @@ u32 CanSpeciesLearnTaughtMove(u16 species, u16 move) } else { - u32 i; + u8 i; for (i = 0; gTeachLearnsets[species][i] != MOVE_UNAVAILABLE; i++) { if (gTeachLearnsets[species][i] == move) {