From 02c10f6fc75df3fc8d80744dec0892f59e068ceb Mon Sep 17 00:00:00 2001 From: javierhimura Date: Mon, 20 Mar 2017 18:53:16 +0100 Subject: [PATCH] Get tutor moves for gen 3 and 4 pokemon, including special tutors Filter deoxys gen 3 level moves by form --- PKHeX/Legality/Core.cs | 48 +++++++++++++++++++++--------- PKHeX/Legality/Tables3.cs | 62 +++++++++++++++++++++++++++++++++++++-- PKHeX/Legality/Tables4.cs | 37 ++++++++++++++++++++++- 3 files changed, 130 insertions(+), 17 deletions(-) diff --git a/PKHeX/Legality/Core.cs b/PKHeX/Legality/Core.cs index 5cc758d69..7dca92a17 100644 --- a/PKHeX/Legality/Core.cs +++ b/PKHeX/Legality/Core.cs @@ -315,7 +315,7 @@ private static EncounterArea[] getTables2() var h_s = EncounterArea.getArray2_H(Resources.encounter_silver_h); var h = h_c.Concat(h_g).Concat(h_s); - return addExtraTableSlots(g, s).Concat(c).Concat(f).Concat(h).ToArray(); + return addExtraTableSlots(g, s).Concat(c).Concat(f).Concat(h).ToArray(); } static Legal() // Setup { @@ -363,9 +363,11 @@ private static EncounterArea[] getTables2() var TMHM = Data.unpackMini(Resources.hmtm_g3, "g3"); for (int i = 0; i <= MaxSpeciesID_3; i++) PersonalTable.RS[i].AddTMHM(TMHM[i]); + // Tutors g3 contains tutor compatiblity data extracted from emerald, + // fire red and leaf green tutors data is a subset of emerald data var tutors = Data.unpackMini(Resources.tutors_g3, "g3"); for (int i = 0; i <= MaxSpeciesID_3; i++) - PersonalTable.RS[i].AddTypeTutors(tutors[i]); + PersonalTable.E[i].AddTypeTutors(tutors[i]); } // Gen 4 { @@ -2036,10 +2038,23 @@ private static IEnumerable getMoves(PKM pkm, int species, int lvl, int form return r; if (LVL) { - r.AddRange(LevelUpRS[index].getMoves(lvl)); - r.AddRange(LevelUpE[index].getMoves(lvl)); - r.AddRange(LevelUpFR[index].getMoves(lvl)); - r.AddRange(LevelUpLG[index].getMoves(lvl)); + if(index == 386) + { + switch(form) + { + case 0: r.AddRange(LevelUpRS[index].getMoves(lvl));break; + case 1: r.AddRange(LevelUpFR[index].getMoves(lvl)); break; + case 2: r.AddRange(LevelUpLG[index].getMoves(lvl)); break; + case 3: r.AddRange(LevelUpE[index].getMoves(lvl)); break; + } + } + else + { + r.AddRange(LevelUpRS[index].getMoves(lvl)); + r.AddRange(LevelUpE[index].getMoves(lvl)); + r.AddRange(LevelUpFR[index].getMoves(lvl)); + r.AddRange(LevelUpLG[index].getMoves(lvl)); + } } if (Machine) { @@ -2050,6 +2065,8 @@ private static IEnumerable getMoves(PKM pkm, int species, int lvl, int form } if (moveTutor) r.AddRange(getTutorMoves(pkm, species, form, specialTutors, Generation)); + if (pkm.Format > 3) //Remove HM + r = r.Except(HM_3).ToList(); break; } case 4: @@ -2065,11 +2082,15 @@ private static IEnumerable getMoves(PKM pkm, int species, int lvl, int form } if (Machine) { - var pi_c = PersonalTable.HGSS[index]; - r.AddRange(TMHM_HGSS.Where((t, m) => pi_c.TMHM[m])); + var pi_hgss = PersonalTable.HGSS[index]; + r.AddRange(TMHM_HGSS.Where((t, m) => pi_hgss.TMHM[m])); + var pi_dppt = PersonalTable.Pt[index]; + r.AddRange(TMHM_DPPt.Where((t, m) => pi_dppt.TMHM[m])); } if (moveTutor) r.AddRange(getTutorMoves(pkm, species, form, specialTutors, Generation)); + if (pkm.Format > 4) //Remove HM + r = r.Except(HM_4_RemovePokeTransfer).ToList(); break; } case 5: @@ -2224,16 +2245,14 @@ private static IEnumerable getTutorMoves(PKM pkm, int species, int form, bo moves.AddRange(Tutors_GSC.Where((t, i) => PersonalTable.C[species].TMHM[57 + i])); goto case 1; case 3: - // RS Tutors - moves.AddRange(TypeTutor3.Where((t, i) => PersonalTable.C[species].TMHM[58 + i])); // E Tutors (Free) - // E Tutors (BP) - + moves.AddRange(Tutor_E.Where((t, i) => PersonalTable.E[species].TMHM[58 + i])); // FRLG Tutors - + // Only special tutor moves, normal tutor moves are already included in Emerald data + moves.AddRange(SpecialTutors_FRLG.Where(t => SpecialTutors_Compatibility_FRLG[t].Any(e => e == species))); // XD - + moves.AddRange(SpecialTutors_XD_Exclusive.Where(t => SpecialTutors_Compatibility_XD_Exclusive[t].Any(e => e == species))); // XD (Mew) if (species == 151) moves.AddRange(Tutor_3Mew); @@ -2242,6 +2261,7 @@ private static IEnumerable getTutorMoves(PKM pkm, int species, int form, bo case 4: info = PersonalTable.HGSS[species]; moves.AddRange(Tutors_4.Where((t, i) => info.TypeTutors[i])); + moves.AddRange(SpecialTutors_4.Where(t => SpecialTutors_Compatibility_4[t].Any(e => e == species))); break; case 5: info = PersonalTable.B2W2[species]; diff --git a/PKHeX/Legality/Tables3.cs b/PKHeX/Legality/Tables3.cs index d46b7213a..8d9797a2f 100644 --- a/PKHeX/Legality/Tables3.cs +++ b/PKHeX/Legality/Tables3.cs @@ -140,8 +140,66 @@ public static partial class Legal new[] {135, 069, 138, 005, 025, 034, 157, 068, 086, 014}, new[] {111, 173, 189, 129, 196, 203, 244, 008, 009, 007}, }; - internal static readonly int[] Tutor_E = {038, 223, 153, 210, 118, 102, 205, 214, 164, 207}; - internal static readonly int[] Tutor_FRLG = {034, 068, 038, 138, 153, 025, 005, 118, 102, 157, 069, 135, 164, 014, 086}; + + internal static readonly int[] Tutor_E = + { + 005, 014, 025, 034, 038, 068, 069, 102, 118, 135, + 138, 086, 153, 157, 164, 223, 205, 244, 173, 196, + 203, 189, 008, 207, 214, 129, 111, 009, 007, 210 + }; + + internal static readonly int[] Tutor_FRLG = + { + 005, 014, 025, 034, 038, 068, 069, 102, 118, 135, + 138, 086, 153, 157, 164 + }; + + internal static readonly int[] SpecialTutors_FRLG = + { + 307, 308, 338 + }; + + internal static readonly int[][] SpecialTutors_Compatibility_FRLG = + { + new int[] { 6 }, + new int[] { 9 }, + new int[] { 3 }, + }; + + // Tutor moves from XD that can be learned as tutor moves in emerald + // For this moves compatibility data is the same in XD and Emerald + internal static readonly int[] SpecialTutors_XD_Emerald = + { + 034, 038, 069, 086, 102, 120, 138, 143, 164, 171, 196, 207, + }; + + internal static readonly int[] SpecialTutors_XD_Exclusive = + { + 120, 143, 171 + }; + + internal static readonly int[] SpecialTutors_XD = SpecialTutors_XD_Emerald.Concat(SpecialTutors_XD_Exclusive).ToArray(); + + internal static readonly int[][] SpecialTutors_Compatibility_XD_Exclusive = + { + new int[] { 074, 075, 076, 088, 089, 090, 091, 092, 093, 094, 095, + 100, 101, 102, 103, 109, 110, 143, 150, 151, 185, 204, + 205, 208, 211, 218, 219, 222, 273, 274, 275, 299, 316, + 317, 320, 321, 323, 324, 337, 338, 343, 344, 362, 375, + 376, 377, 378, 379 }, + + new int[] { 016, 017, 018, 021, 022, 084, 085, 142, 144, 145, 146, + 151, 163, 164, 176, 177, 178, 198, 225, 227, 250, 276, + 277, 278, 279, 333, 334 }, + + new int[] { 012, 035, 036, 039, 040, 052, 053, 063, 064, 065, 079, + 080, 092, 093, 094, 096, 097, 102, 103, 108, 121, 122, + 124, 131, 137, 150, 151, 163, 164, 173, 174, 177, 178, + 190, 196, 197, 198, 199, 200, 203, 206, 215, 228, 229, + 233, 234, 238, 248, 249, 250, 251, 280, 281, 282, 284, + 292, 302, 315, 316, 317, 327, 353, 354, 355, 356, 358, + 359, 385, 386 } + }; internal static readonly int[] Roaming_MetLocation_FRLG = { diff --git a/PKHeX/Legality/Tables4.cs b/PKHeX/Legality/Tables4.cs index 156abf17c..730d236d9 100644 --- a/PKHeX/Legality/Tables4.cs +++ b/PKHeX/Legality/Tables4.cs @@ -119,7 +119,29 @@ public static partial class Legal 404, 214, 363, 398, 138, 447, 207, 365, 369, 164, 430, 433, - 015, 019, 057, 070, 250, 432, 249, 127, 431 // Defog(DPPt) & Whirlpool(HGSS) + 015, 019, 057, 070, 250, 249, 127, 431 // Defog(DPPt) & Whirlpool(HGSS) + }; + + internal static readonly int[] TMHM_DPPt = + { + 264, 337, 352, 347, 046, 092, 258, 339, 331, 237, + 241, 269, 058, 059, 063, 113, 182, 240, 202, 219, + 218, 076, 231, 085, 087, 089, 216, 091, 094, 247, + 280, 104, 115, 351, 053, 188, 201, 126, 317, 332, + 259, 263, 290, 156, 213, 168, 211, 285, 289, 315, + 355, 411, 412, 206, 362, 374, 451, 203, 406, 409, + 261, 318, 373, 153, 421, 371, 278, 416, 397, 148, + 444, 419, 086, 360, 014, 446, 244, 445, 399, 157, + 404, 214, 363, 398, 138, 447, 207, 365, 369, 164, + 430, 433, + + 015, 019, 057, 070, 432, 249, 127, 431 // Defog(DPPt) & Whirlpool(HGSS) + }; + + + internal static readonly int[] HM_4_RemovePokeTransfer = + { + 015, 019, 057, 070, 249, 127, 431 // Defog(DPPt) & Whirlpool(HGSS) excluded }; internal static readonly int[] MovePP_DP = @@ -171,6 +193,19 @@ public static partial class Legal 143, 335, 450, }; + internal static readonly int[] SpecialTutors_4 = + { + 307, 308, 338, 434 + }; + + internal static readonly int[][] SpecialTutors_Compatibility_4 = + { + new int[] { 006, 157, 257, 392 }, + new int[] { 009, 160, 260, 395 }, + new int[] { 003, 154, 254, 389 }, + new int[] { 147, 148, 149, 230, 329, 330, 334, 371, 372, 373, 380, 381, 384, 443, 444, 445, 483, 484, 487 } + }; + internal static readonly EncounterStatic[] Encounter_HGSS_Swarm = { //Swarm