mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 20:43:07 +00:00
9401b7a790
help dat compiler minor clean elsewhere
35 lines
No EOL
1 KiB
C#
35 lines
No EOL
1 KiB
C#
namespace PKHeX.Core
|
|
{
|
|
public enum TurnActionCode
|
|
{
|
|
None = 0,
|
|
Fight = 1,
|
|
Switch = 3,
|
|
Run = 4,
|
|
UNK5 = 5,
|
|
Rotate = 6,
|
|
UNK7 = 7,
|
|
MegaEvolve = 8,
|
|
}
|
|
|
|
public readonly struct TurnActionInstruction
|
|
{
|
|
public readonly int PlayerID;
|
|
public readonly int Count;
|
|
public readonly int Bit;
|
|
|
|
public TurnActionInstruction(byte Op)
|
|
{
|
|
PlayerID = Op >> 5;
|
|
Bit = (Op >> 4) & 1;
|
|
Count = Op & 0xF;
|
|
}
|
|
|
|
public byte GetRawValue => (byte)((Count & 0xF) | ((byte)Bit << 4) | (PlayerID << 5));
|
|
|
|
public override bool Equals(object obj) => obj is TurnStartInstruction t && t.GetRawValue == GetRawValue;
|
|
public override int GetHashCode() => GetRawValue;
|
|
public static bool operator ==(TurnActionInstruction left, TurnActionInstruction right) => left.Equals(right);
|
|
public static bool operator !=(TurnActionInstruction left, TurnActionInstruction right) => !(left == right);
|
|
}
|
|
} |