mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-22 12:03:10 +00:00
PA8: add missing marking interface
This commit is contained in:
parent
2296d34df3
commit
c0e44d6375
1 changed files with 11 additions and 4 deletions
|
@ -9,7 +9,7 @@ namespace PKHeX.Core;
|
|||
public sealed class PA8 : PKM, ISanityChecksum,
|
||||
IGanbaru, IAlpha, INoble, ITechRecord, ISociability, IMoveShop8Mastery, IContestStats, IHyperTrain, IScaledSizeValue, IScaledSize3, IGigantamax, IFavorite, IDynamaxLevel, IHandlerLanguage, IFormArgument, IHomeTrack, IBattleVersion, ITrainerMemories, IPokerusStatus,
|
||||
IRibbonIndex, IRibbonSetAffixed, IRibbonSetRibbons, IRibbonSetEvent3, IRibbonSetEvent4, IRibbonSetCommon3, IRibbonSetCommon4, IRibbonSetCommon6, IRibbonSetMemory6, IRibbonSetCommon7, IRibbonSetCommon8, IRibbonSetMarks, IRibbonSetMark8, IRibbonSetCommon9, IRibbonSetMark9,
|
||||
IHandlerUpdate
|
||||
IHandlerUpdate, IAppliedMarkings7
|
||||
{
|
||||
public override ReadOnlySpan<ushort> ExtraBytes =>
|
||||
[
|
||||
|
@ -131,7 +131,7 @@ public sealed class PA8 : PKM, ISanityChecksum,
|
|||
public bool IsAlpha { get => (Data[0x16] & 32) != 0; set => Data[0x16] = (byte)((Data[0x16] & ~32) | ((value ? 1 : 0) << 5)); }
|
||||
public bool IsNoble { get => (Data[0x16] & 64) != 0; set => Data[0x16] = (byte)((Data[0x16] & ~64) | ((value ? 1 : 0) << 6)); }
|
||||
// 0x17 alignment unused
|
||||
public ushort MarkValue { get => ReadUInt16LittleEndian(Data.AsSpan(0x18)); set => WriteUInt16LittleEndian(Data.AsSpan(0x18), value); }
|
||||
public ushort MarkingValue { get => ReadUInt16LittleEndian(Data.AsSpan(0x18)); set => WriteUInt16LittleEndian(Data.AsSpan(0x18), value); }
|
||||
// 0x1A alignment unused
|
||||
// 0x1B alignment unused
|
||||
public override uint PID { get => ReadUInt32LittleEndian(Data.AsSpan(0x1C)); set => WriteUInt32LittleEndian(Data.AsSpan(0x1C), value); }
|
||||
|
@ -547,7 +547,7 @@ public sealed class PA8 : PKM, ISanityChecksum,
|
|||
{
|
||||
if ((uint)index >= MarkingCount)
|
||||
throw new ArgumentOutOfRangeException(nameof(index));
|
||||
return (MarkingColor)((MarkValue >> (index * 2)) & 3);
|
||||
return (MarkingColor)((MarkingValue >> (index * 2)) & 3);
|
||||
}
|
||||
|
||||
public void SetMarking(int index, MarkingColor value)
|
||||
|
@ -555,9 +555,16 @@ public sealed class PA8 : PKM, ISanityChecksum,
|
|||
if ((uint)index >= MarkingCount)
|
||||
throw new ArgumentOutOfRangeException(nameof(index));
|
||||
var shift = index * 2;
|
||||
MarkValue = (ushort)((MarkValue & ~(0b11 << shift)) | (((byte)value & 3) << shift));
|
||||
MarkingValue = (ushort)((MarkingValue & ~(0b11 << shift)) | (((byte)value & 3) << shift));
|
||||
}
|
||||
|
||||
public MarkingColor MarkingCircle { get => GetMarking(0); set => SetMarking(0, value); }
|
||||
public MarkingColor MarkingTriangle { get => GetMarking(1); set => SetMarking(1, value); }
|
||||
public MarkingColor MarkingSquare { get => GetMarking(2); set => SetMarking(2, value); }
|
||||
public MarkingColor MarkingHeart { get => GetMarking(3); set => SetMarking(3, value); }
|
||||
public MarkingColor MarkingStar { get => GetMarking(4); set => SetMarking(4, value); }
|
||||
public MarkingColor MarkingDiamond { get => GetMarking(5); set => SetMarking(5, value); }
|
||||
|
||||
public bool GetRibbon(int index) => FlagUtil.GetFlag(Data, GetRibbonByte(index), index & 7);
|
||||
public void SetRibbon(int index, bool value = true) => FlagUtil.SetFlag(Data, GetRibbonByte(index), index & 7, value);
|
||||
|
||||
|
|
Loading…
Reference in a new issue