mirror of
https://github.com/kwsch/pk3DS.git
synced 2026-10-02 05:46:47 -05:00
Move LCRNG method to a random-based class
This commit is contained in:
@@ -10,7 +10,7 @@ internal static int getRandomSpecies(ref int[] list, ref int ctr)
|
||||
int species = list[ctr++]; ctr %= list.Length;
|
||||
return species;
|
||||
}
|
||||
internal static readonly int[] RandomSpeciesList = Enumerable.Range(1, 721).Select(i => i).ToArray();
|
||||
internal static readonly int[] RandomSpeciesList = Enumerable.Range(1, 721).ToArray();
|
||||
|
||||
internal static int[] getSpeciesList(bool G1, bool G2, bool G3, bool G4, bool G5, bool G6, bool L, bool E, bool Shedinja = true)
|
||||
{
|
||||
@@ -44,5 +44,15 @@ internal static int[] getSpeciesList(bool G1, bool G2, bool G3, bool G4, bool G5
|
||||
|
||||
return sL.Length == 0 ? RandomSpeciesList : sL;
|
||||
}
|
||||
|
||||
public static uint LCRNG(uint seed, int ctr)
|
||||
{
|
||||
for (int i = 0; i < ctr; i++)
|
||||
{
|
||||
seed *= 0x41C64E6D;
|
||||
seed += 0x00006073;
|
||||
}
|
||||
return seed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ internal static Bitmap makeIMG(string path, bool save, int shift = 4, int s = 8)
|
||||
c = Color.Black;
|
||||
else
|
||||
{
|
||||
color = LCRNG(color, shift);
|
||||
color = Randomizer.LCRNG(color, shift);
|
||||
c = Color.FromArgb(0xFF, 0xFF - (byte)(color & 0xFF), 0xFF - (byte)((color >> 8) & 0xFF), 0xFF - (byte)(color >> 24 & 0xFF));
|
||||
}
|
||||
try
|
||||
@@ -48,14 +48,5 @@ internal static Bitmap makeIMG(string path, bool save, int shift = 4, int s = 8)
|
||||
return img;
|
||||
}
|
||||
}
|
||||
public static uint LCRNG(uint seed, int ctr)
|
||||
{
|
||||
for (int i = 0; i < ctr; i++)
|
||||
{
|
||||
seed *= 0x41C64E6D;
|
||||
seed += 0x00006073;
|
||||
}
|
||||
return seed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user