PKHeX/PKHeX.Core/Legality/Structures/Shiny.cs

54 lines
1.4 KiB
C#
Raw Normal View History

namespace PKHeX.Core
{
/// <summary>
/// Specification for <see cref="PKM.IsShiny"/>, used for creating and validating.
/// </summary>
public enum Shiny : byte
{
/// <summary>
/// PID is fixed to a specified value.
/// </summary>
FixedValue = 0,
/// <summary>
/// PID is purely random; can be shiny or not shiny.
/// </summary>
Random = 1,
/// <summary>
/// PID is randomly created and forced to be shiny.
/// </summary>
Always = 2,
/// <summary>
/// PID is randomly created and forced to be not shiny.
/// </summary>
Never = 3,
2019-11-28 17:46:48 +00:00
/// <summary>
/// PID is randomly created and forced to be shiny as Stars.
/// </summary>
AlwaysStar = 5,
/// <summary>
2019-11-28 18:35:18 +00:00
/// PID is randomly created and forced to be shiny as Squares.
2019-11-28 17:46:48 +00:00
/// </summary>
AlwaysSquare = 6,
}
public static partial class Extensions
{
public static bool IsValid(this Shiny s, PKM pkm)
{
return s switch
{
Shiny.Always => pkm.IsShiny,
Shiny.Never => !pkm.IsShiny,
2019-11-28 17:46:48 +00:00
Shiny.AlwaysSquare => pkm.ShinyXor == 0,
Shiny.AlwaysStar => pkm.ShinyXor == 1,
_ => true
};
}
}
}