mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 04:23:12 +00:00
Set valid mystry mew seed on creation
Uses a Method specific seed regardless of template.
This commit is contained in:
parent
86d80a7d0b
commit
c9f222bf38
2 changed files with 19 additions and 2 deletions
|
@ -30,13 +30,30 @@ namespace PKHeX.Core
|
|||
0xFE9D
|
||||
};
|
||||
|
||||
private const int FramesPerMew = 5;
|
||||
private const int MewPerRestrictedSeed = 5;
|
||||
|
||||
public static uint GetSeed(int random, PIDType type = PIDType.BACD_U)
|
||||
{
|
||||
int restricted = random % Seeds.Length;
|
||||
var seed = (uint)Seeds[restricted];
|
||||
if (type == PIDType.BACD_R)
|
||||
return seed;
|
||||
|
||||
int position = (random % (MewPerRestrictedSeed - 1)) + 1;
|
||||
for (int i = 0; i < position; i++)
|
||||
seed = RNG.LCRNG.Advance(seed, FramesPerMew);
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
||||
public static int GetSeedIndex(uint seed)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (seed <= ushort.MaxValue)
|
||||
return Array.BinarySearch(Seeds, (ushort)seed);
|
||||
seed = RNG.LCRNG.Reverse(seed, 5);
|
||||
seed = RNG.LCRNG.Reverse(seed, FramesPerMew);
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
|
|
@ -170,7 +170,7 @@ namespace PKHeX.Core
|
|||
private void SetPINGA(PK3 pk, EncounterCriteria criteria)
|
||||
{
|
||||
var seed = Util.Rand32();
|
||||
seed = GetSaneSeed(seed);
|
||||
seed = OT_Name == "MYSTRY" ? MystryMew.GetSeed((int)seed, Method) : GetSaneSeed(seed);
|
||||
PIDGenerator.SetValuesFromSeed(pk, Method, seed);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue