From 7b19e3fb7fb7fa80ffd5a07d2cda3a9a41104b27 Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 25 Sep 2020 19:37:38 -0700 Subject: [PATCH] Add affixed ribbon legality check https://github.com/kwsch/PKHeX/issues/3001#issuecomment-698749761 --- PKHeX.Core/Legality/LegalityCheckStrings.cs | 1 + PKHeX.Core/Legality/Verifiers/MarkVerifier.cs | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/PKHeX.Core/Legality/LegalityCheckStrings.cs b/PKHeX.Core/Legality/LegalityCheckStrings.cs index bcd3b4a4f..8e798da76 100644 --- a/PKHeX.Core/Legality/LegalityCheckStrings.cs +++ b/PKHeX.Core/Legality/LegalityCheckStrings.cs @@ -406,6 +406,7 @@ public static class LegalityCheckStrings public static string LRibbonFInvalid_0 { get; set; } = "Invalid Ribbons: {0}"; public static string LRibbonFMissing_0 { get; set; } = "Missing Ribbons: {0}"; public static string LRibbonMarkingFInvalid_0 { get; set; } = "Invalid Marking: {0}"; + public static string LRibbonMarkingAffixedF_0 { get; set; } = "Invalid Affixed Ribbon/Marking: {0}"; public static string LStatDynamaxInvalid { get; set; } = "Dynamax Level is not within the expected range."; public static string LStatIncorrectHeight { get; set; } = "Calculated Height does not match stored value."; diff --git a/PKHeX.Core/Legality/Verifiers/MarkVerifier.cs b/PKHeX.Core/Legality/Verifiers/MarkVerifier.cs index b549a3ced..ea7f112dd 100644 --- a/PKHeX.Core/Legality/Verifiers/MarkVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/MarkVerifier.cs @@ -54,6 +54,14 @@ private void VerifyMarksPresent(LegalityAnalysis data, IRibbonIndex m) hasOne = true; } + + if (m is PK8 pk8 && pk8.AffixedRibbon != -1) + { + if (pk8.AffixedRibbon > (int)RibbonIndex.MarkSlump) + data.AddLine(GetInvalid(string.Format(LRibbonMarkingAffixedF_0, pk8.AffixedRibbon))); + else if (!hasOne) + data.AddLine(GetInvalid(string.Format(LRibbonMarkingAffixedF_0, (RibbonIndex)pk8.AffixedRibbon))); + } } private static bool VerifyMarking(LegalityAnalysis data, RibbonIndex mark)