2018-03-17 02:35:55 +00:00
|
|
|
|
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,
|
2018-03-17 02:35:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static partial class Extensions
|
|
|
|
|
{
|
2021-01-02 01:08:49 +00:00
|
|
|
|
public static bool IsValid(this Shiny s, PKM pkm) => s switch
|
2018-03-17 02:35:55 +00:00
|
|
|
|
{
|
2021-01-02 01:08:49 +00:00
|
|
|
|
Shiny.Always => pkm.IsShiny,
|
|
|
|
|
Shiny.Never => !pkm.IsShiny,
|
|
|
|
|
Shiny.AlwaysSquare => pkm.ShinyXor == 0,
|
|
|
|
|
Shiny.AlwaysStar => pkm.ShinyXor == 1,
|
2021-08-20 20:49:20 +00:00
|
|
|
|
_ => true,
|
2021-01-02 01:08:49 +00:00
|
|
|
|
};
|
2021-05-18 17:36:45 +00:00
|
|
|
|
|
|
|
|
|
public static bool IsShiny(this Shiny s) => s switch
|
|
|
|
|
{
|
|
|
|
|
Shiny.Always => true,
|
|
|
|
|
Shiny.AlwaysSquare => true,
|
|
|
|
|
Shiny.AlwaysStar => true,
|
2021-08-20 20:49:20 +00:00
|
|
|
|
_ => false,
|
2021-05-18 17:36:45 +00:00
|
|
|
|
};
|
2018-03-17 02:35:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|