mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-20 12:55:13 -05:00
Simplify Shiny SID creation
calculates a passing SID and applies random bits to not be too predictable no need to bruteforce
This commit is contained in:
@@ -772,7 +772,8 @@ public void setShinyPID()
|
||||
public void setShinySID()
|
||||
{
|
||||
if (IsShiny) return;
|
||||
do SID = Util.rnd16(); while (!IsShiny);
|
||||
var xor = TID ^ (PID >> 16) ^ (PID & 0xFFFF);
|
||||
SID = (int)((xor & 0xFFF8) | (Util.rnd32() & 7));
|
||||
}
|
||||
/// <summary>
|
||||
/// Applies a PID to the <see cref="PKM"/> according to the specified <see cref="Gender"/>.
|
||||
|
||||
@@ -9,10 +9,6 @@ public static uint rnd32()
|
||||
{
|
||||
return (uint)rand.Next(1 << 30) << 2 | (uint)rand.Next(1 << 2);
|
||||
}
|
||||
internal static ushort rnd16()
|
||||
{
|
||||
return (ushort)rand.Next(ushort.MaxValue);
|
||||
}
|
||||
public static void Shuffle<T>(T[] array)
|
||||
{
|
||||
int n = array.Length;
|
||||
|
||||
@@ -1487,7 +1487,7 @@ private void updateShiny(bool PID)
|
||||
|
||||
if (pkm.Format > 2)
|
||||
{
|
||||
if(PID)
|
||||
if (PID)
|
||||
{
|
||||
pkm.setShinyPID();
|
||||
TB_PID.Text = pkm.PID.ToString("X8");
|
||||
|
||||
Reference in New Issue
Block a user