mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-08 18:36:21 -05:00
Minor tweaks
No functional change
This commit is contained in:
@@ -121,7 +121,7 @@ public static class Encounters5BW
|
||||
new(354, 37, 538, Gender: 1, Promotion: Banette),
|
||||
new(448, 10, 418, Gender: 0, Promotion: Lucario),
|
||||
new(468, 10, 217, Gender: 0, Promotion: Togekiss),
|
||||
|
||||
|
||||
// PGL (Both Versions)
|
||||
new (149, 55, 009, Gender: 0, Promotion: Dragonite1), // JPN/KOR ThunderPunch
|
||||
new (149, 55, 245, Gender: 0, Promotion: Dragonite2), // INT ExtremeSpeed
|
||||
|
||||
@@ -47,9 +47,10 @@ public enum GlobalLinkPromotionLanguage : byte
|
||||
None,
|
||||
Japanese = 1 << 0,
|
||||
Korean = 1 << 1,
|
||||
NotInt = Japanese | Korean,
|
||||
|
||||
International = 1 << 2,
|
||||
|
||||
NotInt = Japanese | Korean,
|
||||
NotKor = Japanese | International,
|
||||
All = Japanese | Korean | International,
|
||||
}
|
||||
|
||||
@@ -8,6 +8,13 @@ namespace PKHeX.Core;
|
||||
/// </summary>
|
||||
/// <remarks>Frame advancement for forward and reverse.
|
||||
/// <br>
|
||||
/// Standard MSVC (Microsoft Visual C/C++) runtime library implementation, with customized <see cref="Add"/> by GameFreak programmers.
|
||||
/// Historically, the "first" documented RNG implementation of the Pokémon games using a linear congruential generator, hence the eponymous name of this class.
|
||||
/// </br>
|
||||
/// <br>
|
||||
/// https://blog.winter-software.com/2024/06/16/emerald-rng-memes
|
||||
/// </br>
|
||||
/// <br>
|
||||
/// https://en.wikipedia.org/wiki/Linear_congruential_generator
|
||||
/// </br>
|
||||
/// <br>
|
||||
@@ -17,8 +24,8 @@ namespace PKHeX.Core;
|
||||
public static class LCRNG
|
||||
{
|
||||
// Forward and reverse constants
|
||||
public const uint Mult = 0x41C64E6D;
|
||||
public const uint Add = 0x00006073;
|
||||
public const uint Mult = 0x41C64E6D; // Standard ISO C / POSIX implementation multiplier constant
|
||||
public const uint Add = 0x00006073; // (12345*2)+1, *2+1 via misguided understanding when revising rand() outputs from s16 => u16.
|
||||
public const uint rMult = 0xEEB9EB65;
|
||||
public const uint rAdd = 0x0A3561A1;
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@ namespace PKHeX.Core;
|
||||
/// </summary>
|
||||
/// <remarks>Frame advancement for forward and reverse.
|
||||
/// <br>
|
||||
/// Standard MSVC (Microsoft Visual C/C++) runtime library implementation.
|
||||
/// </br>
|
||||
/// <br>
|
||||
/// https://en.wikipedia.org/wiki/Linear_congruential_generator
|
||||
/// </br>
|
||||
/// <br>
|
||||
@@ -17,8 +20,8 @@ namespace PKHeX.Core;
|
||||
public static class XDRNG
|
||||
{
|
||||
// Forward and reverse constants
|
||||
public const uint Mult = 0x000343FD;
|
||||
public const uint Add = 0x00269EC3;
|
||||
public const uint Mult = 0x000343FD; // 214013
|
||||
public const uint Add = 0x00269EC3; // 2531011
|
||||
public const uint rMult = 0xB9B33155;
|
||||
public const uint rAdd = 0xA170F641;
|
||||
|
||||
|
||||
@@ -75,14 +75,12 @@ public uint Prev()
|
||||
var t = w ^ z ^ (z >> 19);
|
||||
t ^= t >> 8;
|
||||
t ^= t >> 16;
|
||||
t ^= t << 11;
|
||||
t ^= t << 22;
|
||||
|
||||
w = z;
|
||||
z = y;
|
||||
y = x;
|
||||
|
||||
t ^= t << 11;
|
||||
t ^= t << 22;
|
||||
|
||||
x = t;
|
||||
return w;
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ public void Method1(uint seed, ushort rand0, ushort rand1)
|
||||
int count = LCRNGReversal.GetSeeds(seeds, first, second);
|
||||
count.Should().NotBe(0);
|
||||
|
||||
seeds[..count].IndexOf(seed).Should().NotBe(-1);
|
||||
seeds[..count].Contains(seed).Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -231,8 +231,8 @@ public void PIDIVMethod4IVs()
|
||||
// Seeds need to be unrolled twice to account for the 2 PID rolls before IVs.
|
||||
|
||||
var reg = seeds[..count];
|
||||
var index = reg.IndexOf(LCRNG.Next2(0x48FBAA42u));
|
||||
index.Should().NotBe(-1);
|
||||
var expect = LCRNG.Next2(0x48FBAA42u);
|
||||
reg.Contains(expect).Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -247,10 +247,10 @@ public void PIDIVSearchEuclid()
|
||||
Span<uint> seeds = stackalloc uint[XDRNG.MaxCountSeedsIV];
|
||||
var cp = XDRNG.GetSeeds(seeds, rand0 & 0xFFFF0000, rand1 & 0xFFFF0000);
|
||||
var p = seeds[..cp];
|
||||
p.IndexOf(seed).Should().NotBe(-1);
|
||||
p.Contains(seed).Should().BeTrue();
|
||||
|
||||
var ci = XDRNG.GetSeedsIVs(seeds, rand0 & 0x7FFF0000, rand1 & 0x7FFF0000);
|
||||
var i = seeds[..ci];
|
||||
i.IndexOf(seed).Should().NotBe(-1);
|
||||
i.Contains(seed).Should().BeTrue();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user