2017-06-07 05:10:05 +02:00
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
2017-10-23 23:12:58 -07:00
|
|
|
|
/// <summary>
|
2018-10-31 13:52:09 -07:00
|
|
|
|
/// Move specific <see cref="CheckResult"/> to contain in which Generation it was learned & source.
|
2017-10-23 23:12:58 -07:00
|
|
|
|
/// </summary>
|
2019-10-03 19:09:02 -07:00
|
|
|
|
public sealed class CheckMoveResult : CheckResult
|
2017-06-07 05:10:05 +02:00
|
|
|
|
{
|
2020-10-17 13:40:12 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Method of learning the move.
|
|
|
|
|
/// </summary>
|
2017-06-07 05:10:05 +02:00
|
|
|
|
public readonly MoveSource Source;
|
2020-10-17 13:40:12 -07:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Generation the move was learned in.
|
|
|
|
|
/// </summary>
|
2017-06-07 05:10:05 +02:00
|
|
|
|
public readonly int Generation;
|
2020-10-17 13:40:12 -07:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Indicates if the source of the move was validated from the <see cref="PKM.RelearnMoves"/>
|
|
|
|
|
/// </summary>
|
2021-01-28 18:08:13 -08:00
|
|
|
|
public bool IsRelearn => Source == MoveSource.Relearn || (Source == MoveSource.EggMove && Generation >= 6);
|
2020-10-17 13:40:12 -07:00
|
|
|
|
|
2021-05-15 21:41:04 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Indicates if the source of the move was validated as originating from an egg.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool IsEggSource => Source is MoveSource.EggMove or MoveSource.InheritLevelUp;
|
|
|
|
|
|
2020-10-17 13:40:12 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Checks if the Move should be present in a Relearn move pool (assuming Gen6+ origins).
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>Invalid moves that can't be validated should be here, hence the inclusion.</remarks>
|
|
|
|
|
public bool ShouldBeInRelearnMoves() => Source != MoveSource.None && (!Valid || IsRelearn);
|
2017-06-07 05:10:05 +02:00
|
|
|
|
|
2021-10-09 16:25:36 -07:00
|
|
|
|
internal CheckMoveResult(MoveSource m, int g, CheckIdentifier i) : base(i)
|
2017-06-07 05:10:05 +02:00
|
|
|
|
{
|
|
|
|
|
Source = m;
|
|
|
|
|
Generation = g;
|
|
|
|
|
}
|
2018-08-02 20:11:42 -07:00
|
|
|
|
|
2021-10-09 16:25:36 -07:00
|
|
|
|
internal CheckMoveResult(MoveSource m, int g, Severity s, string c, CheckIdentifier i) : base(s, c, i)
|
2017-06-07 05:10:05 +02:00
|
|
|
|
{
|
|
|
|
|
Source = m;
|
|
|
|
|
Generation = g;
|
|
|
|
|
}
|
2018-08-02 20:11:42 -07:00
|
|
|
|
|
2021-10-09 16:25:36 -07:00
|
|
|
|
internal CheckMoveResult(CheckMoveResult original, Severity s, string c, CheckIdentifier i) : this(original.Source, original.Generation, s, c, i) { }
|
|
|
|
|
internal CheckMoveResult(CheckMoveResult original, Severity s, string c) : this(original.Source, original.Generation, s, c, original.Identifier) { }
|
2017-06-07 05:10:05 +02:00
|
|
|
|
}
|
|
|
|
|
}
|