From 83d6402fd4a7ad4671f1fb60cedbb1837ae07df2 Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 26 Sep 2022 07:27:51 -0700 Subject: [PATCH] Add gen3 unown form-pid check --- PKHeX.Core/Legality/Formatting/LegalityCheckStrings.cs | 1 + PKHeX.Core/Legality/Verifiers/FormVerifier.cs | 2 ++ PKHeX.Core/Saves/SaveFile.cs | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/PKHeX.Core/Legality/Formatting/LegalityCheckStrings.cs b/PKHeX.Core/Legality/Formatting/LegalityCheckStrings.cs index 409dcef9d..daa480a8d 100644 --- a/PKHeX.Core/Legality/Formatting/LegalityCheckStrings.cs +++ b/PKHeX.Core/Legality/Formatting/LegalityCheckStrings.cs @@ -203,6 +203,7 @@ public static class LegalityCheckStrings public static string LFormPikachuCosplay { get; set; } = "Only Cosplay Pikachu can have this form."; public static string LFormPikachuCosplayInvalid { get; set; } = "Cosplay Pikachu cannot have the default form."; public static string LFormPikachuEventInvalid { get; set; } = "Event Pikachu cannot have the default form."; + public static string LFormInvalidExpect_0 { get; set; } = "Form is invalid, expected form index {0}."; public static string LFormValid { get; set; } = "Form is Valid."; public static string LFormVivillon { get; set; } = "Valid Vivillon pattern."; public static string LFormVivillonEventPre { get; set; } = "Event Vivillon pattern on pre-evolution."; diff --git a/PKHeX.Core/Legality/Verifiers/FormVerifier.cs b/PKHeX.Core/Legality/Verifiers/FormVerifier.cs index 2d46e142e..eaf7be87c 100644 --- a/PKHeX.Core/Legality/Verifiers/FormVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/FormVerifier.cs @@ -66,6 +66,8 @@ private CheckResult VerifyForm(LegalityAnalysis data) break; case Unown when Info.Generation == 2 && form >= 26: return GetInvalid(string.Format(LFormInvalidRange, "Z", form == 26 ? "!" : "?")); + case Unown when Info.Generation == 3 && form != EntityPID.GetUnownForm3(pk.EncryptionConstant): + return GetInvalid(string.Format(LFormInvalidExpect_0, EntityPID.GetUnownForm3(pk.EncryptionConstant))); case Dialga or Palkia or Giratina or Arceus when form > 0 && pk is PA8: // can change forms with key items break; case Giratina when form == 1 ^ pk.HeldItem == 112: // Giratina, Origin form only with Griseous Orb diff --git a/PKHeX.Core/Saves/SaveFile.cs b/PKHeX.Core/Saves/SaveFile.cs index 720a63ddd..f56a35634 100644 --- a/PKHeX.Core/Saves/SaveFile.cs +++ b/PKHeX.Core/Saves/SaveFile.cs @@ -140,7 +140,7 @@ public virtual MysteryGiftAlbum GiftAlbum #region Player Info public virtual int Gender { get; set; } public virtual int Language { get => -1; set { } } - public virtual int Game { get => -1; set { } } + public virtual int Game { get => (int)GameVersion.Any; set { } } public virtual int TID { get; set; } public virtual int SID { get; set; } public virtual string OT { get; set; } = "PKHeX";