Misc cxd format updates

fix friendship for xk3
fix colo fateful read
This commit is contained in:
Kurt 2018-11-26 19:21:48 -08:00
parent 08f13cb3a1
commit 085a6e2a2b
3 changed files with 8 additions and 4 deletions

View file

@ -176,14 +176,13 @@ 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 Valid { get => Data[0xCD] == 0; set { if (value) Data[0xCD] = 0; } }
public override bool FatefulEncounter { get => Data[0xCD] == 1; set { if (value) Data[0xCD] = 1; } }
// 0xCE unknown
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 override bool FatefulEncounter { get => Data[0x11C] == 1; set => Data[0x11C] = (byte)(value ? 1 : 0); }
public new int EncounterType { get => Data[0xFB]; set => Data[0xFB] = (byte)value; }
protected override byte[] Encrypt()

View file

@ -93,7 +93,7 @@
/// <returns>New object with transferred properties.</returns>
protected T ConvertTo<T>() where T : _K3, new()
{
return new T // Convert away!
var pk = new T // Convert away!
{
Species = Species,
Language = Language,
@ -174,6 +174,11 @@
Unused3 = Unused3,
Unused4 = Unused4,
};
var ck3 = pk as CK3;
if (ck3 != null)
ck3.Purification = -100; // purified
return pk;
}
}
}

View file

@ -43,7 +43,7 @@ namespace PKHeX.Core
public override int SpriteItem => ItemConverter.GetG4Item((ushort)HeldItem);
public override int HeldItem { get => BigEndian.ToUInt16(Data, 0x02); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x02); }
public override int Stat_HPCurrent { get => BigEndian.ToUInt16(Data, 0x04); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x04); }
public override int OT_Friendship { get => Data[0x06]; set => Data[0x06] = (byte)value; }
public override int OT_Friendship { get => BigEndian.ToUInt16(Data, 0x06); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x06); }
public override int Met_Location { get => BigEndian.ToUInt16(Data, 0x08); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x08); }
// 0x0A-0x0B Unknown
// 0x0C-0x0D Unknown