From 5fa4ddd4a2d2dafe86115b1b5be5d6e73b6b77d0 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 24 Oct 2020 11:11:05 -0700 Subject: [PATCH] Update internal data sources for Crown Tundra Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com> Co-Authored-By: ReignOfComputer <2667537+ReignOfComputer@users.noreply.github.com> --- PKHeX.Core/Game/GameStrings/GameDataSource.cs | 42 +++++-- PKHeX.Core/Game/GameStrings/GameStrings.cs | 11 ++ PKHeX.Core/Legality/Tables/Tables.cs | 111 +++++++++++------- PKHeX.Core/PKM/Util/FormConverter.cs | 10 ++ PKHeX.Core/Saves/Util/SaveUtil.cs | 9 +- 5 files changed, 128 insertions(+), 55 deletions(-) diff --git a/PKHeX.Core/Game/GameStrings/GameDataSource.cs b/PKHeX.Core/Game/GameStrings/GameDataSource.cs index 16b4be0b0..66fb27b0e 100644 --- a/PKHeX.Core/Game/GameStrings/GameDataSource.cs +++ b/PKHeX.Core/Game/GameStrings/GameDataSource.cs @@ -71,15 +71,15 @@ private static IReadOnlyList GetVersionList(GameStrings s) { var list = s.gamelist; var ver = Util.GetCBList(list, - Legal.Games_8swsh, - Legal.Games_7gg, - Legal.Games_7usum, Legal.Games_7sm, - Legal.Games_6oras, Legal.Games_6xy, - Legal.Games_5, Legal.Games_4, Legal.Games_4e, Legal.Games_4r, - Legal.Games_3, Legal.Games_3e, Legal.Games_3r, Legal.Games_3s); - ver.AddRange(Util.GetCBList(list, Legal.Games_7vc2).OrderBy(g => g.Value)); // stuff to end unsorted - ver.AddRange(Util.GetCBList(list, Legal.Games_7vc1).OrderBy(g => g.Value)); // stuff to end unsorted - ver.AddRange(Util.GetCBList(list, Legal.Games_7go).OrderBy(g => g.Value)); // stuff to end unsorted + Games_8swsh, + Games_7gg, + Games_7usum, Games_7sm, + Games_6oras, Games_6xy, + Games_5, Games_4, Games_4e, Games_4r, + Games_3, Games_3e, Games_3r, Games_3s); + ver.AddRange(Util.GetCBList(list, Games_7vc2).OrderBy(g => g.Value)); // stuff to end unsorted + ver.AddRange(Util.GetCBList(list, Games_7vc1).OrderBy(g => g.Value)); // stuff to end unsorted + ver.AddRange(Util.GetCBList(list, Games_7go).OrderBy(g => g.Value)); // stuff to end unsorted return ver; } @@ -315,5 +315,27 @@ public static IReadOnlyList LanguageDataSource(int gen) languages.RemoveAll(l => l.Value > (int)LanguageID.Korean); return languages; } + + #region Games + + private static readonly int[] Games_8swsh = { 44, 45 }; + private static readonly int[] Games_7gg = { 42, 43 }; + private static readonly int[] Games_7vc2 = { 39, 40, 41 }; // Gold, Silver, Crystal + private static readonly int[] Games_7vc1 = { 35, 36, 37, 38 }; // Red, Green, Blue, Yellow + private static readonly int[] Games_7go = { 34 }; + private static readonly int[] Games_7usum = { 32, 33 }; + private static readonly int[] Games_7sm = { 30, 31 }; + private static readonly int[] Games_6xy = { 24, 25 }; + private static readonly int[] Games_6oras = { 26, 27 }; + private static readonly int[] Games_5 = { 20, 21, 22, 23 }; + private static readonly int[] Games_4 = { 10, 11, }; + private static readonly int[] Games_4e = { 12 }; + private static readonly int[] Games_4r = { 7, 8 }; + private static readonly int[] Games_3 = { 1, 2 }; + private static readonly int[] Games_3e = { 3 }; + private static readonly int[] Games_3r = { 4, 5 }; + private static readonly int[] Games_3s = { 15 }; + + #endregion } -} \ No newline at end of file +} diff --git a/PKHeX.Core/Game/GameStrings/GameStrings.cs b/PKHeX.Core/Game/GameStrings/GameStrings.cs index 634267029..c7ec3fd89 100644 --- a/PKHeX.Core/Game/GameStrings/GameStrings.cs +++ b/PKHeX.Core/Game/GameStrings/GameStrings.cs @@ -163,6 +163,10 @@ private void Sanitize() SanitizeItemNames(); SanitizeMetLocations(); + // De-duplicate the Calyrex ability names + abilitylist[(int)Core.Ability.AsOneI] += $" ({specieslist[(int)Core.Species.Glastrier]})"; + abilitylist[(int)Core.Ability.AsOneG] += $" ({specieslist[(int)Core.Species.Spectrier]})"; + // Replace the Egg Name with ---; egg name already stored to eggname specieslist[0] = "---"; // Fix (None) tags @@ -224,6 +228,10 @@ private void SanitizeItemNames() itemlist[1585] += " (3)"; // Rotom Bike itemlist[1586] += " (4)"; // Rotom Bike + itemlist[1590] += " (1)"; // Reins of Unity + itemlist[1591] += " (2)"; // Reins of Unity + itemlist[1607] += " (3)"; // Reins of Unity + for (int i = 12; i <= 29; i++) // Differentiate DNA Samples g3coloitems[500 + i] += $" ({i - 11:00})"; // differentiate G3 Card Key from Colo @@ -360,6 +368,9 @@ private void SanitizeMetG8SWSH() for (int i = 165; i <= 195; i += 2) metSWSH_00000_good[i] = string.Empty; // clear Wild Area sub-zone strings (trips duplicate Test) + for (int i = 205; i <= 235; i += 2) + metSWSH_00000_good[i] = string.Empty; // clear Wild Area sub-zone strings (trips duplicate Test) + metSWSH_00000_good.CopyTo(metSWSH_00000, 0); metSWSH_30000[0] += $" ({NPC})"; // Anything from an NPC diff --git a/PKHeX.Core/Legality/Tables/Tables.cs b/PKHeX.Core/Legality/Tables/Tables.cs index 594c18d8b..05b474a78 100644 --- a/PKHeX.Core/Legality/Tables/Tables.cs +++ b/PKHeX.Core/Legality/Tables/Tables.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Linq; namespace PKHeX.Core { @@ -14,8 +13,11 @@ public static partial class Legal public static readonly int[] Gen4EncounterTypes = { 1, 2, 4, 5, 7, 9, 10, 12, 23, 24 }; public static readonly HashSet LightBall = new HashSet { 25, 26, 172 }; - public static readonly int[] RotomMoves = { 0, 315, 056, 059, 403, 437 }; + public static readonly int[] RotomMoves = { 315, 056, 059, 403, 437 }; + /// + /// Species that can be captured normally in the wild and can change between their forms. + /// public static readonly HashSet WildChangeFormAfter = new HashSet { 412, // Burmy @@ -24,6 +26,9 @@ public static partial class Legal 741, // Oricorio }; + /// + /// Species that can yield a different baby species when bred. + /// public static readonly HashSet SplitBreed = new HashSet { // Incense @@ -38,7 +43,11 @@ public static partial class Legal 358, // Chimecho }; - public static readonly HashSet FormChange = new HashSet(WildChangeFormAfter) // Pokémon that can change between all forms + /// + /// Species that can change between their forms, regardless of origin. + /// + /// Excludes Zygarde as it has special conditions. Check separately. + public static readonly HashSet FormChange = new HashSet(WildChangeFormAfter) { 386, // Deoxys 487, // Giratina @@ -53,8 +62,12 @@ public static partial class Legal 720, // Hoopa 773, // Silvally 800, // Necrozma + 898, // Calyrex }; + /// + /// Species that can change between their forms and get access to form-specific moves. + /// public static readonly HashSet FormChangeMoves = new HashSet { 386, // Deoxys @@ -63,6 +76,9 @@ public static partial class Legal 720, // Hoopa }; + /// + /// Species that are male only in Generation 6; for ball inheritance, these behave the same as Genderless species. + /// public static readonly HashSet BreedMaleOnly = new HashSet { 128, // Tauros @@ -71,6 +87,9 @@ public static partial class Legal 538, 539, // Sawk & Throh }; + /// + /// Species that cannot hatch from an egg. + /// public static readonly HashSet NoHatchFromEgg = new HashSet { 132, // Ditto @@ -176,6 +195,12 @@ public static partial class Legal (int)Species.Kubfu, (int)Species.Urshifu, (int)Species.Zarude, + + (int)Species.Regieleki, + (int)Species.Regidrago, + (int)Species.Glastrier, + (int)Species.Spectrier, + (int)Species.Calyrex, }; /// @@ -232,6 +257,9 @@ public static partial class Legal 809, // Melmetal }; + /// + /// Species that have an alternate form that cannot exist outside of battle. + /// public static readonly HashSet BattleForms = new HashSet { 351, // Castform @@ -252,6 +280,9 @@ public static partial class Legal (int)Species.Eternatus, }; + /// + /// Species that have a mega form that cannot exist outside of battle. + /// public static readonly HashSet BattleMegas = new HashSet { // XY @@ -273,6 +304,9 @@ public static partial class Legal 800, // Ultra Necrozma }; + /// + /// Species that have a primal form that cannot exist outside of battle. + /// public static readonly HashSet BattlePrimals = new HashSet { 382, 383 }; public static readonly HashSet Z_Moves = new HashSet @@ -283,22 +317,38 @@ public static partial class Legal 723, 724, 725, 726, 727, 728 }; - internal static readonly int[] UnreleasedMoves = {617}; // Light of Ruin - internal static readonly int[] CantSketchMoves = {165, 448}; // Struggle & Chatter - internal static readonly HashSet InvalidSketch = new HashSet(CantSketchMoves.Concat(Z_Moves).Concat(UnreleasedMoves)); - - public static readonly HashSet Legends = new HashSet + /// + /// Moves that can not be obtained by using Sketch with Smeargle. + /// + internal static readonly HashSet InvalidSketch = new HashSet(Z_Moves) { - (int)Species.Mew, (int)Species.Mewtwo, - (int)Species.Lugia, (int)Species.HoOh, (int)Species.Celebi, - (int)Species.Kyogre, (int)Species.Groudon, (int)Species.Rayquaza,(int)Species.Jirachi, (int)Species.Deoxys, - (int)Species.Dialga, (int)Species.Palkia, (int)Species.Giratina, (int)Species.Phione, (int)Species.Manaphy, (int)Species.Darkrai, (int)Species.Shaymin, (int)Species.Arceus, (int)Species.Victini, - (int)Species.Reshiram, (int)Species.Zekrom, (int)Species.Kyurem, (int)Species.Keldeo, (int)Species.Meloetta, (int)Species.Genesect, - (int)Species.Xerneas, (int)Species.Yveltal, (int)Species.Zygarde, (int)Species.Diancie, (int)Species.Hoopa,(int)Species.Volcanion, - (int)Species.Cosmog, (int)Species.Cosmoem, (int)Species.Solgaleo, (int)Species.Lunala,(int)Species.Necrozma, (int)Species.Magearna, (int)Species.Marshadow, (int)Species.Zeraora, - (int)Species.Meltan, (int)Species.Melmetal, (int)Species.Zacian, (int)Species.Zamazenta, (int)Species.Eternatus, (int)Species.Zarude, + // Can't Sketch + 165, // Struggle + 448, // Chatter + + // Unreleased + 617, // Light of Ruin }; + /// + /// Species classified as "Legend" by the game code. + /// + public static readonly HashSet Legends = new HashSet + { + (int)Species.Mewtwo, (int)Species.Mew, + (int)Species.Lugia, (int)Species.HoOh, (int)Species.Celebi, + (int)Species.Kyogre, (int)Species.Groudon, (int)Species.Rayquaza, (int)Species.Jirachi, (int)Species.Deoxys, + (int)Species.Dialga, (int)Species.Palkia, (int)Species.Giratina, (int)Species.Phione, (int)Species.Manaphy, (int)Species.Darkrai, (int)Species.Shaymin, (int)Species.Arceus, + (int)Species.Victini, (int)Species.Reshiram, (int)Species.Zekrom, (int)Species.Kyurem, (int)Species.Keldeo, (int)Species.Meloetta, (int)Species.Genesect, + (int)Species.Xerneas, (int)Species.Yveltal, (int)Species.Zygarde, (int)Species.Diancie, (int)Species.Hoopa, (int)Species.Volcanion, + (int)Species.Cosmog, (int)Species.Cosmoem, (int)Species.Solgaleo, (int)Species.Lunala, (int)Species.Necrozma, (int)Species.Magearna, (int)Species.Marshadow, (int)Species.Zeraora, + (int)Species.Meltan, (int)Species.Melmetal, + (int)Species.Zacian, (int)Species.Zamazenta, (int)Species.Eternatus, (int)Species.Zarude, (int)Species.Calyrex, + }; + + /// + /// Species classified as "SubLegend" by the game code. + /// public static readonly HashSet SubLegends = new HashSet { (int)Species.Articuno, (int)Species.Zapdos, (int)Species.Moltres, @@ -306,9 +356,10 @@ public static partial class Legal (int)Species.Regirock, (int)Species.Regice, (int)Species.Registeel, (int)Species.Latias, (int)Species.Latios, (int)Species.Uxie, (int)Species.Mesprit, (int)Species.Azelf, (int)Species.Heatran, (int)Species.Regigigas, (int)Species.Cresselia, (int)Species.Cobalion, (int)Species.Terrakion, (int)Species.Virizion, (int)Species.Tornadus, (int)Species.Thundurus, (int)Species.Landorus, - (int)Species.TypeNull, (int)Species.Silvally, (int)Species.TapuBulu, (int)Species.TapuFini, (int)Species.TapuKoko, (int)Species.TapuLele, (int)Species.Nihilego, - (int)Species.Buzzwole, (int)Species.Pheromosa, (int)Species.Xurkitree, (int)Species.Celesteela, (int)Species.Kartana, (int)Species.Guzzlord, (int)Species.Poipole, (int)Species.Naganadel, (int)Species.Stakataka, (int)Species.Blacephalon, - (int)Species.Kubfu, (int)Species.Urshifu, + (int)Species.TypeNull, (int)Species.Silvally, (int)Species.TapuKoko, (int)Species.TapuLele, (int)Species.TapuBulu, (int)Species.TapuFini, + (int)Species.Nihilego, (int)Species.Buzzwole, (int)Species.Pheromosa, (int)Species.Xurkitree, (int)Species.Celesteela, (int)Species.Kartana, (int)Species.Guzzlord, + (int)Species.Poipole, (int)Species.Naganadel, (int)Species.Stakataka, (int)Species.Blacephalon, + (int)Species.Kubfu, (int)Species.Urshifu, (int)Species.Regieleki, (int)Species.Regidrago, (int)Species.Glastrier, (int)Species.Spectrier, }; public static readonly ushort[] Arceus_Plate = {303, 306, 304, 305, 309, 308, 310, 313, 298, 299, 301, 300, 307, 302, 311, 312, 644}; @@ -462,27 +513,5 @@ public static partial class Legal 677, // Espurr 678, // Meowstic (M/F) forme specific }; - - #region Games - - public static readonly int[] Games_8swsh = { 44, 45 }; - public static readonly int[] Games_7gg = { 42, 43 }; - public static readonly int[] Games_7vc2 = { 39, 40, 41 }; // Gold, Silver, Crystal - public static readonly int[] Games_7vc1 = { 35, 36, 37, 38 }; // Red, Green, Blue, Yellow - public static readonly int[] Games_7go = { 34 }; - public static readonly int[] Games_7usum = { 32, 33 }; - public static readonly int[] Games_7sm = { 30, 31 }; - public static readonly int[] Games_6xy = { 24, 25 }; - public static readonly int[] Games_6oras = { 26, 27 }; - public static readonly int[] Games_5 = { 20, 21, 22, 23 }; - public static readonly int[] Games_4 = { 10, 11, }; - public static readonly int[] Games_4e = { 12 }; - public static readonly int[] Games_4r = { 7, 8 }; - public static readonly int[] Games_3 = { 1, 2 }; - public static readonly int[] Games_3e = { 3 }; - public static readonly int[] Games_3r = { 4, 5 }; - public static readonly int[] Games_3s = { 15 }; - - #endregion } } diff --git a/PKHeX.Core/PKM/Util/FormConverter.cs b/PKHeX.Core/PKM/Util/FormConverter.cs index 3e8f95aee..214f5e951 100644 --- a/PKHeX.Core/PKM/Util/FormConverter.cs +++ b/PKHeX.Core/PKM/Util/FormConverter.cs @@ -636,6 +636,14 @@ private static string[] GetFormsGen8(int species, IReadOnlyList types, I types[0], // Normal forms[Dada], }; + + case Calyrex: + return new[] + { + types[0], // Normal + forms[CalyIce], + forms[CalyGhost], + }; } } @@ -983,6 +991,8 @@ private static string[] GetFormsGalarSlowbro(IReadOnlyList types, IReadO private const int SingleStrike = 1086; private const int RapidStrike = 1087; private const int Dada = 1088; + private const int CalyIce = 1089; // Ice + private const int CalyGhost = 1090; // Shadow public static string[] GetAlcremieFormList(IReadOnlyList forms) { diff --git a/PKHeX.Core/Saves/Util/SaveUtil.cs b/PKHeX.Core/Saves/Util/SaveUtil.cs index 06bbf0ef7..b2c47b7bd 100644 --- a/PKHeX.Core/Saves/Util/SaveUtil.cs +++ b/PKHeX.Core/Saves/Util/SaveUtil.cs @@ -20,9 +20,10 @@ public static class SaveUtil public const int SIZE_G8SWSH_1 = 0x17195E; // 1.0 -> 1.1 public const int SIZE_G8SWSH_2 = 0x180B19; // 1.0 -> 1.1 -> 1.2 public const int SIZE_G8SWSH_2B = 0x180AD0; // 1.0 -> 1.2 - public const int SIZE_G8SWSH_3 = -1; // 1.0 -> 1.1 -> 1.2 -> 1.3 todo - public const int SIZE_G8SWSH_3B = -2; // 1.0 -> 1.2 -> 1.3 todo - public const int SIZE_G8SWSH_3C = -3; // 1.0 -> 1.3 todo + public const int SIZE_G8SWSH_3 = 0x1876B1; // 1.0 -> 1.1 -> 1.2 -> 1.3 + public const int SIZE_G8SWSH_3A = 0x187693; // 1.0 -> 1.1 -> 1.3 + public const int SIZE_G8SWSH_3B = 0x187668; // 1.0 -> 1.2 -> 1.3 + public const int SIZE_G8SWSH_3C = 0x18764A; // 1.0 -> 1.3 public const int SIZE_G7GG = 0x100000; public const int SIZE_G7USUM = 0x6CC00; @@ -65,7 +66,7 @@ public static class SaveUtil internal static readonly HashSet SizesSWSH = new HashSet { - SIZE_G8SWSH, SIZE_G8SWSH_1, SIZE_G8SWSH_2, SIZE_G8SWSH_2B, SIZE_G8SWSH_3, SIZE_G8SWSH_3B, SIZE_G8SWSH_3C, + SIZE_G8SWSH, SIZE_G8SWSH_1, SIZE_G8SWSH_2, SIZE_G8SWSH_2B, SIZE_G8SWSH_3, SIZE_G8SWSH_3A, SIZE_G8SWSH_3B, SIZE_G8SWSH_3C, }; private static readonly HashSet SizesGen2 = new HashSet