Update fateful encounter read location

Closes #2289
This commit is contained in:
Kurt 2019-05-14 18:36:43 -07:00
parent 44a257b832
commit 555e81205d
3 changed files with 21 additions and 6 deletions

View file

@ -38,7 +38,7 @@ namespace PKHeX.Core
public override ushort Sanity { get => 0; set { } } // valid flag set in pkm structure.
public override ushort Checksum { get => Checksums.CRC16_CCITT(Data); set { } } // totally false, just a way to get a 'random' ident for the pkm.
public override bool ChecksumValid => true;
public override bool Valid => true;
public override bool Valid { get => !Invalid; set => Invalid = !value; }
public override int Species { get => SpeciesConverter.GetG4Species(BigEndian.ToUInt16(Data, 0x00)); set => BigEndian.GetBytes((ushort)SpeciesConverter.GetG3Species(value)).CopyTo(Data, 0x00); }
// 02-04 unused
@ -175,14 +175,22 @@ namespace PKHeX.Core
public override int PKRS_Strain { get => Data[0xCA] & 0xF; set => Data[0xCA] = (byte)(value & 0xF); }
public override bool IsEgg { get => Data[0xCB] == 1; set => Data[0xCB] = (byte)(value ? 1 : 0); }
public override bool AbilityBit { get => Data[0xCC] == 1; set => Data[0xCC] = (byte)(value ? 1 : 0); }
public override bool FatefulEncounter { get => Data[0xCD] == 1; set { if (value) Data[0xCD] = 1; } }
// 0xCE unknown
private bool Invalid { get => Data[0xCD] != 0; set => Data[0xCD] = (byte)(value ? 1 : 0); }
public override int MarkValue { get => SwapBits(Data[0xCF], 1, 2); protected set => Data[0xCF] = (byte)SwapBits(value, 1, 2); }
public override int PKRS_Days { get => Math.Max((sbyte)Data[0xD0], (sbyte)0); set => Data[0xD0] = (byte)(value == 0 ? 0xFF : value & 0xF); }
public int ShadowID { get => BigEndian.ToUInt16(Data, 0xD8); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0xD8); }
public int Purification { get => BigEndian.ToInt32(Data, 0xDC); set => BigEndian.GetBytes(value).CopyTo(Data, 0xDC); }
public uint EXP_Shadow { get => BigEndian.ToUInt32(Data, 0xC0); set => BigEndian.GetBytes(value).CopyTo(Data, 0xC0); }
public new int EncounterType { get => Data[0xFB]; set => Data[0xFB] = (byte)value; }
// public bool Obedient { get => Data[0xF8] == 1; set => Data[0xF8] = (byte)(value ? 1 : 0); }
private int EncounterInfo { get => Data[0xFB]; set => Data[0xFB] = (byte)value; }
public override bool FatefulEncounter
{
get => (EncounterInfo & 1) == 1;
set => EncounterInfo = (byte)((EncounterInfo & ~(1 << 0)) | (value ? 1 << 0 : 0));
}
protected override byte[] Encrypt()
{

View file

@ -69,9 +69,16 @@ namespace PKHeX.Core
public override uint PID { get => BigEndian.ToUInt32(Data, 0x28); set => BigEndian.GetBytes(value).CopyTo(Data, 0x28); }
// 0x2A-0x2B Unknown
// 0x2C-0x2F Battle Related
public override bool FatefulEncounter { get => Data[0x30] == 1; set => Data[0x30] = (byte)(value ? 1 : 0); }
// public bool Obedient { get => Data[0x30] == 1; set => Data[0x30] = (byte)(value ? 1 : 0); }
// 0x31-0x32 Unknown
public new int EncounterType { get => Data[0x33]; set => Data[0x33] = (byte)value; }
public int EncounterInfo { get => Data[0x33]; set => Data[0x33] = (byte)value; }
public override bool FatefulEncounter
{
get => (EncounterInfo & 1) == 1;
set => EncounterInfo = (byte)((EncounterInfo & ~(1 << 0)) | (value ? 1 << 0 : 0));
}
public override int Version { get => GetGBAVersionID(Data[0x34]); set => Data[0x34] = GetGCVersionID(value); }
public int CurrentRegion { get => Data[0x35]; set => Data[0x35] = (byte)value; }
public int OriginalRegion { get => Data[0x36]; set => Data[0x36] = (byte)value; }