Misc tweaks for suggesting moves when IsEgg

Closes #3032

Don't suggest tutor moves for current moves if it is an egg
This commit is contained in:
Kurt 2020-10-14 18:55:30 -07:00
parent e984f71d82
commit 1bd3ec79cf
2 changed files with 6 additions and 4 deletions

View file

@ -42,7 +42,7 @@ namespace PKHeX.Core
if (!m.All(z => learn.Contains(z))) if (!m.All(z => learn.Contains(z)))
m = m.Intersect(learn).ToArray(); m = m.Intersect(learn).ToArray();
if (random) if (random && !la.pkm.IsEgg)
Util.Shuffle(m); Util.Shuffle(m);
const int count = 4; const int count = 4;
@ -76,7 +76,7 @@ namespace PKHeX.Core
var encounter = EncounterSuggestion.GetSuggestedMetInfo(legal.pkm); var encounter = EncounterSuggestion.GetSuggestedMetInfo(legal.pkm);
if (encounter is IRelearn r && r.Relearn.Count > 0) if (encounter is IRelearn r && r.Relearn.Count > 0)
m = r.Relearn; return r.Relearn;
return m; return m;
} }

View file

@ -456,7 +456,7 @@ namespace PKHeX.Core
return Info.RelearnBase; return Info.RelearnBase;
List<int> window = new List<int>(Info.RelearnBase.Where(z => z != 0)); List<int> window = new List<int>(Info.RelearnBase.Where(z => z != 0));
window.AddRange(pkm.Moves.Where((_, i) => !Info.Moves[i].Valid || Info.Moves[i].Flag)); window.AddRange(pkm.Moves.Where((z, i) => z != 0 && !Info.Moves[i].Valid || Info.Moves[i].Flag));
window = window.Distinct().ToList(); window = window.Distinct().ToList();
int[] moves = new int[4]; int[] moves = new int[4];
int start = Math.Max(0, window.Count - 4); int start = Math.Max(0, window.Count - 4);
@ -475,7 +475,9 @@ namespace PKHeX.Core
{ {
if (!Parsed) if (!Parsed)
return new int[4]; return new int[4];
return MoveListSuggest.GetSuggestedMoves(pkm, Info.EvoChainsAllGens, tm, tutor, reminder, EncounterOriginal); if (pkm.IsEgg && pkm.Format >= 6)
return pkm.RelearnMoves;
return MoveListSuggest.GetSuggestedMoves(pkm, Info.EvoChainsAllGens, tm, !pkm.IsEgg && tutor, reminder, EncounterOriginal);
} }
} }
} }