PKHeX/PKHeX.Core/Legality/RNG/ClassicEra/LeadSeed.cs
Kurt 95fbf66a6e
Refactor: Gen3/4 Lead Encounters, property fixing (#4193)
In addition to the Method 1 (and other sibling PIDIV types) correlation, an encounter can only be triggered if the calls prior land on the Method {1} seed. The RNG community has dubbed these patterns as "Method J" (D/P/Pt), "Method K" (HG/SS), and "Method H" (Gen3, coined by yours truly). The basic gist of these is that they are pre-requisites, like the Shadow locks of Colosseum/XD. 

Rename/re-type a bunch of properties to get the codebase more in line with correct property names & more obvious underlying types.
2024-02-22 21:20:54 -06:00

34 lines
929 B
C#

using static PKHeX.Core.LeadRequired;
namespace PKHeX.Core;
/// <summary>
/// Result wrapper for encounter lead information.
/// </summary>
public struct LeadSeed(uint Seed, LeadRequired Lead)
{
/// <summary>
/// Seed the encounter was triggered from.
/// </summary>
public uint Seed = Seed;
/// <summary>
/// Lead condition required for the encounter.
/// </summary>
public LeadRequired Lead = Lead;
public readonly void Deconstruct(out uint seed, out LeadRequired lead)
{
seed = Seed;
lead = Lead;
}
public readonly bool IsNoRequirement() => Lead == None;
public readonly bool IsNoAbilityLead() => Lead == None;
public readonly bool IsValid() => Lead != Invalid;
/// <summary>
/// Prefers the lead with the most likely value (lowest value).
/// </summary>
public readonly bool IsBetterThan(in LeadSeed other) => Lead > other.Lead;
}