PKHeX/PKHeX.Core/Legality/RNG/Frame/FrameCheckDetails.cs
Kurt 9e501ea527 Add more xmldoc, fix item9 again
really not a fan of the abstract class, probably better to rewrite everything another day to be less dumb

bug was due to the trickle-down then clearing; object references ended up being duplicated when Unobtainable item placeholders were removed from the pouch and things trickled.

don't bother removing unreleased item data if its quantity is 0.
2025-06-11 22:02:34 -05:00

35 lines
1.0 KiB
C#

namespace PKHeX.Core;
/// <summary>
/// Commonly reused frame details for checking encounter frames being possible to obtain.
/// </summary>
/// <remarks>
/// By precomputing the seeds, we can avoid having to calculate them on the fly for every lead scenario check.
/// </remarks>
public readonly ref struct FrameCheckDetails<T>
{
public readonly T Encounter;
public readonly byte LevelMin;
public readonly byte LevelMax;
public readonly uint Seed1;
public readonly uint Seed2;
public readonly uint Seed3;
public readonly byte Format;
public uint Seed4 => LCRNG.Prev(Seed3);
public uint Prev1 => Seed1 >> 16;
public uint Prev2 => Seed2 >> 16;
public uint Prev3 => Seed3 >> 16;
public FrameCheckDetails(T enc, uint seed, byte levelMin, byte levelMax, byte format)
{
Encounter = enc;
LevelMin = levelMin;
LevelMax = levelMax;
Format = format;
seed = Seed1 = LCRNG.Prev(seed);
seed = Seed2 = LCRNG.Prev(seed);
Seed3 = LCRNG.Prev(seed);
}
}