append shared egg-moves rather than early return

dl[0].Species is the same as pk.Species; more clear && array access might be slower

only append shared egg moves if shared egg moves exist
This commit is contained in:
Kurt 2020-05-15 22:49:11 -07:00
parent c8a141534c
commit 1b5292cb04

View file

@ -143,9 +143,10 @@ namespace PKHeX.Core
// Any egg move can be obtained // Any egg move can be obtained
var evo = dl[dl.Count - 1]; var evo = dl[dl.Count - 1];
var shared = MoveEgg.GetEggMoves(8, evo.Species, evo.Form, GameVersion.SW); var shared = MoveEgg.GetEggMoves(8, evo.Species, evo.Form, GameVersion.SW);
return moves.Concat(shared); if (shared.Length != 0)
moves = moves.Concat(shared);
} }
if (dl[0].Species == (int)Species.Shedinja) if (pk.Species == (int)Species.Shedinja)
{ {
// Leveling up Nincada in Gen3/4 levels up, evolves to Ninjask, applies moves for Ninjask, then spawns Shedinja with the current moveset. // Leveling up Nincada in Gen3/4 levels up, evolves to Ninjask, applies moves for Ninjask, then spawns Shedinja with the current moveset.
// Future games spawn the Shedinja before doing Ninjask moves, so this is a special case. // Future games spawn the Shedinja before doing Ninjask moves, so this is a special case.