Filter by generation in function getTutorMoves

This commit is contained in:
javierhimura
2017-02-27 19:41:15 +01:00
parent 38e173a36f
commit 1bd885b609

View File

@@ -1458,7 +1458,7 @@ private static IEnumerable<int> getMoves(PKM pkm, int species, int lvl, int form
r.AddRange(TMHM_RBY.Where((t, m) => pi_y.TMHM[m]));
}
if (moveTutor)
r.AddRange(getTutorMoves(pkm, species, form, specialTutors));
r.AddRange(getTutorMoves(pkm, species, form, specialTutors, Generation));
break;
}
case 2:
@@ -1475,7 +1475,7 @@ private static IEnumerable<int> getMoves(PKM pkm, int species, int lvl, int form
r.AddRange(TMHM_GSC.Where((t, m) => pi_c.TMHM[m]));
}
if (moveTutor)
r.AddRange(getTutorMoves(pkm, species, form, specialTutors));
r.AddRange(getTutorMoves(pkm, species, form, specialTutors, Generation));
break;
}
case 6:
@@ -1488,7 +1488,7 @@ private static IEnumerable<int> getMoves(PKM pkm, int species, int lvl, int form
PersonalInfo pi = PersonalTable.XY[index];
if (LVL) r.AddRange(LevelUpXY[index].getMoves(lvl));
if (moveTutor) r.AddRange(getTutorMoves(pkm, species, form, specialTutors));
if (moveTutor) r.AddRange(getTutorMoves(pkm, species, form, specialTutors, Generation));
if (Machine) r.AddRange(TMHM_XY.Where((t, m) => pi.TMHM[m]));
if (ver == GameVersion.Any) // Fall Through
@@ -1502,7 +1502,7 @@ private static IEnumerable<int> getMoves(PKM pkm, int species, int lvl, int form
PersonalInfo pi = PersonalTable.AO[index];
if (LVL) r.AddRange(LevelUpAO[index].getMoves(lvl));
if (moveTutor) r.AddRange(getTutorMoves(pkm, species, form, specialTutors));
if (moveTutor) r.AddRange(getTutorMoves(pkm, species, form, specialTutors, Generation));
if (Machine) r.AddRange(TMHM_AO.Where((t, m) => pi.TMHM[m]));
break;
}
@@ -1520,7 +1520,7 @@ private static IEnumerable<int> getMoves(PKM pkm, int species, int lvl, int form
lvl = 100; // Move reminder can teach any level in movepool now!
if (LVL) r.AddRange(LevelUpSM[index].getMoves(lvl));
if (moveTutor) r.AddRange(getTutorMoves(pkm, species, form, specialTutors));
if (moveTutor) r.AddRange(getTutorMoves(pkm, species, form, specialTutors, Generation));
if (Machine) r.AddRange(TMHM_SM.Where((t, m) => pi.TMHM[m]));
break;
}
@@ -1552,41 +1552,45 @@ private static IEnumerable<int> getEggMoves(PKM pkm, int species, int formnum)
return new List<int>();
}
}
private static IEnumerable<int> getTutorMoves(PKM pkm, int species, int form, bool specialTutors)
private static IEnumerable<int> getTutorMoves(PKM pkm, int species, int form, bool specialTutors, int generation)
{
List<int> moves = new List<int>();
if (pkm.Format < 3)
{
if (pkm.Species == 25 || pkm.Species == 26) // Surf Pikachu via Stadium
moves.Add(57);
return moves;
}
PersonalInfo info = pkm.PersonalInfo;
// Type Tutors -- Pledge moves and High BP moves switched places in G7+
if (pkm.Format <= 6)
moves.AddRange(TypeTutor6.Where((t, i) => info.TypeTutors[i]));
else if (pkm.Format >= 7)
moves.AddRange(TypeTutor7.Where((t, i) => info.TypeTutors[i]));
// Varied Tutors
//if (pkm.InhabitedGeneration(5) && Tutors)
//{
// //PersonalInfo pi = PersonalTable.B2W2.getFormeEntry(species, form);
// //for (int i = 0; i < Tutors_B2W2.Length; i++)
// // for (int b = 0; b < Tutors_B2W2[i].Length; b++)
// // if (pi.SpecialTutors[i][b])
// // moves.Add(Tutors_B2W2[i][b]);
//}
if (pkm.InhabitedGeneration(6) && specialTutors && (pkm.AO || !pkm.IsUntraded))
switch (generation)
{
PersonalInfo pi = PersonalTable.AO.getFormeEntry(species, form);
for (int i = 0; i < Tutors_AO.Length; i++)
for (int b = 0; b < Tutors_AO[i].Length; b++)
if (pi.SpecialTutors[i][b])
moves.Add(Tutors_AO[i][b]);
case 1:
case 2:
if (pkm.Format < 3 && (pkm.Species == 25 || pkm.Species == 26)) // Surf Pikachu via Stadium
moves.Add(57);
break;
//case 5:
// Varied Tutors
//if (pkm.InhabitedGeneration(5) && Tutors)
//{
// //PersonalInfo pi = PersonalTable.B2W2.getFormeEntry(species, form);
// //for (int i = 0; i < Tutors_B2W2.Length; i++)
// // for (int b = 0; b < Tutors_B2W2[i].Length; b++)
// // if (pi.SpecialTutors[i][b])
// // moves.Add(Tutors_B2W2[i][b]);
//}
case 6:
moves.AddRange(TypeTutor6.Where((t, i) => info.TypeTutors[i]));
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++)
for (int b = 0; b < Tutors_AO[i].Length; b++)
if (pi.SpecialTutors[i][b])
moves.Add(Tutors_AO[i][b]);
}
break;
case 7:
// Type Tutors -- Pledge moves and High BP moves switched places in G7+
moves.AddRange(TypeTutor6.Where((t, i) => info.TypeTutors[i]));
// No special tutors in G7
break;
}
// No tutors in G7
return moves.Distinct();
}
}