cleaner dexnav egg move generation

This commit is contained in:
ghoulslash 2021-06-17 11:28:25 -06:00
parent 608dd9ddc5
commit f007befe51

View file

@ -1271,7 +1271,7 @@ static void DexNavGenerateMoveset(u16 species, u8 searchLevel, u8 encounterLevel
u16 i; u16 i;
u16 eggMoveBuffer[EGG_MOVES_ARRAY_COUNT]; u16 eggMoveBuffer[EGG_MOVES_ARRAY_COUNT];
//Evaluate if Pokemon should get an egg move in first slot // see if first move slot should be an egg move
if (searchLevel < 5) if (searchLevel < 5)
{ {
#if (SEARCHLEVEL0_MOVECHANCE != 0) #if (SEARCHLEVEL0_MOVECHANCE != 0)
@ -1323,14 +1323,11 @@ static void DexNavGenerateMoveset(u16 species, u8 searchLevel, u8 encounterLevel
moveDst[i] = GetMonData(&gEnemyParty[0], MON_DATA_MOVE1 + i, NULL); moveDst[i] = GetMonData(&gEnemyParty[0], MON_DATA_MOVE1 + i, NULL);
// set first move slot to a random egg move if search level is good enough // set first move slot to a random egg move if search level is good enough
if (genMove == TRUE) if (genMove)
{ {
u8 numEggMoves = GetEggMoves(&gEnemyParty[0], eggMoveBuffer); u8 numEggMoves = GetEggMoves(&gEnemyParty[0], eggMoveBuffer);
if (numEggMoves != 0) if (numEggMoves != 0)
{ moveDst[0] = eggMoveBuffer[Random() % numEggMoves];
u8 index = RandRange(0, numEggMoves);
moveDst[0] = eggMoveBuffer[index];
}
} }
} }