From ca43387e5e50bb5eecb655d21ce5c8a50e7bd637 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Wed, 6 Dec 2017 17:48:13 -0500 Subject: [PATCH] Misc fixes (pt. 1) --- pk3DS.Core/Game/GameConfig.cs | 6 +++--- pk3DS.Core/Game/GameInfo.cs | 12 ++++++------ pk3DS.Core/Legality/Tables7.cs | 28 ++++++++++++++++++---------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/pk3DS.Core/Game/GameConfig.cs b/pk3DS.Core/Game/GameConfig.cs index deae5d5..f57e9d7 100644 --- a/pk3DS.Core/Game/GameConfig.cs +++ b/pk3DS.Core/Game/GameConfig.cs @@ -12,8 +12,8 @@ public class GameConfig private const int FILECOUNT_ORASDEMO = 301; private const int FILECOUNT_ORAS = 299; private const int FILECOUNT_SMDEMO = 239; - private const int FILECOUNT_SM = 311; // only a guess for now - private const int FILECOUNT_USUM = 333; // only a guess for now + private const int FILECOUNT_SM = 311; + private const int FILECOUNT_USUM = 333; public readonly GameVersion Version = GameVersion.Invalid; public GARCReference[] Files { get; private set; } @@ -237,7 +237,7 @@ public string getGARCFileName(string requestedGARC) public bool ORAS => Version == GameVersion.ORAS || Version == GameVersion.ORASDEMO; public bool SM => Version == GameVersion.SM || Version == GameVersion.SMDEMO; public bool USUM => Version == GameVersion.USUM; - public int MaxSpeciesID => XY || ORAS ? 721 : SM ? 802 : 807; + public int MaxSpeciesID => XY || ORAS ? Legal.MaxSpeciesID_6 : SM ? Legal.MaxSpeciesID_7_SM : Legal.MaxSpeciesID_7_USUM; public int GARCVersion => XY || ORAS ? GARC.VER_4 : GARC.VER_6; public int Generation { diff --git a/pk3DS.Core/Game/GameInfo.cs b/pk3DS.Core/Game/GameInfo.cs index af6ac1c..80c0013 100644 --- a/pk3DS.Core/Game/GameInfo.cs +++ b/pk3DS.Core/Game/GameInfo.cs @@ -41,11 +41,11 @@ private void LoadAO() private void LoadSM() { - MaxSpeciesID = Legal.MaxSpeciesID_7; - MaxMoveID = Legal.MaxMoveID_7; - MaxItemID = Legal.MaxItemID_7; + MaxSpeciesID = Legal.MaxSpeciesID_7_SM; + MaxMoveID = Legal.MaxMoveID_7_SM; + MaxItemID = Legal.MaxItemID_7_SM; HeldItems = Legal.HeldItems_SM; - MaxAbilityID = Legal.MaxAbilityID_7; + MaxAbilityID = Legal.MaxAbilityID_7_SM; } private void LoadUSUM() @@ -53,8 +53,8 @@ private void LoadUSUM() MaxSpeciesID = Legal.MaxSpeciesID_7_USUM; MaxMoveID = Legal.MaxMoveID_7_USUM; MaxItemID = Legal.MaxItemID_7_USUM; - HeldItems = Legal.HeldItems_SM; - MaxAbilityID = Legal.MaxAbilityID_7; + HeldItems = Legal.HeldItems_USUM; + MaxAbilityID = Legal.MaxAbilityID_7_USUM; } } } diff --git a/pk3DS.Core/Legality/Tables7.cs b/pk3DS.Core/Legality/Tables7.cs index 4b6e60b..b2d7a49 100644 --- a/pk3DS.Core/Legality/Tables7.cs +++ b/pk3DS.Core/Legality/Tables7.cs @@ -5,16 +5,17 @@ namespace pk3DS.Core { public static partial class Legal { - internal const int MaxSpeciesID_7 = 802; - internal const int MaxMoveID_7 = 720; - internal const int MaxItemID_7 = 920; - internal const int MaxAbilityID_7 = 232; - internal const int MaxBallID_7 = 0x1A; // 26 + internal const int MaxSpeciesID_7_SM = 802; + internal const int MaxMoveID_7_SM = 719; + internal const int MaxItemID_7_SM = 920; + internal const int MaxAbilityID_7_SM = 232; + internal const int MaxBallID_7_SM = 0x1A; // 26 internal const int MaxGameID_7 = 41; // Crystal (VC?) - internal const int MaxSpeciesID_7_USUM = 802; - internal const int MaxMoveID_7_USUM = 720; - internal const int MaxItemID_7_USUM = 920; + internal const int MaxSpeciesID_7_USUM = 807; + internal const int MaxMoveID_7_USUM = 728; + internal const int MaxItemID_7_USUM = 959; + internal const int MaxAbilityID_7_USUM = 233; #region Met Locations @@ -106,7 +107,14 @@ public static partial class Legal internal static readonly ushort[] Pouch_ZCrystalHeld_SM = { // Piece 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 798, 799, 800, 801, 802, 803, 804, 805, 806, 836 }; + internal static readonly ushort[] Pouch_ZCrystal_USUM = { // Bead + 927, 928, 929, 930, 931, 932 + }; + internal static readonly ushort[] Pouch_ZCrystalHeld_USUM = { // Piece + 921, 922, 923, 924, 925, 926 + }; internal static readonly ushort[] HeldItems_SM = new ushort[1].Concat(Pouch_Items_SM).Concat(Pouch_Berries_SM).Concat(Pouch_Medicine_SM).Concat(Pouch_ZCrystalHeld_SM).ToArray(); + internal static readonly ushort[] HeldItems_USUM = new ushort[1].Concat(Pouch_Items_SM).Concat(Pouch_Berries_SM).Concat(Pouch_Medicine_SM).Concat(Pouch_ZCrystalHeld_USUM).ToArray(); internal static readonly int[] AlolanOriginForms = { 019, // Rattata @@ -114,7 +122,7 @@ public static partial class Legal 027, // Sandshrew 028, // Sandslash 037, // Vulpix - 038, // Ninetails + 038, // Ninetales 050, // Diglett 051, // Dugtrio 052, // Meowth @@ -204,7 +212,7 @@ public static partial class Legal 715, // Fairy Gem }; #endregion - internal static readonly bool[] ReleasedHeldItems_7 = Enumerable.Range(0, MaxItemID_7+1).Select(i => HeldItems_SM.Contains((ushort)i) && !UnreleasedHeldItems_7.Contains(i)).ToArray(); + internal static readonly bool[] ReleasedHeldItems_7 = Enumerable.Range(0, MaxItemID_7_SM+1).Select(i => HeldItems_SM.Contains((ushort)i) && !UnreleasedHeldItems_7.Contains(i)).ToArray(); public static readonly HashSet Totem_Alolan = new HashSet {