From ca43387e5e50bb5eecb655d21ce5c8a50e7bd637 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Wed, 6 Dec 2017 17:48:13 -0500 Subject: [PATCH 1/3] 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 { From f6c2f152e77e5831434688b1bb609e9d097a685e Mon Sep 17 00:00:00 2001 From: sora10pls Date: Wed, 6 Dec 2017 18:08:08 -0500 Subject: [PATCH 2/3] Misc fixes (pt. 2) --- pk3DS.Core/Legality/Legal.cs | 1 + pk3DS.Core/Randomizers/SpeciesRandomizer.cs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/pk3DS.Core/Legality/Legal.cs b/pk3DS.Core/Legality/Legal.cs index e51489e..b8d93f9 100644 --- a/pk3DS.Core/Legality/Legal.cs +++ b/pk3DS.Core/Legality/Legal.cs @@ -225,6 +225,7 @@ public static partial class Legal 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 695, 696, 697, 698, 699, 700, 701, 702, 703, 719, + 723, 724, 725, 726, 727, 728 }; } } diff --git a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs index 429dfbc..af7f908 100644 --- a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs +++ b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs @@ -193,6 +193,13 @@ private void AddGen7Species(List list) list.AddRange(Enumerable.Range(722, 67)); if (L) list.AddRange(Enumerable.Range(785, 16)); // Tapus, Legends, UBs if (E) list.AddRange(Enumerable.Range(801, 2)); // Magearna, Marshadow + + if (MaxSpeciesID == 807) // USUM + { + if (L) list.AddRange(Enumerable.Range(803, 4)); // USUM UBs + if (E) list.AddRange(Enumerable.Range(807, 1)); // Zeraora + } + } public int[] RandomSpeciesList => Enumerable.Range(1, MaxSpeciesID).ToArray(); From bde6144ad45aac66e6e8a98c344cc1da95ecad84 Mon Sep 17 00:00:00 2001 From: sora10pls Date: Wed, 6 Dec 2017 19:39:59 -0500 Subject: [PATCH 3/3] Revise legal/randomizer changes --- pk3DS.Core/Legality/Tables7.cs | 2 +- pk3DS.Core/Randomizers/SpeciesRandomizer.cs | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pk3DS.Core/Legality/Tables7.cs b/pk3DS.Core/Legality/Tables7.cs index b2d7a49..888e7fb 100644 --- a/pk3DS.Core/Legality/Tables7.cs +++ b/pk3DS.Core/Legality/Tables7.cs @@ -114,7 +114,7 @@ public static partial class Legal 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 ushort[] HeldItems_USUM = new ushort[1].Concat(HeldItems_SM).Concat(Pouch_ZCrystalHeld_USUM).ToArray(); internal static readonly int[] AlolanOriginForms = { 019, // Rattata diff --git a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs index af7f908..686819a 100644 --- a/pk3DS.Core/Randomizers/SpeciesRandomizer.cs +++ b/pk3DS.Core/Randomizers/SpeciesRandomizer.cs @@ -157,7 +157,7 @@ private void AddGen2Species(List list) if (L) { - list.AddRange(Enumerable.Range(243, 3)); // Dogs + list.AddRange(Enumerable.Range(243, 3)); // Beasts list.AddRange(Enumerable.Range(249, 2)); // Lugia & Ho-Oh } if (E) list.Add(251); // Celebi @@ -173,20 +173,20 @@ private void AddGen3Species(List list) private void AddGen4Species(List list) { list.AddRange(Enumerable.Range(387, 93)); - if (L) list.AddRange(Enumerable.Range(480, 9)); // - if (E) list.AddRange(Enumerable.Range(489, 5)); // + if (L) list.AddRange(Enumerable.Range(480, 9)); // Sinnoh Legends + if (E) list.AddRange(Enumerable.Range(489, 5)); // Phione, Manaphy, Darkrai, Shaymin, Arceus } private void AddGen5Species(List list) { list.AddRange(Enumerable.Range(495, 143)); - if (L) list.AddRange(Enumerable.Range(638, 9)); list.Add(494); // - if (E) list.AddRange(Enumerable.Range(647, 3)); // + if (L) list.AddRange(Enumerable.Range(638, 9)); list.Add(494); // Unova Legends + if (E) list.AddRange(Enumerable.Range(647, 3)); // Keldeo, Meloetta, Genesect } private void AddGen6Species(List list) { list.AddRange(Enumerable.Range(650, 66)); - if (L) list.AddRange(Enumerable.Range(716, 3)); // - if (E) list.AddRange(Enumerable.Range(719, 3)); // + if (L) list.AddRange(Enumerable.Range(716, 3)); // Kalos Legends + if (E) list.AddRange(Enumerable.Range(719, 3)); // Diancie, Hoopa, Volcanion } private void AddGen7Species(List list) { @@ -196,8 +196,8 @@ private void AddGen7Species(List list) if (MaxSpeciesID == 807) // USUM { - if (L) list.AddRange(Enumerable.Range(803, 4)); // USUM UBs - if (E) list.AddRange(Enumerable.Range(807, 1)); // Zeraora + if (L) list.AddRange(Enumerable.Range(803, 4)); // Poipole, Naganadel, Stakataka, Blacephalon + if (E) list.Add(807); // Zeraora } }