diff options
author | ExpoSeed <43502820+ExpoSeed@users.noreply.github.com> | 2020-07-27 19:32:44 -0500 |
---|---|---|
committer | ExpoSeed <43502820+ExpoSeed@users.noreply.github.com> | 2020-07-27 19:32:44 -0500 |
commit | 4a376b675fa8451693a7ad4f57118caf636940c1 (patch) | |
tree | 23e031a453000fdb58219ec5d8f11fb9245eae88 | |
parent | 5d727f5a9d24e8b94d367e87874713b1b9a29798 (diff) |
fixed issues
-rw-r--r-- | Learn-moves-upon-evolution.md | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Learn-moves-upon-evolution.md b/Learn-moves-upon-evolution.md index b08851a..0f745f6 100644 --- a/Learn-moves-upon-evolution.md +++ b/Learn-moves-upon-evolution.md @@ -13,8 +13,7 @@ u16 MonTryLearningNewMoveEvolution(struct Pokemon *mon, bool8 firstMove) { u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL); u8 level = GetMonData(mon, MON_DATA_LEVEL, NULL); - s32 i; - u32 retVal = 0; + // 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 @@ -23,18 +22,19 @@ u16 MonTryLearningNewMoveEvolution(struct Pokemon *mon, bool8 firstMove) { sLearningMoveTableID = 0; } - for (i = 0; gLevelUpLearnsets[species][i] != LEVEL_UP_END; i++) + while(gLevelUpLearnsets[species][sLearningMoveTableID] != LEVEL_UP_END) { - moveLevel = gLevelUpLearnsets[species][i] & LEVEL_UP_MOVE_LV; + u16 moveLevel; + moveLevel = (gLevelUpLearnsets[species][sLearningMoveTableID] & LEVEL_UP_MOVE_LV); while (moveLevel == 0 || moveLevel == (level << 9)) { - gMoveToLearn = gLevelUpLearnsets[species][i] & LEVEL_UP_MOVE_ID; + gMoveToLearn = (gLevelUpLearnsets[species][sLearningMoveTableID] & LEVEL_UP_MOVE_ID); sLearningMoveTableID++; - retVal = GiveMoveToMon(mon, gMoveToLearn); + return GiveMoveToMon(mon, gMoveToLearn); } sLearningMoveTableID++; } - return retVal; + return 0; } ``` This iterates through the mon's level up learnset and attempts to teach all the moves that are either level 0 or the same level as the mon. |