diff --git a/PKHeX.Core/Editing/Applicators/RibbonApplicator.cs b/PKHeX.Core/Editing/Applicators/RibbonApplicator.cs index fc845d4ef..1e8d556ea 100644 --- a/PKHeX.Core/Editing/Applicators/RibbonApplicator.cs +++ b/PKHeX.Core/Editing/Applicators/RibbonApplicator.cs @@ -27,10 +27,14 @@ public static void SetAllValidRibbons(LegalityAnalysis la) if (pk is IRibbonSetCommon6 c6) { // Medal Deadlock - if (pk is ISuperTrain s) + if (pk is ISuperTrain s && la.Info.EvoChainsAllGens.HasVisitedGen6) { - s.SecretSuperTrainingUnlocked = true; - s.SuperTrainSupremelyTrained = true; + s.SuperTrainBitFlags = RibbonRules.SetSuperTrainSupremelyTrained(s.SuperTrainBitFlags); + if (pk.Format == 6) // cleared on 6->7 transfer; only set in Gen6. + { + s.SecretSuperTrainingUnlocked = true; + s.SuperTrainSupremelyTrained = true; + } c6.RibbonTraining = true; } // Ribbon Deadlock diff --git a/PKHeX.Core/Legality/Structures/LegalityCheckResultCode.cs b/PKHeX.Core/Legality/Structures/LegalityCheckResultCode.cs index 839490327..518fde17e 100644 --- a/PKHeX.Core/Legality/Structures/LegalityCheckResultCode.cs +++ b/PKHeX.Core/Legality/Structures/LegalityCheckResultCode.cs @@ -238,7 +238,6 @@ public enum LegalityCheckResultCode : ushort MemoryIndexFeelHTLEQ9, MemoryIndexIntensityHT1, MemoryIndexLinkHT, - MemoryIndexVar_H1, MemoryMissingHT, MemoryMissingOT, MemorySocialZero, @@ -440,6 +439,7 @@ public enum LegalityCheckResultCode : ushort MemoryIndexFeel_H1, MemoryIndexIntensity_H1, MemoryIndexIntensityMin_H1, + MemoryIndexVar_H1, // One/Two Arguments: Special FirstComplex, diff --git a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonRules.cs b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonRules.cs index 5c52a096f..d6efefa1b 100644 --- a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonRules.cs +++ b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonRules.cs @@ -159,7 +159,14 @@ public static bool IsRibbonValidSuperTraining(PKM pk) /// /// Stored bitflags for Gen6/7 Super Training medals. /// true if all Super Training medals are set, false otherwise. - public static bool IsSuperTrainSupremelyTrained(uint value) => (value >> 2) == 0x3FFF_FFFF; // ignore the 2 unused low bits (18 regular, 12 secret). + public static bool IsSuperTrainSupremelyTrained(uint value) => (value & ~0b11) == 0xFFFF_FFFC; // ignore the 2 unused low bits (18 regular, 12 secret). + + /// + /// Forces the input to be in a state indicating "Supremely Trained" for Super Training medals. + /// + /// Current value + /// Supremely Trained value + public static uint SetSuperTrainSupremelyTrained(uint value) => (value & 0x3) | 0xFFFF_FFFC; // set all but the 2 unused low bits. /// /// Checks if the entity participated in battles for the ribbon. diff --git a/PKHeX.WinForms/Subforms/PKM Editors/RibbonEditor.cs b/PKHeX.WinForms/Subforms/PKM Editors/RibbonEditor.cs index 417bc380f..f4b4eee7e 100644 --- a/PKHeX.WinForms/Subforms/PKM Editors/RibbonEditor.cs +++ b/PKHeX.WinForms/Subforms/PKM Editors/RibbonEditor.cs @@ -94,6 +94,8 @@ private void PopulateRibbons() foreach (var r in slice) dict.Add(r.PropertyName, r); + // Find which ribbons are valid by brute forcing all valid ribbons onto the entity. + // The final ribbon state is what we will use to indicate which are possible. var clone = pk.Clone(); RibbonApplicator.SetAllValidRibbons(clone); var otherList = RibbonInfo.GetRibbonInfo(clone);