Consolidated funcs, renamed CanMonLearnMove

This commit is contained in:
crater-git 2022-08-26 11:07:08 -04:00
parent 54ee960970
commit b8a3cc2846
5 changed files with 12 additions and 34 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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]);

View File

@ -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);

View File

@ -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) {