2022-02-22 00:11:58 +00:00
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
|
|
|
|
|
|
public enum TurnActionCode
|
2018-08-19 03:10:30 +00:00
|
|
|
|
{
|
2022-02-22 00:11:58 +00:00
|
|
|
|
None = 0,
|
|
|
|
|
Fight = 1,
|
|
|
|
|
Switch = 3,
|
|
|
|
|
Run = 4,
|
|
|
|
|
UNK5 = 5,
|
|
|
|
|
Rotate = 6,
|
|
|
|
|
UNK7 = 7,
|
|
|
|
|
MegaEvolve = 8,
|
|
|
|
|
}
|
2018-08-19 03:10:30 +00:00
|
|
|
|
|
2022-02-22 00:11:58 +00:00
|
|
|
|
public readonly record struct TurnActionInstruction(int PlayerID, int Count, int Bit)
|
|
|
|
|
{
|
|
|
|
|
public static TurnActionInstruction Get(byte Op)
|
2018-08-19 03:10:30 +00:00
|
|
|
|
{
|
2022-02-22 00:11:58 +00:00
|
|
|
|
var PlayerID = Op >> 5;
|
|
|
|
|
var Bit = (Op >> 4) & 1;
|
|
|
|
|
var Count = Op & 0xF;
|
|
|
|
|
return new TurnActionInstruction(PlayerID, Count, Bit);
|
2018-08-19 03:10:30 +00:00
|
|
|
|
}
|
2022-02-22 00:11:58 +00:00
|
|
|
|
|
|
|
|
|
public byte GetRawValue => (byte)((Count & 0xF) | ((byte)Bit << 4) | (PlayerID << 5));
|
|
|
|
|
}
|