From d2211a677968411157c2e2b9fdf64e20155f82e4 Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 8 Dec 2016 19:15:11 -0800 Subject: [PATCH] Add forme randomization method add alola option too --- pk3DS/Legality/Legal.cs | 21 +++++++++++++++++++++ pk3DS/Legality/Randomizer.cs | 12 ++++++++++++ 2 files changed, 33 insertions(+) diff --git a/pk3DS/Legality/Legal.cs b/pk3DS/Legality/Legal.cs index 26867cc..b75b470 100644 --- a/pk3DS/Legality/Legal.cs +++ b/pk3DS/Legality/Legal.cs @@ -220,5 +220,26 @@ class Legal 695, 696, 697, 698, 699, 700, 701, 702, 703, 719, }; + + internal static readonly int[] AlolanOriginForms = + { + 019, // Rattata + 020, // Raticate + 025, // Pikachu (Cosplay not transferrable) + 026, // Raichu + 027, // Sandshrew + 028, // Sandslash + 037, // Vulpix + 038, // Ninetails + 050, // Diglett + 051, // Dugtrio + 052, // Meowth + 053, // Persian + 074, // Geodude + 075, // Graveler + 076, // Golem + 088, // Grimer + 089, // Muk + }; } } diff --git a/pk3DS/Legality/Randomizer.cs b/pk3DS/Legality/Randomizer.cs index 4dad258..e01e82e 100644 --- a/pk3DS/Legality/Randomizer.cs +++ b/pk3DS/Legality/Randomizer.cs @@ -72,6 +72,18 @@ internal static int[] getSpeciesList(bool G1, bool G2, bool G3, bool G4, bool G5 return sL.Length == 0 ? RandomSpeciesList : sL; } + internal static int GetRandomForme(int species, bool mega, bool alola, PersonalInfo[] stats = null) + { + if (stats == null) + return 0; + if (stats[species].FormeCount <= 1) + return 0; + if (alola && Legal.AlolanOriginForms.Contains(species)) + return (int)(Util.rnd32()%2); + if (!Legal.Mega_ORAS.Contains((ushort)species) || mega) + return (int)(Util.rnd32() % stats[species].FormeCount); // Slot-Random + return 0; + } internal static int[] getRandomItemList() {