namespace PKHeX.Core; /// /// Move specific to contain in which Generation it was learned & source. /// public sealed record CheckMoveResult : ICheckResult { public Severity Judgement { get; private set; } public CheckIdentifier Identifier { get; private set; } public string Comment { get; private set; } = string.Empty; public bool Valid => Judgement >= Severity.Fishy; public string Rating => Judgement.Description(); /// Method of learning the move. public MoveSource Source { get; private set; } /// Generation the move was learned in. public int Generation { get; private set; } /// Indicates if the source of the move was validated from the public bool IsRelearn => Source == MoveSource.Relearn || (Source == MoveSource.EggMove && Generation >= 6); /// Indicates if the source of the move was validated as originating from an egg. public bool IsEggSource => Source is MoveSource.EggMove or MoveSource.InheritLevelUp; /// Indicates if the entry was parsed by the legality checker. Should never be true when the parent legality check is finalized. internal bool IsParsed => Source is not MoveSource.NotParsed; /// Sets to false. internal void Reset() => Source = MoveSource.NotParsed; /// Checks if the Move should be present in a Relearn move pool (assuming Gen6+ origins). /// Invalid moves that can't be validated should be here, hence the inclusion. public bool ShouldBeInRelearnMoves() => Source != MoveSource.None && (!Valid || IsRelearn); internal void Set(MoveSource m, int g, Severity s, string c, CheckIdentifier i) { Judgement = s; Comment = c; Identifier = i; Source = m; Generation = g; } internal void FlagIllegal(string comment) { Judgement = Severity.Invalid; Comment = comment; } internal void FlagIllegal(string comment, CheckIdentifier identifier) { Judgement = Severity.Invalid; Comment = comment; Identifier = identifier; } public string Format(string format) => string.Format(format, Rating, Comment); public string Format(string format, int index) => string.Format(format, Rating, index, Comment); }