mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-25 11:53:11 +00:00
fc754b346b
[Language Reference](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces) Updates all the files, one less level of indentation. Some small changes were made to API surfaces, renaming `PKM pkm` -> `PKM pk`, and `LegalityAnalysis.pkm` -> `LegalityAnalysis.Entity`
20 lines
1.1 KiB
C#
20 lines
1.1 KiB
C#
using System;
|
|
using static System.Buffers.Binary.BinaryPrimitives;
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
public sealed class MaisonBlock : SaveBlock<SAV6>
|
|
{
|
|
public MaisonBlock(SAV6XY sav, int offset) : base(sav) => Offset = offset;
|
|
public MaisonBlock(SAV6AO sav, int offset) : base(sav) => Offset = offset;
|
|
|
|
// 5 * [u16*4: normal,super,normalStreak,superStreak]
|
|
public const int MaisonStatCount = 20;
|
|
|
|
public ushort GetMaisonStat(int index) => ReadUInt16LittleEndian(Data.AsSpan(Offset + 0x1C0 + (2 * index)));
|
|
public void SetMaisonStat(int index, ushort value) => WriteUInt16LittleEndian(Data.AsSpan(Offset + 0x1C0 + (2 * index)), value);
|
|
|
|
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);
|
|
}
|