2024-02-23 19:20:24 +00:00
|
|
|
using System;
|
2022-01-03 05:35:59 +00:00
|
|
|
using static System.Buffers.Binary.BinaryPrimitives;
|
2020-09-07 20:51:13 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
namespace PKHeX.Core;
|
|
|
|
|
|
|
|
public sealed class MaisonBlock : SaveBlock<SAV6>
|
2020-09-07 20:51:13 +00:00
|
|
|
{
|
2024-03-04 05:13:16 +00:00
|
|
|
public MaisonBlock(SAV6XY sav, Memory<byte> raw) : base(sav, raw) { }
|
|
|
|
public MaisonBlock(SAV6AO sav, Memory<byte> raw) : base(sav, raw) { }
|
2020-09-07 20:51:13 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
// 5 * [u16*4: normal,super,normalStreak,superStreak]
|
|
|
|
public const int MaisonStatCount = 20;
|
2020-09-09 19:47:24 +00:00
|
|
|
|
2024-03-04 05:13:16 +00:00
|
|
|
public ushort GetMaisonStat(int index) => ReadUInt16LittleEndian(Data[(0x1C0 + (2 * index))..]);
|
|
|
|
public void SetMaisonStat(int index, ushort value) => WriteUInt16LittleEndian(Data[(0x1C0 + (2 * index))..], value);
|
2020-09-09 19:47:24 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
private static int GetMaisonStatIndex(BattleStyle6 type, bool streak, bool super) => ((int)type << 2) | (streak ? 2 : 0) | (super ? 1 : 0);
|
|
|
|
public ushort GetMaisonStat(BattleStyle6 type, bool streak, bool super) => GetMaisonStat(GetMaisonStatIndex(type, streak, super));
|
|
|
|
public void SetMaisonStat(BattleStyle6 type, bool streak, bool super, ushort value) => SetMaisonStat(GetMaisonStatIndex(type, streak, super), value);
|
2020-09-07 20:51:13 +00:00
|
|
|
}
|