PKHeX/PKHeX.Core/PersonalInfo/PersonalInfoG4.cs
Kurt 47643f49b6 remove linq personalinfo bit fetch
reads the bits out of the original array (saves a few ms by not
allocating/gc)
2018-02-16 19:34:42 -08:00

31 lines
902 B
C#

using System;
namespace PKHeX.Core
{
/// <summary>
/// <see cref="PersonalInfo"/> class with values from Generation 4 games.
/// </summary>
public class PersonalInfoG4 : PersonalInfoG3
{
public new const int SIZE = 0x2C;
public PersonalInfoG4(byte[] data)
{
if (data.Length != SIZE)
return;
Data = data;
// Unpack TMHM & Tutors
TMHM = GetBits(Data, 0x1C, 0x0D);
TypeTutors = new bool[0]; // not stored in personal
}
public override byte[] Write()
{
SetBits(TMHM).CopyTo(Data, 0x1C);
return Data;
}
// Manually added attributes
public override int FormeCount { get => Data[0x29]; set {} }
protected internal override int FormStatsIndex { get => BitConverter.ToUInt16(Data, 0x2A); set {} }
}
}