2021-01-13 06:25:30 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2018-06-09 03:10:41 +00:00
|
|
|
|
|
|
|
|
|
using static PKHeX.Core.Legal;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
|
|
|
|
public static class MoveTutor
|
|
|
|
|
{
|
|
|
|
|
public static GameVersion GetIsTutorMove(PKM pkm, int species, int form, int generation, int move, bool specialTutors = true)
|
|
|
|
|
{
|
2019-10-08 01:40:09 +00:00
|
|
|
|
return generation switch
|
2018-06-09 03:10:41 +00:00
|
|
|
|
{
|
2019-10-08 01:40:09 +00:00
|
|
|
|
1 => GetIsTutor1(pkm, species, move),
|
|
|
|
|
2 => GetIsTutor2(pkm, species, move),
|
|
|
|
|
3 => GetIsTutor3(species, move),
|
|
|
|
|
4 => GetIsTutor4(species, form, move),
|
|
|
|
|
5 => GetIsTutor5(pkm, species, form, specialTutors, move),
|
|
|
|
|
6 => GetIsTutor6(pkm, species, form, specialTutors, move),
|
|
|
|
|
7 => GetIsTutor7(pkm, species, form, specialTutors, move),
|
|
|
|
|
8 => GetIsTutor8(pkm, species, form, specialTutors, move),
|
2021-08-20 20:49:20 +00:00
|
|
|
|
_ => NONE,
|
2019-10-08 01:40:09 +00:00
|
|
|
|
};
|
2018-06-09 03:10:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static GameVersion GetIsTutor1(PKM pkm, int species, int move)
|
|
|
|
|
{
|
|
|
|
|
// Surf Pikachu via Stadium
|
2021-09-06 22:38:32 +00:00
|
|
|
|
if (move != (int)Move.Surf || ParseSettings.AllowGBCartEra)
|
2018-06-09 03:10:41 +00:00
|
|
|
|
return NONE;
|
2021-08-22 08:26:28 +00:00
|
|
|
|
if (pkm.Format < 3 && species is (int)Species.Pikachu or (int)Species.Raichu)
|
2018-06-09 03:10:41 +00:00
|
|
|
|
return GameVersion.Stadium;
|
|
|
|
|
return NONE;
|
|
|
|
|
}
|
2018-08-03 03:11:42 +00:00
|
|
|
|
|
2018-06-09 03:10:41 +00:00
|
|
|
|
private static GameVersion GetIsTutor2(PKM pkm, int species, int move)
|
|
|
|
|
{
|
2018-10-06 02:58:30 +00:00
|
|
|
|
if (!ParseSettings.AllowGen2Crystal(pkm))
|
2018-06-09 03:10:41 +00:00
|
|
|
|
return NONE;
|
|
|
|
|
var info = PersonalTable.C[species];
|
2021-01-13 06:25:30 +00:00
|
|
|
|
var tutor = Array.IndexOf(Tutors_GSC, move);
|
|
|
|
|
if (tutor != -1 && info.TMHM[57 + tutor])
|
|
|
|
|
return GameVersion.C;
|
|
|
|
|
return NONE;
|
2018-06-09 03:10:41 +00:00
|
|
|
|
}
|
2018-08-03 03:11:42 +00:00
|
|
|
|
|
2018-06-09 03:10:41 +00:00
|
|
|
|
private static GameVersion GetIsTutor3(int species, int move)
|
|
|
|
|
{
|
|
|
|
|
// E Tutors (Free)
|
|
|
|
|
// E Tutors (BP)
|
|
|
|
|
var info = PersonalTable.E[species];
|
2021-01-13 06:25:30 +00:00
|
|
|
|
var e = Array.IndexOf(Tutor_E, move);
|
|
|
|
|
if (e != -1 && info.TypeTutors[e])
|
|
|
|
|
return GameVersion.E;
|
2018-06-09 03:10:41 +00:00
|
|
|
|
|
|
|
|
|
// FRLG Tutors
|
|
|
|
|
// Only special tutor moves, normal tutor moves are already included in Emerald data
|
2021-01-13 06:25:30 +00:00
|
|
|
|
var frlg = Array.IndexOf(SpecialTutors_FRLG, move);
|
|
|
|
|
if (frlg != -1 && SpecialTutors_Compatibility_FRLG[frlg] == species)
|
|
|
|
|
return GameVersion.FRLG;
|
2018-06-09 03:10:41 +00:00
|
|
|
|
|
|
|
|
|
// XD
|
2021-01-13 06:25:30 +00:00
|
|
|
|
var xd = Array.IndexOf(SpecialTutors_XD_Exclusive, move);
|
2022-06-12 21:02:22 +00:00
|
|
|
|
if (xd != -1 && SpecialTutors_Compatibility_XD_Exclusive[xd].AsSpan().IndexOf(species) != -1)
|
2021-01-13 06:25:30 +00:00
|
|
|
|
return GameVersion.XD;
|
2018-06-09 03:10:41 +00:00
|
|
|
|
|
|
|
|
|
// XD (Mew)
|
2022-06-12 21:02:22 +00:00
|
|
|
|
if (species == (int)Species.Mew && Tutor_3Mew.AsSpan().IndexOf(move) != -1)
|
2018-06-09 03:10:41 +00:00
|
|
|
|
return GameVersion.XD;
|
|
|
|
|
|
|
|
|
|
return NONE;
|
|
|
|
|
}
|
2018-08-03 03:11:42 +00:00
|
|
|
|
|
2018-06-09 03:10:41 +00:00
|
|
|
|
private static GameVersion GetIsTutor4(int species, int form, int move)
|
|
|
|
|
{
|
2022-06-12 21:02:22 +00:00
|
|
|
|
var pi = PersonalTable.HGSS[species, form];
|
2021-01-13 06:25:30 +00:00
|
|
|
|
var type = Array.IndexOf(Tutors_4, move);
|
|
|
|
|
if (type != -1 && pi.TypeTutors[type])
|
|
|
|
|
return GameVersion.Gen4;
|
2018-06-09 03:10:41 +00:00
|
|
|
|
|
2021-01-13 06:25:30 +00:00
|
|
|
|
var special = Array.IndexOf(SpecialTutors_4, move);
|
2022-06-12 21:02:22 +00:00
|
|
|
|
if (special != -1 && SpecialTutors_Compatibility_4[special].AsSpan().IndexOf(species) != -1)
|
2021-01-13 06:25:30 +00:00
|
|
|
|
return GameVersion.HGSS;
|
2018-06-09 03:10:41 +00:00
|
|
|
|
|
|
|
|
|
return NONE;
|
|
|
|
|
}
|
2018-08-03 03:11:42 +00:00
|
|
|
|
|
2018-06-09 03:10:41 +00:00
|
|
|
|
private static GameVersion GetIsTutor5(PKM pkm, int species, int form, bool specialTutors, int move)
|
|
|
|
|
{
|
2022-06-12 21:02:22 +00:00
|
|
|
|
var pi = PersonalTable.B2W2[species, form];
|
2021-01-13 06:25:30 +00:00
|
|
|
|
var type = Array.IndexOf(TypeTutor6, move);
|
|
|
|
|
if (type != -1 && pi.TypeTutors[type])
|
2018-06-09 03:10:41 +00:00
|
|
|
|
return GameVersion.Gen5;
|
|
|
|
|
|
2020-06-27 19:04:28 +00:00
|
|
|
|
if (specialTutors && pkm.HasVisitedB2W2(species))
|
2018-08-03 03:11:42 +00:00
|
|
|
|
{
|
2019-11-17 19:13:52 +00:00
|
|
|
|
var tutors = Tutors_B2W2;
|
|
|
|
|
for (int i = 0; i < tutors.Length; i++)
|
2018-08-03 03:11:42 +00:00
|
|
|
|
{
|
2021-01-13 06:25:30 +00:00
|
|
|
|
var tutor = Array.IndexOf(tutors[i], move);
|
|
|
|
|
if (tutor == -1)
|
|
|
|
|
continue;
|
|
|
|
|
if (pi.SpecialTutors[i][tutor])
|
|
|
|
|
return GameVersion.B2W2;
|
|
|
|
|
break;
|
2018-08-03 03:11:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-09 03:10:41 +00:00
|
|
|
|
|
|
|
|
|
return NONE;
|
|
|
|
|
}
|
2018-08-03 03:11:42 +00:00
|
|
|
|
|
2018-06-09 03:10:41 +00:00
|
|
|
|
private static GameVersion GetIsTutor6(PKM pkm, int species, int form, bool specialTutors, int move)
|
|
|
|
|
{
|
2022-06-12 21:02:22 +00:00
|
|
|
|
var pi = PersonalTable.AO[species, form];
|
2021-01-13 06:25:30 +00:00
|
|
|
|
var type = Array.IndexOf(TypeTutor6, move);
|
|
|
|
|
if (type != -1 && pi.TypeTutors[type])
|
|
|
|
|
return GameVersion.Gen6;
|
2018-06-09 03:10:41 +00:00
|
|
|
|
|
2020-06-27 19:04:28 +00:00
|
|
|
|
if (specialTutors && pkm.HasVisitedORAS(species))
|
2018-08-03 03:11:42 +00:00
|
|
|
|
{
|
2019-11-17 19:13:52 +00:00
|
|
|
|
var tutors = Tutors_AO;
|
|
|
|
|
for (int i = 0; i < tutors.Length; i++)
|
2018-08-03 03:11:42 +00:00
|
|
|
|
{
|
2021-01-13 06:25:30 +00:00
|
|
|
|
var tutor = Array.IndexOf(tutors[i], move);
|
|
|
|
|
if (tutor == -1)
|
|
|
|
|
continue;
|
|
|
|
|
if (pi.SpecialTutors[i][tutor])
|
|
|
|
|
return GameVersion.ORAS;
|
|
|
|
|
break;
|
2018-08-03 03:11:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-09 03:10:41 +00:00
|
|
|
|
|
|
|
|
|
return NONE;
|
|
|
|
|
}
|
2018-08-03 03:11:42 +00:00
|
|
|
|
|
2018-06-09 03:10:41 +00:00
|
|
|
|
private static GameVersion GetIsTutor7(PKM pkm, int species, int form, bool specialTutors, int move)
|
|
|
|
|
{
|
2022-06-12 21:02:22 +00:00
|
|
|
|
var pi = PersonalTable.USUM[species, form];
|
2021-01-13 06:25:30 +00:00
|
|
|
|
var type = Array.IndexOf(TypeTutor6, move);
|
|
|
|
|
if (type != -1 && pi.TypeTutors[type])
|
|
|
|
|
return GameVersion.Gen7;
|
2018-06-09 03:10:41 +00:00
|
|
|
|
|
2020-06-27 19:04:28 +00:00
|
|
|
|
if (specialTutors && pkm.HasVisitedUSUM(species))
|
2018-08-03 03:11:42 +00:00
|
|
|
|
{
|
2021-01-13 06:25:30 +00:00
|
|
|
|
var tutor = Array.IndexOf(Tutors_USUM, move);
|
|
|
|
|
if (tutor != -1 && pi.SpecialTutors[0][tutor])
|
|
|
|
|
return GameVersion.USUM;
|
2018-08-03 03:11:42 +00:00
|
|
|
|
}
|
2018-06-09 03:10:41 +00:00
|
|
|
|
|
|
|
|
|
return NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-23 23:56:47 +00:00
|
|
|
|
private static GameVersion GetIsTutor8(PKM pkm, int species, int form, bool specialTutors, int move)
|
|
|
|
|
{
|
2022-05-31 04:43:52 +00:00
|
|
|
|
if (pkm is PA8)
|
2022-02-05 01:35:15 +00:00
|
|
|
|
{
|
2022-06-12 21:02:22 +00:00
|
|
|
|
var pi = (PersonalInfoLA)PersonalTable.LA[species, form];
|
2022-02-05 01:35:15 +00:00
|
|
|
|
if (!pi.IsPresentInGame)
|
|
|
|
|
return NONE;
|
2022-05-14 15:28:13 +00:00
|
|
|
|
var index = Array.IndexOf(MoveShop8_LA, (ushort)move);
|
2022-02-05 01:35:15 +00:00
|
|
|
|
if (index != -1 && pi.SpecialTutors[0][index])
|
|
|
|
|
return GameVersion.PLA;
|
|
|
|
|
|
|
|
|
|
return NONE;
|
|
|
|
|
}
|
2022-06-05 04:03:25 +00:00
|
|
|
|
if (pkm is PB8)
|
2021-12-10 03:53:43 +00:00
|
|
|
|
{
|
2022-06-12 21:02:22 +00:00
|
|
|
|
var pi = (PersonalInfoBDSP)PersonalTable.BDSP[species, form];
|
2021-12-10 03:53:43 +00:00
|
|
|
|
if (!pi.IsPresentInGame)
|
|
|
|
|
return NONE;
|
|
|
|
|
var type = Array.IndexOf(TypeTutor8b, move);
|
|
|
|
|
if (type != -1 && pi.TypeTutors[type])
|
|
|
|
|
return GameVersion.BDSP;
|
2020-12-23 17:34:29 +00:00
|
|
|
|
|
|
|
|
|
return NONE;
|
2021-12-10 03:53:43 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2022-06-12 21:02:22 +00:00
|
|
|
|
var pi = (PersonalInfoSWSH)PersonalTable.SWSH[species, form];
|
2021-12-10 03:53:43 +00:00
|
|
|
|
if (!pi.IsPresentInGame)
|
|
|
|
|
return NONE;
|
|
|
|
|
var type = Array.IndexOf(TypeTutor8, move);
|
|
|
|
|
if (type != -1 && pi.TypeTutors[type])
|
|
|
|
|
return GameVersion.SWSH;
|
2020-12-24 01:14:38 +00:00
|
|
|
|
|
2021-12-10 03:53:43 +00:00
|
|
|
|
if (!specialTutors)
|
|
|
|
|
return NONE;
|
2019-11-17 19:13:52 +00:00
|
|
|
|
|
2021-12-10 03:53:43 +00:00
|
|
|
|
var tutor = Array.IndexOf(Tutors_SWSH_1, move);
|
|
|
|
|
if (tutor != -1 && pi.SpecialTutors[0][tutor])
|
|
|
|
|
return GameVersion.SWSH;
|
|
|
|
|
|
|
|
|
|
return NONE;
|
|
|
|
|
}
|
2019-09-23 23:56:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-06-09 03:10:41 +00:00
|
|
|
|
public static IEnumerable<int> GetTutorMoves(PKM pkm, int species, int form, bool specialTutors, int generation)
|
|
|
|
|
{
|
2020-12-22 01:17:56 +00:00
|
|
|
|
List<int> moves = new();
|
2018-06-09 03:10:41 +00:00
|
|
|
|
switch (generation)
|
|
|
|
|
{
|
|
|
|
|
case 1: AddMovesTutor1(moves, species, pkm.Format); break;
|
|
|
|
|
case 2: AddMovesTutor2(moves, species, pkm.Format, pkm.Korean); break;
|
|
|
|
|
case 3: AddMovesTutor3(moves, species); break;
|
|
|
|
|
case 4: AddMovesTutor4(moves, species, form); break;
|
|
|
|
|
case 5: AddMovesTutor5(moves, species, form, pkm, specialTutors); break;
|
|
|
|
|
case 6: AddMovesTutor6(moves, species, form, pkm, specialTutors); break;
|
|
|
|
|
case 7: AddMovesTutor7(moves, species, form, pkm, specialTutors); break;
|
2019-09-23 23:56:47 +00:00
|
|
|
|
case 8: AddMovesTutor8(moves, species, form, pkm, specialTutors); break;
|
2018-06-09 03:10:41 +00:00
|
|
|
|
}
|
2022-06-12 21:02:22 +00:00
|
|
|
|
return moves;
|
2018-06-09 03:10:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void AddMovesTutor1(List<int> moves, int species, int format)
|
|
|
|
|
{
|
2021-08-22 08:26:28 +00:00
|
|
|
|
if (ParseSettings.AllowGBCartEra && format < 3 && species is (int)Species.Pikachu or (int)Species.Raichu) // Surf Pikachu via Stadium
|
2018-06-09 03:10:41 +00:00
|
|
|
|
moves.Add(57);
|
|
|
|
|
}
|
2018-08-03 03:11:42 +00:00
|
|
|
|
|
2018-06-09 03:10:41 +00:00
|
|
|
|
private static void AddMovesTutor2(List<int> moves, int species, int format, bool korean = false)
|
|
|
|
|
{
|
|
|
|
|
if (korean)
|
|
|
|
|
return;
|
|
|
|
|
var pi = PersonalTable.C[species];
|
2022-06-12 21:02:22 +00:00
|
|
|
|
var hmBits = pi.TMHM.AsSpan(57, 3);
|
|
|
|
|
for (int i = 0; i < Tutors_GSC.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
if (hmBits[i])
|
|
|
|
|
moves.Add(Tutors_GSC[i]);
|
|
|
|
|
}
|
2018-06-09 03:10:41 +00:00
|
|
|
|
AddMovesTutor1(moves, species, format);
|
|
|
|
|
}
|
2018-08-03 03:11:42 +00:00
|
|
|
|
|
2018-06-09 03:10:41 +00:00
|
|
|
|
private static void AddMovesTutor3(List<int> moves, int species)
|
|
|
|
|
{
|
|
|
|
|
// E Tutors (Free)
|
|
|
|
|
// E Tutors (BP)
|
|
|
|
|
var pi = PersonalTable.E[species];
|
2022-06-12 21:02:22 +00:00
|
|
|
|
AddPermittedIndexes(moves, Tutor_E, pi.TypeTutors);
|
2018-06-09 03:10:41 +00:00
|
|
|
|
// FRLG Tutors
|
|
|
|
|
// Only special tutor moves, normal tutor moves are already included in Emerald data
|
2022-06-12 21:02:22 +00:00
|
|
|
|
AddIfPermitted(moves, SpecialTutors_FRLG, SpecialTutors_Compatibility_FRLG, species);
|
2018-06-09 03:10:41 +00:00
|
|
|
|
// XD
|
2022-06-12 21:02:22 +00:00
|
|
|
|
for (int i = 0; i < SpecialTutors_XD_Exclusive.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
var allowed = SpecialTutors_Compatibility_XD_Exclusive[i].AsSpan();
|
|
|
|
|
var index = allowed.IndexOf(species);
|
|
|
|
|
if (index != -1)
|
|
|
|
|
moves.Add(SpecialTutors_XD_Exclusive[i]);
|
|
|
|
|
}
|
2018-06-09 03:10:41 +00:00
|
|
|
|
// XD (Mew)
|
2019-12-09 01:39:19 +00:00
|
|
|
|
if (species == (int)Species.Mew)
|
2018-06-09 03:10:41 +00:00
|
|
|
|
moves.AddRange(Tutor_3Mew);
|
|
|
|
|
}
|
2018-08-03 03:11:42 +00:00
|
|
|
|
|
2018-06-09 03:10:41 +00:00
|
|
|
|
private static void AddMovesTutor4(List<int> moves, int species, int form)
|
|
|
|
|
{
|
2022-06-12 21:02:22 +00:00
|
|
|
|
var pi = PersonalTable.HGSS[species, form];
|
|
|
|
|
AddPermittedIndexes(moves, Tutors_4, pi.TypeTutors);
|
|
|
|
|
for (int i = 0; i < SpecialTutors_4.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
var allowed = SpecialTutors_Compatibility_4[i].AsSpan();
|
|
|
|
|
var index = allowed.IndexOf(species);
|
|
|
|
|
if (index != -1)
|
|
|
|
|
moves.Add(SpecialTutors_4[i]);
|
|
|
|
|
}
|
2018-06-09 03:10:41 +00:00
|
|
|
|
}
|
2018-08-03 03:11:42 +00:00
|
|
|
|
|
2018-06-09 03:10:41 +00:00
|
|
|
|
private static void AddMovesTutor5(List<int> moves, int species, int form, PKM pkm, bool specialTutors)
|
|
|
|
|
{
|
2022-06-12 21:02:22 +00:00
|
|
|
|
var pi = PersonalTable.B2W2[species, form];
|
|
|
|
|
AddPermittedIndexes(moves, TypeTutor6, pi.TypeTutors);
|
2018-06-09 03:10:41 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(5) && specialTutors)
|
2022-06-12 21:02:22 +00:00
|
|
|
|
AddPermittedIndexes(moves, Tutors_B2W2, pi.SpecialTutors);
|
2018-06-09 03:10:41 +00:00
|
|
|
|
}
|
2018-08-03 03:11:42 +00:00
|
|
|
|
|
2018-06-09 03:10:41 +00:00
|
|
|
|
private static void AddMovesTutor6(List<int> moves, int species, int form, PKM pkm, bool specialTutors)
|
|
|
|
|
{
|
2022-06-12 21:02:22 +00:00
|
|
|
|
var pi = PersonalTable.AO[species, form];
|
|
|
|
|
AddPermittedIndexes(moves, TypeTutor6, pi.TypeTutors);
|
2020-06-27 19:04:28 +00:00
|
|
|
|
if (specialTutors && pkm.HasVisitedORAS(species))
|
2022-06-12 21:02:22 +00:00
|
|
|
|
AddPermittedIndexes(moves, Tutors_AO, pi.SpecialTutors);
|
2018-06-09 03:10:41 +00:00
|
|
|
|
}
|
2018-08-03 03:11:42 +00:00
|
|
|
|
|
2018-06-09 03:10:41 +00:00
|
|
|
|
private static void AddMovesTutor7(List<int> moves, int species, int form, PKM pkm, bool specialTutors)
|
|
|
|
|
{
|
2021-01-01 01:45:11 +00:00
|
|
|
|
if (pkm.Version is (int)GameVersion.GO or (int)GameVersion.GP or (int)GameVersion.GE)
|
2018-11-11 05:04:48 +00:00
|
|
|
|
return;
|
2022-06-12 21:02:22 +00:00
|
|
|
|
var pi = PersonalTable.USUM[species, form];
|
|
|
|
|
AddPermittedIndexes(moves, TypeTutor6, pi.TypeTutors);
|
2020-06-27 19:04:28 +00:00
|
|
|
|
if (specialTutors && pkm.HasVisitedUSUM(species))
|
2022-06-12 21:02:22 +00:00
|
|
|
|
AddPermittedIndexes(moves, Tutors_USUM, pi.SpecialTutors[0]);
|
2018-06-09 03:10:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-23 23:56:47 +00:00
|
|
|
|
private static void AddMovesTutor8(List<int> moves, int species, int form, PKM pkm, bool specialTutors)
|
|
|
|
|
{
|
2022-05-31 04:43:52 +00:00
|
|
|
|
if (pkm is PA8)
|
2022-02-05 01:35:15 +00:00
|
|
|
|
{
|
2022-06-12 21:02:22 +00:00
|
|
|
|
var pi = (PersonalInfoLA)PersonalTable.LA[species, form];
|
2022-02-05 01:35:15 +00:00
|
|
|
|
if (!pi.IsPresentInGame)
|
|
|
|
|
return;
|
2022-03-06 20:01:47 +00:00
|
|
|
|
var shop = MoveShop8_LA;
|
|
|
|
|
var tutors = pi.SpecialTutors[0];
|
|
|
|
|
for (int i = 0; i < shop.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
if (tutors[i])
|
|
|
|
|
moves.Add(shop[i]);
|
|
|
|
|
}
|
2022-02-09 23:06:14 +00:00
|
|
|
|
return;
|
2022-02-05 01:35:15 +00:00
|
|
|
|
}
|
2022-05-31 04:43:52 +00:00
|
|
|
|
if (pkm is PB8)
|
2021-11-21 00:50:44 +00:00
|
|
|
|
{
|
2022-06-12 21:02:22 +00:00
|
|
|
|
var pi = (PersonalInfoBDSP)PersonalTable.BDSP[species, form];
|
|
|
|
|
if (pi.IsPresentInGame)
|
|
|
|
|
AddPermittedIndexes(moves, TypeTutor8b, pi.TypeTutors);
|
2021-11-21 00:50:44 +00:00
|
|
|
|
}
|
|
|
|
|
else // SWSH
|
|
|
|
|
{
|
2022-06-12 21:02:22 +00:00
|
|
|
|
var pi = (PersonalInfoSWSH)PersonalTable.SWSH[species, form];
|
2021-11-21 00:50:44 +00:00
|
|
|
|
if (!pi.IsPresentInGame)
|
|
|
|
|
return;
|
2022-06-12 21:02:22 +00:00
|
|
|
|
AddPermittedIndexes(moves, TypeTutor8, pi.TypeTutors);
|
2021-11-21 00:50:44 +00:00
|
|
|
|
if (specialTutors)
|
2022-06-12 21:02:22 +00:00
|
|
|
|
AddPermittedIndexes(moves, Tutors_SWSH_1, pi.SpecialTutors[0]);
|
2021-11-21 00:50:44 +00:00
|
|
|
|
}
|
2019-09-23 23:56:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-06-12 21:02:22 +00:00
|
|
|
|
private static void AddIfPermitted(List<int> moves, ReadOnlySpan<int> arrMoves, ReadOnlySpan<int> arrSpecies, int species)
|
|
|
|
|
{
|
|
|
|
|
var index = arrSpecies.IndexOf(species);
|
|
|
|
|
if (index != -1)
|
|
|
|
|
moves.Add(arrMoves[index]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void AddPermittedIndexes(List<int> moves, int[][] tutors, bool[][] permit)
|
2018-06-09 03:10:41 +00:00
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < tutors.Length; i++)
|
2018-08-03 03:11:42 +00:00
|
|
|
|
{
|
2022-06-12 21:02:22 +00:00
|
|
|
|
var arr = tutors[i];
|
|
|
|
|
var per = permit[i];
|
|
|
|
|
AddPermittedIndexes(moves, arr, per);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void AddPermittedIndexes(List<int> moves, int[] moveIDs, bool[] permit)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < moveIDs.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
if (permit[i])
|
|
|
|
|
moves.Add(moveIDs[i]);
|
2018-08-03 03:11:42 +00:00
|
|
|
|
}
|
2018-06-09 03:10:41 +00:00
|
|
|
|
}
|
2018-06-09 23:04:06 +00:00
|
|
|
|
|
|
|
|
|
internal static void AddSpecialTutorMoves(List<int> r, PKM pkm, int Generation, int species)
|
|
|
|
|
{
|
|
|
|
|
switch (species)
|
|
|
|
|
{
|
2021-02-02 17:40:58 +00:00
|
|
|
|
case (int)Species.Keldeo:
|
|
|
|
|
r.Add((int)Move.SecretSword);
|
2018-06-09 23:04:06 +00:00
|
|
|
|
break;
|
2019-06-01 17:22:49 +00:00
|
|
|
|
case (int)Species.Meloetta:
|
2021-02-02 17:40:58 +00:00
|
|
|
|
r.Add((int)Move.RelicSong);
|
2018-06-09 23:04:06 +00:00
|
|
|
|
break;
|
2018-11-11 05:04:48 +00:00
|
|
|
|
|
2020-12-11 04:42:30 +00:00
|
|
|
|
case (int)Species.Pikachu when Generation == 7 && pkm.Form == 8:
|
2018-11-11 05:04:48 +00:00
|
|
|
|
r.AddRange(Tutor_StarterPikachu);
|
|
|
|
|
break;
|
2020-12-11 04:42:30 +00:00
|
|
|
|
case (int)Species.Eevee when Generation == 7 && pkm.Form == 1:
|
2018-11-11 05:04:48 +00:00
|
|
|
|
r.AddRange(Tutor_StarterEevee);
|
|
|
|
|
break;
|
|
|
|
|
|
2022-06-08 03:15:32 +00:00
|
|
|
|
case (int)Species.Pikachu or (int)Species.Raichu when Generation == 7 && !(pkm.LGPE || pkm.GO):
|
2021-01-13 06:25:30 +00:00
|
|
|
|
r.Add((int)Move.VoltTackle);
|
2018-06-09 23:04:06 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-02 21:11:51 +00:00
|
|
|
|
/// <summary> Rotom Moves that correspond to a specific form (form-0 ignored). </summary>
|
2021-01-13 06:25:30 +00:00
|
|
|
|
private static readonly int[] RotomMoves = { (int)Move.Overheat, (int)Move.HydroPump, (int)Move.Blizzard, (int)Move.AirSlash, (int)Move.LeafStorm };
|
2020-11-02 21:11:51 +00:00
|
|
|
|
|
2021-01-13 06:25:30 +00:00
|
|
|
|
internal static void AddSpecialFormChangeMoves(List<int> r, PKM pkm, int generation, int species)
|
2018-06-09 23:04:06 +00:00
|
|
|
|
{
|
|
|
|
|
switch (species)
|
|
|
|
|
{
|
2021-01-13 06:25:30 +00:00
|
|
|
|
case (int)Species.Rotom when generation >= 4:
|
2020-10-24 18:16:01 +00:00
|
|
|
|
var formMoves = RotomMoves;
|
2020-12-11 04:42:30 +00:00
|
|
|
|
var form = pkm.Form - 1;
|
2020-10-24 18:16:01 +00:00
|
|
|
|
if ((uint)form < formMoves.Length)
|
|
|
|
|
r.Add(RotomMoves[form]);
|
2018-06-09 23:04:06 +00:00
|
|
|
|
break;
|
2021-01-13 06:25:30 +00:00
|
|
|
|
case (int)Species.Zygarde when generation == 7:
|
2018-06-09 23:04:06 +00:00
|
|
|
|
r.AddRange(ZygardeMoves);
|
|
|
|
|
break;
|
2020-12-11 04:42:30 +00:00
|
|
|
|
case (int)Species.Necrozma when pkm.Form == 1: // Sun
|
2021-08-15 03:20:13 +00:00
|
|
|
|
r.Add((int)Move.SunsteelStrike);
|
2018-06-09 23:04:06 +00:00
|
|
|
|
break;
|
2020-12-11 04:42:30 +00:00
|
|
|
|
case (int)Species.Necrozma when pkm.Form == 2: // Moon
|
2021-08-15 03:20:13 +00:00
|
|
|
|
r.Add((int)Move.MoongeistBeam);
|
2018-06-09 23:04:06 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-09 03:10:41 +00:00
|
|
|
|
}
|
|
|
|
|
}
|