Created
July 4, 2023 14:57
-
-
Save Lusamine/950888ce3906d19b1bb654de7399743e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Global settings to make things easier. | |
int FlawlessIVs = 3; | |
// Set these values for your gender ratio: | |
// Fixed gender = -1 | |
// 50 M : 50 F = 127 | |
// 25 M : 75 F = 191 | |
// 75 M : 25 F = 63 | |
// 87.5 M : 12.5 F = 31 | |
// Litleo line doesn't exist in LA so we can ignore the last case. | |
int GenderCompare = -1; | |
// Set this for how far you want to search. | |
int maxAdvance = 100; | |
string output = ""; | |
void Main() | |
{ | |
// Initial state | |
ulong group_seed = 0x286e5c32787a9d20u; // group seed | |
ulong init = unchecked(group_seed); | |
Xoroshiro128Plus rng = new(init); | |
output = $"Initial Group Seed: {group_seed:x16}\n"; | |
Console.WriteLine(output); | |
Console.WriteLine("Adv | Generator Seed | Pokemon Seed | PID | IVs | G | Nature\n----+------------------+------------------+----------+-------------------+---+--------"); | |
for (int advances = 0; advances < maxAdvance; advances++) | |
{ | |
output = $"{advances, 3} | "; | |
GenerateSpawn(advances, ref rng); | |
} | |
} | |
private void GenerateSpawn(int advance, ref Xoroshiro128Plus rng) | |
{ | |
// Group seed generates the generator seed and alphamove seed. | |
var genseed = rng.Next(); | |
output += $"{genseed:X16} | "; | |
var alphamoveseed = rng.Next(); | |
// Generator seed generates the slot, mon seed, and level. | |
var slotrng = new Xoroshiro128Plus(genseed); | |
var slot = slotrng.Next(); | |
var seed = slotrng.Next(); | |
output += $"{seed:X16} | "; | |
GeneratePoke(seed); | |
// Reseed the RNG for the next genie. | |
var newseed2 = rng.Next(); | |
rng = new Xoroshiro128Plus(newseed2); | |
} | |
private void GeneratePoke(ulong seed) | |
{ | |
var rng = new Xoroshiro128Plus(seed); | |
rng.NextInt(); | |
rng.NextInt(); | |
var pid = rng.NextInt(); | |
output += $"{pid:x8}"; | |
Span<int> ivs = stackalloc[] { -1, -1, -1, -1, -1, -1 }; | |
const int MAX = 31; | |
for (int i = 0; i < FlawlessIVs; i++) | |
{ | |
int index; | |
do { index = (int)rng.NextInt(6); } | |
while (ivs[index] != -1); | |
ivs[index] = MAX; | |
} | |
var ivstring = ""; | |
for (int i = 0; i < ivs.Length; i++) | |
{ | |
if (ivs[i] == -1) | |
ivs[i] = (int)rng.NextInt(32); | |
ivstring += $"{ivs[i], 2}"; | |
if (i < 5) | |
ivstring += "/"; | |
} | |
output += $" | {ivstring}"; | |
rng.NextInt(2); | |
var genderchar = "-"; | |
if (GenderCompare != -1) | |
{ | |
var genderval = rng.NextInt(252) + 1; | |
if ((int)genderval < GenderCompare) | |
genderchar = "F"; | |
else | |
genderchar = "M"; | |
} | |
output += $" | {genderchar}"; | |
var nature = (int)rng.NextInt(25); | |
output += $" | {GameInfo.GetStrings(1).Natures[nature]}"; | |
// Add your filters here. | |
//if (nature != (int)Nature.Timid) | |
// return; | |
//if (genderchar != "M") | |
// return; | |
//if (ivs[0] != 31 || ivs[1] != 0 || ivs[2] != 31 || ivs[3] != 31 || ivs[4] != 31 || ivs[5] != 31) | |
// return; | |
Console.WriteLine(output); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script shows future advancements for overworld legendaries in LA such as Heatran and Enamorus for RNG manipulation when given a group seed. Use this script to solve 2 Pokémon for a group seed.
Setup is:
PKHeX.Core.dll
to first tab, andPKHeX.Core
to second tab,Edit > Preferences
, select the Results tab, click "Launch Editor" and paste this in to get monospaced text.This is not meant to be a polished or complete tool in itself, nor are there plans to make an easier tool with a GUI.