diff --git a/PKHeX.Core/MysteryGifts/PCD.cs b/PKHeX.Core/MysteryGifts/PCD.cs index 27fb9b3d0..86502e6cd 100644 --- a/PKHeX.Core/MysteryGifts/PCD.cs +++ b/PKHeX.Core/MysteryGifts/PCD.cs @@ -28,10 +28,8 @@ public override int Ball set => Gift.Ball = value; } - public PCD(byte[] data = null) - { - Data = data ?? new byte[Size]; - } + public PCD() => Data = new byte[Size]; + public PCD(byte[] data) => Data = data; public PGT Gift { diff --git a/PKHeX.Core/MysteryGifts/PGF.cs b/PKHeX.Core/MysteryGifts/PGF.cs index fc8689c42..c2f1bcc98 100644 --- a/PKHeX.Core/MysteryGifts/PGF.cs +++ b/PKHeX.Core/MysteryGifts/PGF.cs @@ -11,10 +11,8 @@ public sealed class PGF : MysteryGift, IRibbonSetEvent3, IRibbonSetEvent4, ILang public const int Size = 0xCC; public override int Format => 5; - public PGF(byte[] data = null) - { - Data = data ?? new byte[Size]; - } + public PGF() => Data = new byte[Size]; + public PGF(byte[] data) => Data = data; public override int TID { get => BitConverter.ToUInt16(Data, 0x00); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x00); } public override int SID { get => BitConverter.ToUInt16(Data, 0x02); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x02); } diff --git a/PKHeX.Core/MysteryGifts/PGT.cs b/PKHeX.Core/MysteryGifts/PGT.cs index 9749b6228..d6acc31f1 100644 --- a/PKHeX.Core/MysteryGifts/PGT.cs +++ b/PKHeX.Core/MysteryGifts/PGT.cs @@ -45,10 +45,8 @@ private enum GiftType public override bool GiftUsed { get => false; set { } } public override object Content => PK; - public PGT(byte[] data = null) - { - Data = data ?? new byte[Size]; - } + public PGT() => Data = new byte[Size]; + public PGT(byte[] data) => Data = data; public byte CardType { get => Data[0]; set => Data[0] = value; } // Unused 0x01 diff --git a/PKHeX.Core/MysteryGifts/WB7.cs b/PKHeX.Core/MysteryGifts/WB7.cs index fbc1bdf4c..c76de157c 100644 --- a/PKHeX.Core/MysteryGifts/WB7.cs +++ b/PKHeX.Core/MysteryGifts/WB7.cs @@ -15,7 +15,7 @@ public sealed class WB7 : MysteryGift, IRibbonSetEvent3, IRibbonSetEvent4, ILang public override int Format => 7; - public WB7() : this(new byte[SizeFull]) { } + public WB7() => Data = new byte[SizeFull]; public WB7(byte[] data) => Data = data; public byte RestrictVersion { get => Data[0]; set => Data[0] = value; } @@ -418,7 +418,7 @@ public override PKM ConvertToPKM(ITrainerInfo SAV) if ((SAV.Generation > Format && OriginGame == 0) || !CanBeReceivedByVersion(pk.Version)) { // give random valid game - do { pk.Version = (int)GameVersion.SN + Util.Rand.Next(4); } + do { pk.Version = (int)GameVersion.GP + Util.Rand.Next(2); } while (!CanBeReceivedByVersion(pk.Version)); } diff --git a/PKHeX.Core/MysteryGifts/WC6.cs b/PKHeX.Core/MysteryGifts/WC6.cs index e1ce8998f..dc3a22285 100644 --- a/PKHeX.Core/MysteryGifts/WC6.cs +++ b/PKHeX.Core/MysteryGifts/WC6.cs @@ -14,9 +14,11 @@ public sealed class WC6 : MysteryGift, IRibbonSetEvent3, IRibbonSetEvent4, ILang public const uint EonTicketConst = 0x225D73C2; public override int Format => 6; - public WC6(byte[] data = null) + public WC6() => Data = new byte[Size]; + + public WC6(byte[] data) { - Data = data ?? new byte[Size]; + Data = data; if (Data.Length == SizeFull) { // Load Restrictions diff --git a/PKHeX.Core/MysteryGifts/WC7.cs b/PKHeX.Core/MysteryGifts/WC7.cs index d47ce1699..a827ea147 100644 --- a/PKHeX.Core/MysteryGifts/WC7.cs +++ b/PKHeX.Core/MysteryGifts/WC7.cs @@ -13,9 +13,11 @@ public sealed class WC7 : MysteryGift, IRibbonSetEvent3, IRibbonSetEvent4, ILang public const int SizeFull = 0x310; public override int Format => 7; - public WC7(byte[] data = null) + public WC7() => Data = new byte[Size]; + + public WC7(byte[] data) { - Data = data ?? new byte[Size]; + Data = data; if (Data.Length != SizeFull) return; diff --git a/PKHeX.Core/PKM/PB7.cs b/PKHeX.Core/PKM/PB7.cs index d57963b3c..7660c5103 100644 --- a/PKHeX.Core/PKM/PB7.cs +++ b/PKHeX.Core/PKM/PB7.cs @@ -6,7 +6,7 @@ namespace PKHeX.Core /// /// Notes about the next format /// - public class PB7 : PKM, IAwakened + public sealed class PB7 : PKM, IAwakened { public static readonly byte[] ExtraBytes = { @@ -21,9 +21,11 @@ public class PB7 : PKM, IAwakened public override int Format => 7; public override PersonalInfo PersonalInfo => PersonalTable.GG.GetFormeEntry(Species, AltForm); - public PB7(byte[] decryptedData = null, string ident = null) + public PB7() => Data = new byte[SIZE]; + + public PB7(byte[] decryptedData, string ident = null) { - Data = decryptedData ?? new byte[SIZE]; + Data = decryptedData; PKMConverter.CheckEncrypted(ref Data, 7); Identifier = ident; if (Data.Length != SIZE) diff --git a/PKHeX.Core/PKM/PK3.cs b/PKHeX.Core/PKM/PK3.cs index 2233a8168..e8dee04bb 100644 --- a/PKHeX.Core/PKM/PK3.cs +++ b/PKHeX.Core/PKM/PK3.cs @@ -15,16 +15,17 @@ public sealed class PK3 : _K3 public override int Format => 3; public override PersonalInfo PersonalInfo => PersonalTable.RS[Species]; - public PK3(byte[] decryptedData = null, string ident = null) + public PK3() => Data = new byte[PKX.SIZE_3PARTY]; + + public PK3(byte[] decryptedData, string ident = null) { - Data = decryptedData ?? new byte[SIZE_PARTY]; + Data = decryptedData; PKMConverter.CheckEncrypted(ref Data, Format); Identifier = ident; if (Data.Length != SIZE_PARTY) Array.Resize(ref Data, SIZE_PARTY); } - public PK3() => Data = new byte[SIZE_PARTY]; public override PKM Clone() => new PK3((byte[])Data.Clone(), Identifier); private string GetString(int Offset, int Count) => StringConverter.GetString3(Data, Offset, Count, Japanese); diff --git a/PKHeX.Core/PKM/PK4.cs b/PKHeX.Core/PKM/PK4.cs index 5435a1d6a..57067c18b 100644 --- a/PKHeX.Core/PKM/PK4.cs +++ b/PKHeX.Core/PKM/PK4.cs @@ -16,7 +16,9 @@ public sealed class PK4 : _K4 public override int Format => 4; public override PersonalInfo PersonalInfo => PersonalTable.HGSS.GetFormeEntry(Species, AltForm); - public PK4(byte[] decryptedData = null, string ident = null) + public PK4() => Data = new byte[PKX.SIZE_4PARTY]; + + public PK4(byte[] decryptedData, string ident = null) { Data = decryptedData ?? new byte[SIZE_PARTY]; PKMConverter.CheckEncrypted(ref Data, Format); @@ -25,7 +27,6 @@ public PK4(byte[] decryptedData = null, string ident = null) Array.Resize(ref Data, SIZE_PARTY); } - public PK4() => Data = new byte[SIZE_PARTY]; public override PKM Clone() => new PK4((byte[])Data.Clone(), Identifier); private string GetString(int Offset, int Count) => StringConverter.GetString4(Data, Offset, Count); diff --git a/PKHeX.Core/PKM/PK5.cs b/PKHeX.Core/PKM/PK5.cs index 37a4d7bfe..435b4b940 100644 --- a/PKHeX.Core/PKM/PK5.cs +++ b/PKHeX.Core/PKM/PK5.cs @@ -16,7 +16,9 @@ public sealed class PK5 : PKM, IRibbonSetEvent3, IRibbonSetEvent4, IRibbonSetUni public override int Format => 5; public override PersonalInfo PersonalInfo => PersonalTable.B2W2.GetFormeEntry(Species, AltForm); - public PK5(byte[] decryptedData = null, string ident = null) + public PK5() => Data = new byte[PKX.SIZE_5PARTY]; + + public PK5(byte[] decryptedData, string ident = null) { Data = decryptedData ?? new byte[SIZE_PARTY]; PKMConverter.CheckEncrypted(ref Data, Format); diff --git a/PKHeX.Core/PKM/PK6.cs b/PKHeX.Core/PKM/PK6.cs index fe486eb73..26bd7fb57 100644 --- a/PKHeX.Core/PKM/PK6.cs +++ b/PKHeX.Core/PKM/PK6.cs @@ -17,7 +17,9 @@ public sealed class PK6 : PKM, IRibbonSetEvent3, IRibbonSetEvent4, IRibbonSetCom public override int Format => 6; public override PersonalInfo PersonalInfo => PersonalTable.AO.GetFormeEntry(Species, AltForm); - public PK6(byte[] decryptedData = null, string ident = null) + public PK6() => Data = new byte[PKX.SIZE_6PARTY]; + + public PK6(byte[] decryptedData, string ident = null) { Data = decryptedData ?? new byte[SIZE_PARTY]; PKMConverter.CheckEncrypted(ref Data, Format); diff --git a/PKHeX.Core/PKM/PK7.cs b/PKHeX.Core/PKM/PK7.cs index e05d3a144..aac35eec2 100644 --- a/PKHeX.Core/PKM/PK7.cs +++ b/PKHeX.Core/PKM/PK7.cs @@ -18,9 +18,11 @@ public sealed class PK7 : PKM, IRibbonSetEvent3, IRibbonSetEvent4, IRibbonSetCom public override int Format => 7; public override PersonalInfo PersonalInfo => PersonalTable.USUM.GetFormeEntry(Species, AltForm); - public PK7(byte[] decryptedData = null, string ident = null) + public PK7() => Data = new byte[PKX.SIZE_6PARTY]; + + public PK7(byte[] decryptedData, string ident = null) { - Data = decryptedData ?? new byte[SIZE_PARTY]; + Data = decryptedData; PKMConverter.CheckEncrypted(ref Data, Format); Identifier = ident; if (Data.Length != SIZE_PARTY)