mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
Merge pull request #2005 from LOuroboros/evoMoves
Implemented evolution moves
This commit is contained in:
commit
e405bd8ad3
@ -456,5 +456,6 @@ u16 GetFormSpeciesId(u16 speciesId, u8 formId);
|
||||
u8 GetFormIdFromFormSpeciesId(u16 formSpeciesId);
|
||||
u16 GetFormChangeTargetSpecies(struct Pokemon *mon, u16 method, u32 arg);
|
||||
u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *mon, u16 method, u32 arg);
|
||||
u16 MonTryLearningNewMoveEvolution(struct Pokemon *mon, bool8 firstMove);
|
||||
|
||||
#endif // GUARD_POKEMON_H
|
||||
|
@ -780,7 +780,7 @@ static void Task_EvolutionScene(u8 taskId)
|
||||
case EVOSTATE_TRY_LEARN_MOVE:
|
||||
if (!IsTextPrinterActive(0))
|
||||
{
|
||||
var = MonTryLearningNewMove(mon, gTasks[taskId].tLearnsFirstMove);
|
||||
var = MonTryLearningNewMoveEvolution(mon, gTasks[taskId].tLearnsFirstMove);
|
||||
if (var != MOVE_NONE && !gTasks[taskId].tEvoWasStopped)
|
||||
{
|
||||
u8 text[20];
|
||||
@ -1201,7 +1201,7 @@ static void Task_TradeEvolutionScene(u8 taskId)
|
||||
case T_EVOSTATE_TRY_LEARN_MOVE:
|
||||
if (!IsTextPrinterActive(0) && IsFanfareTaskInactive() == TRUE)
|
||||
{
|
||||
var = MonTryLearningNewMove(mon, gTasks[taskId].tLearnsFirstMove);
|
||||
var = MonTryLearningNewMoveEvolution(mon, gTasks[taskId].tLearnsFirstMove);
|
||||
if (var != MOVE_NONE && !gTasks[taskId].tEvoWasStopped)
|
||||
{
|
||||
u8 text[20];
|
||||
|
@ -3940,6 +3940,8 @@ void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon)
|
||||
{
|
||||
if (gLevelUpLearnsets[species][i].level > level)
|
||||
break;
|
||||
if (gLevelUpLearnsets[species][i].level == 0)
|
||||
continue;
|
||||
if (GiveMoveToBoxMon(boxMon, gLevelUpLearnsets[species][i].move) == MON_HAS_MAX_MOVES)
|
||||
DeleteFirstMoveAndGiveMoveToBoxMon(boxMon, gLevelUpLearnsets[species][i].move);
|
||||
}
|
||||
@ -8259,3 +8261,29 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *mon, u16 method, u32 arg
|
||||
|
||||
return species != targetSpecies ? targetSpecies : SPECIES_NONE;
|
||||
}
|
||||
|
||||
u16 MonTryLearningNewMoveEvolution(struct Pokemon *mon, bool8 firstMove)
|
||||
{
|
||||
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
||||
u8 level = GetMonData(mon, MON_DATA_LEVEL, NULL);
|
||||
|
||||
// Since you can learn more than one move per level,
|
||||
// the game needs to know whether you decided to
|
||||
// learn it or keep the old set to avoid asking
|
||||
// you to learn the same move over and over again.
|
||||
if (firstMove)
|
||||
{
|
||||
sLearningMoveTableID = 0;
|
||||
}
|
||||
while(gLevelUpLearnsets[species][sLearningMoveTableID].move != LEVEL_UP_END)
|
||||
{
|
||||
while (gLevelUpLearnsets[species][sLearningMoveTableID].level == 0 || gLevelUpLearnsets[species][sLearningMoveTableID].level == level)
|
||||
{
|
||||
gMoveToLearn = gLevelUpLearnsets[species][sLearningMoveTableID].move;
|
||||
sLearningMoveTableID++;
|
||||
return GiveMoveToMon(mon, gMoveToLearn);
|
||||
}
|
||||
sLearningMoveTableID++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user