mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-16 21:38:40 +00: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:
parent
5b699a4771
commit
32deb3879a
3 changed files with 3 additions and 6 deletions
|
@ -772,7 +772,8 @@ namespace PKHeX.Core
|
|||
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 @@ namespace PKHeX.Core
|
|||
{
|
||||
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 @@ namespace PKHeX.WinForms.Controls
|
|||
|
||||
if (pkm.Format > 2)
|
||||
{
|
||||
if(PID)
|
||||
if (PID)
|
||||
{
|
||||
pkm.setShinyPID();
|
||||
TB_PID.Text = pkm.PID.ToString("X8");
|
||||
|
|
Loading…
Add table
Reference in a new issue