2019-05-14 01:42:30 +00:00
|
|
|
|
using System;
|
2019-05-14 05:56:45 +00:00
|
|
|
|
using System.ComponentModel;
|
2019-05-14 01:42:30 +00:00
|
|
|
|
|
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
2019-10-04 02:09:02 +00:00
|
|
|
|
public sealed class Poffin4
|
2019-05-14 01:42:30 +00:00
|
|
|
|
{
|
|
|
|
|
public const int SIZE = 8;
|
|
|
|
|
public readonly byte[] Data;
|
|
|
|
|
|
2022-01-03 05:35:59 +00:00
|
|
|
|
public Poffin4(byte[] data) => Data = data;
|
|
|
|
|
public Poffin4(byte[] data, int offset) : this(data.AsSpan(offset, SIZE).ToArray())
|
2019-05-14 01:42:30 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-14 05:56:45 +00:00
|
|
|
|
private const string Stats = nameof(Stats);
|
|
|
|
|
|
2019-05-14 01:42:30 +00:00
|
|
|
|
public PoffinFlavor4 Type{ get => (PoffinFlavor4)Data[0]; set => Data[0] = (byte)value; }
|
2019-05-14 05:56:45 +00:00
|
|
|
|
|
|
|
|
|
[Category(Stats), Description("Cool Stat Boost")]
|
2019-05-14 01:42:30 +00:00
|
|
|
|
public byte BoostSpicy { get => Data[1]; set => Data[1] = value; }
|
2019-05-14 05:56:45 +00:00
|
|
|
|
|
|
|
|
|
[Category(Stats), Description("Beauty Stat Boost")]
|
2019-05-14 01:42:30 +00:00
|
|
|
|
public byte BoostDry { get => Data[2]; set => Data[2] = value; }
|
2019-05-14 05:56:45 +00:00
|
|
|
|
|
|
|
|
|
[Category(Stats), Description("Cute Stat Boost")]
|
2019-05-14 01:42:30 +00:00
|
|
|
|
public byte BoostSweet { get => Data[3]; set => Data[3] = value; }
|
2019-05-14 05:56:45 +00:00
|
|
|
|
|
|
|
|
|
[Category(Stats), Description("Smart/Clever Stat Boost")]
|
2019-05-14 01:42:30 +00:00
|
|
|
|
public byte BoostBitter { get => Data[4]; set => Data[4] = value; }
|
2019-05-14 05:56:45 +00:00
|
|
|
|
|
|
|
|
|
[Category(Stats), Description("Tough Stat Boost")]
|
2019-05-14 01:42:30 +00:00
|
|
|
|
public byte BoostSour { get => Data[5]; set => Data[5] = value; }
|
2019-05-14 05:56:45 +00:00
|
|
|
|
|
|
|
|
|
[Category(Stats), Description("Sheen Stat Boost")]
|
2019-05-14 01:42:30 +00:00
|
|
|
|
public byte Smoothness { get => Data[6]; set => Data[6] = value; }
|
|
|
|
|
// public byte Unused { get => Data[7]; set => Data[7] = value; }
|
|
|
|
|
|
|
|
|
|
public bool IsManyStat => Type >= PoffinFlavor4.Rich;
|
2019-05-14 05:56:45 +00:00
|
|
|
|
public PoffinFlavor4 StatPrimary => IsManyStat ? PoffinFlavor4.None : (PoffinFlavor4)(((byte) Type / 5) * 6);
|
|
|
|
|
public PoffinFlavor4 StatSecondary => IsManyStat ? PoffinFlavor4.None : (PoffinFlavor4)(((byte)Type % 5) * 6);
|
2019-05-14 01:42:30 +00:00
|
|
|
|
|
|
|
|
|
public void SetAll(byte value = 255, PoffinFlavor4 type = PoffinFlavor4.Rich)
|
|
|
|
|
{
|
|
|
|
|
Type = type;
|
|
|
|
|
BoostSpicy = BoostDry = BoostSweet = BoostBitter = BoostSour = Smoothness = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetStat(int stat, byte value)
|
|
|
|
|
{
|
|
|
|
|
if ((uint) stat > 5)
|
2021-08-21 23:51:50 +00:00
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(stat));
|
2019-05-14 01:42:30 +00:00
|
|
|
|
Data[1 + stat] = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public byte GetStat(int stat)
|
|
|
|
|
{
|
|
|
|
|
if ((uint)stat > 5)
|
2021-08-21 23:51:50 +00:00
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(stat));
|
2019-05-14 01:42:30 +00:00
|
|
|
|
return Data[1 + stat];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Delete() => SetAll(0, PoffinFlavor4.None);
|
|
|
|
|
}
|
|
|
|
|
}
|