Implemented evolution moves
Thanks to UltimaSoul and Sagiri/Zeturic
This commit is contained in:
parent
2736223b1b
commit
d6a78f386f
3 changed files with 29 additions and 2 deletions
|
@ -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];
|
||||
|
|
|
@ -8259,3 +8259,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 || gLevelUpLearnsets[species][sLearningMoveTableID].level == level)
|
||||
{
|
||||
gMoveToLearn = gLevelUpLearnsets[species][sLearningMoveTableID].move;
|
||||
sLearningMoveTableID++;
|
||||
return GiveMoveToMon(mon, gMoveToLearn);
|
||||
}
|
||||
sLearningMoveTableID++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue