using System.Collections.Generic; namespace PKHeX.Core { /// /// Calculated Information storage with properties useful for parsing the legality of the input . /// public sealed class LegalInfo { /// The object used for comparisons. private readonly PKM pkm; /// The generation of games the originated from. public int Generation { get; set; } /// The Game the originated from. public GameVersion Game { get; set; } /// The matched Encounter details for the . public IEncounterable EncounterMatch { get => _match; set { if (_match != null && (value.LevelMin != _match.LevelMin || value.Species != _match.Species)) _evochains = null; // clear if evo chain has the potential to be different _match = value; Parse.Clear(); } } private IEncounterable _match; /// Indicates whether or not the originated from . public bool WasXD => pkm?.Version == 15 && EncounterMatch is IVersion v && v.Version == GameVersion.XD; /// Base Relearn Moves for the . public int[] RelearnBase { get; set; } /// Top level Legality Check result list for the . public readonly List Parse = new List(); public CheckResult[] Relearn { get; set; } = new CheckResult[4]; public CheckMoveResult[] Moves { get; set; } = new CheckMoveResult[4]; public ValidEncounterMoves EncounterMoves { get; set; } public IReadOnlyList[] EvoChainsAllGens => _evochains ?? (_evochains = EvolutionChain.GetEvolutionChainsAllGens(pkm, EncounterMatch)); private IReadOnlyList[] _evochains; /// related information that generated the / value(s). public PIDIV PIDIV { get; set; } /// Indicates whether or not the can originate from the . /// This boolean is true until all valid encounters are tested, after which it is false. public bool PIDIVMatches { get; set; } = true; /// Indicates whether or not the can originate from the with explicit matching. /// This boolean is true until all valid entries are tested for all possible matches, after which it is false. public bool FrameMatches { get; set; } = true; public readonly bool Korean; public LegalInfo(PKM pk) { pkm = pk; Korean = pk.Korean; // Store repeatedly accessed values Game = (GameVersion)pkm.Version; Generation = pkm.GenNumber; } /// List of all near-matches that were rejected for a given reason. public List InvalidMatches; internal void Reject(CheckResult c) { (InvalidMatches ?? (InvalidMatches = new List())).Add(new EncounterRejected(EncounterMatch, c)); } } }