mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-30 07:50:32 +00:00
565f161226
Force shiny state for GO encounters For encounters, this interface property is mainly just for exposing metadata for sprites.
58 lines
1.5 KiB
C#
58 lines
1.5 KiB
C#
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,
|
|
|
|
/// <summary>
|
|
/// PID is randomly created and forced to be shiny as Stars.
|
|
/// </summary>
|
|
AlwaysStar = 5,
|
|
|
|
/// <summary>
|
|
/// PID is randomly created and forced to be shiny as Squares.
|
|
/// </summary>
|
|
AlwaysSquare = 6,
|
|
}
|
|
|
|
public static partial class Extensions
|
|
{
|
|
public static bool IsValid(this Shiny s, PKM pkm) => s switch
|
|
{
|
|
Shiny.Always => pkm.IsShiny,
|
|
Shiny.Never => !pkm.IsShiny,
|
|
Shiny.AlwaysSquare => pkm.ShinyXor == 0,
|
|
Shiny.AlwaysStar => pkm.ShinyXor == 1,
|
|
_ => true
|
|
};
|
|
|
|
public static bool IsShiny(this Shiny s) => s switch
|
|
{
|
|
Shiny.Always => true,
|
|
Shiny.AlwaysSquare => true,
|
|
Shiny.AlwaysStar => true,
|
|
_ => false
|
|
};
|
|
}
|
|
}
|