From 139fc97b82760bc832cdd8b7c4f7e2ffa096826c Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 12 Nov 2016 05:56:22 -0800 Subject: [PATCH] Fix type tutor availability --- PKHeX/Legality/Core.cs | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/PKHeX/Legality/Core.cs b/PKHeX/Legality/Core.cs index 2ea96f4e9..7de841e6a 100644 --- a/PKHeX/Legality/Core.cs +++ b/PKHeX/Legality/Core.cs @@ -719,12 +719,8 @@ private static IEnumerable getValidMoves(PKM pkm, GameVersion Version, bool int species = pkm.Species; int lvl = pkm.CurrentLevel; - // Special (non Type) Tutor Availability - bool moveTutor = Version == GameVersion.Any || pkm.Format != pkm.GenNumber; - // Add extra cases where tutors - moveTutor |= pkm.AO; - moveTutor |= pkm.XY && !pkm.IsUntraded; - moveTutor |= pkm.Format < 6; + // Special Type Tutors Availability + const bool moveTutor = true; if (FormChangeMoves.Contains(species)) // Deoxys & Shaymin & Giratina (others don't have extra but whatever) { @@ -750,14 +746,14 @@ private static IEnumerable getValidMoves(PKM pkm, GameVersion Version, bool if (Relearn) r.AddRange(pkm.RelearnMoves); return r.Distinct().ToArray(); } - private static IEnumerable getMoves(PKM pkm, int species, int lvl, int form, bool moveTutor, GameVersion Version, bool LVL, bool Tutor, bool Machine) + private static IEnumerable getMoves(PKM pkm, int species, int lvl, int form, bool moveTutor, GameVersion Version, bool LVL, bool specialTutors, bool Machine) { List r = new List { 0 }; for (int gen = pkm.GenNumber; gen <= pkm.Format; gen++) - r.AddRange(getMoves(pkm, species, lvl, form, moveTutor, Version, LVL, Tutor, Machine, gen)); + r.AddRange(getMoves(pkm, species, lvl, form, moveTutor, Version, LVL, specialTutors, Machine, gen)); return r.Distinct(); } - private static IEnumerable getMoves(PKM pkm, int species, int lvl, int form, bool moveTutor, GameVersion Version, bool LVL, bool Tutor, bool Machine, int Generation) + private static IEnumerable getMoves(PKM pkm, int species, int lvl, int form, bool moveTutor, GameVersion Version, bool LVL, bool specialTutors, bool Machine, int Generation) { List r = new List(); @@ -774,7 +770,7 @@ private static IEnumerable getMoves(PKM pkm, int species, int lvl, int form PersonalInfo pi = PersonalTable.XY.getFormeEntry(species, form); if (LVL) r.AddRange(LevelUpXY[index].getMoves(lvl)); - if (moveTutor) r.AddRange(getTutorMoves(pkm, species, form, Tutor)); + if (moveTutor) r.AddRange(getTutorMoves(pkm, species, form, specialTutors)); if (Machine) r.AddRange(TMHM_XY.Where((t, m) => pi.TMHM[m])); if (ver == GameVersion.Any) // Fall Through @@ -788,7 +784,7 @@ private static IEnumerable getMoves(PKM pkm, int species, int lvl, int form PersonalInfo pi = PersonalTable.AO.getFormeEntry(species, form); if (LVL) r.AddRange(LevelUpAO[index].getMoves(lvl)); - if (moveTutor) r.AddRange(getTutorMoves(pkm, species, form, Tutor)); + if (moveTutor) r.AddRange(getTutorMoves(pkm, species, form, specialTutors)); if (Machine) r.AddRange(TMHM_AO.Where((t, m) => pi.TMHM[m])); break; } @@ -804,7 +800,7 @@ private static IEnumerable getMoves(PKM pkm, int species, int lvl, int form PersonalInfo pi = PersonalTable.SM.getFormeEntry(species, form); if (LVL) r.AddRange(LevelUpSM[index].getMoves(lvl)); - if (moveTutor) r.AddRange(getTutorMoves(pkm, species, form, Tutor)); + if (moveTutor) r.AddRange(getTutorMoves(pkm, species, form, specialTutors)); if (Machine) r.AddRange(TMHM_SM.Where((t, m) => pi.TMHM[m])); break; } @@ -835,10 +831,10 @@ private static IEnumerable getEggMoves(PKM pkm, int species, int formnum) return new List(); } } - private static IEnumerable getTutorMoves(PKM pkm, int species, int form, bool Tutors) + private static IEnumerable getTutorMoves(PKM pkm, int species, int form, bool specialTutors) { PersonalInfo info = pkm.PersonalInfo; - // Type Tutor + // Type Tutors List moves = TypeTutor.Where((t, i) => info.TypeTutors[i]).ToList(); // Varied Tutors @@ -850,7 +846,7 @@ private static IEnumerable getTutorMoves(PKM pkm, int species, int form, bo // // if (pi.SpecialTutors[i][b]) // // moves.Add(Tutors_B2W2[i][b]); //} - if (pkm.InhabitedGeneration(6) && Tutors) + if (pkm.InhabitedGeneration(6) && specialTutors && (pkm.AO || !pkm.IsUntraded)) { PersonalInfo pi = PersonalTable.AO.getFormeEntry(species, form); for (int i = 0; i < Tutors_AO.Length; i++)