Skip to content

Instantly share code, notes, and snippets.

@Lusamine
Last active October 16, 2024 09:10
Show Gist options
  • Select an option

  • Save Lusamine/c73bd2b4ed5a5548bb53a7d0c1b48aee to your computer and use it in GitHub Desktop.

Select an option

Save Lusamine/c73bd2b4ed5a5548bb53a7d0c1b48aee to your computer and use it in GitHub Desktop.
bool lure_active = true;
string output = "";
void Main()
{
// Initial state
ulong s0 = 0x0123456789ABCDEF;
ulong s1 = 0x0123456789ABCDEF;
// Set this for how far you want to search.
int maxAdvance = 1000;
var rng = new Xoroshiro128Plus(s0, s1);
for (int advances = 0; advances < maxAdvance; advances++)
{
var (_s0, _s1) = rng.GetState();
output = $"{advances:00000} | {_s0:x16} | {_s1:x16} |";
GetStateLGPEBird(advances, rng, 1);
rng.Next();
}
}
// You can define other methods, fields, classes and namespaces here
private void GetStateLGPEBird(int advance, Xoroshiro128Plus rng, int try_no)
{
if (try_no is not (1 or 2))
return;
var check = rng.Next();
var rand = (uint)(check % 10000);
ulong bird = 0;
if (rand <= 4)
{
output += $" Bird generated on try #{try_no}! | {rand} | ";
bird = (uint)(rng.Next() % 3);
switch (bird)
{
case 0:
output += "Moltres";
break;
case 1:
output += "Zapdos";
break;
case 2:
output += "Articuno";
break;
}
}
else if (lure_active && try_no != 2) // Active lure gives a second try.
{
GetStateLGPEBird(advance, rng, 2);
return;
}
// Add your filters here.
if (rand > 4)
return;
if (bird != 1) // Zapdos only.
return;
Console.WriteLine(output);
}
@Lusamine

Lusamine commented Sep 28, 2024

Copy link
Copy Markdown
Author

Setup is:

  1. Download/install LINQPad (latest version is fine).
  2. Download dev build PKHeX from https://projectpokemon.org/home/files/file/2445-pkhex-development-build/
  3. Press F4 in LINQPad and add PKHeX.Core.dll to first tab, and PKHeX.Core to second tab,
  4. Change the language at the top to C# program, then copy/paste the script in verbatim.
  5. Edit your params at the top and any filters.
  6. Click run.

Recommended LINQPad settings so output is monospaced:

  1. Edit > Preferences > Results
  2. Click "Launch Editor" under Style Sheet for text (HTML) results.
  3. Paste this snippet and "Apply Changes".
    body
    {
    	margin: 0.3em 0.3em 0.4em 0.4em;
    	font-family: Consolas;
    }
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment