Revise set all valid ribbons for Gen6 training rib

This commit is contained in:
Kurt 2025-09-05 21:05:07 -05:00
parent d574ce32d1
commit e1ca2ccdf8
4 changed files with 18 additions and 5 deletions

View File

@ -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

View File

@ -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,

View File

@ -159,7 +159,14 @@ public static bool IsRibbonValidSuperTraining(PKM pk)
/// </summary>
/// <param name="value">Stored bitflags for Gen6/7 Super Training medals.</param>
/// <returns><c>true</c> if all Super Training medals are set, <c>false</c> otherwise.</returns>
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).
/// <summary>
/// Forces the input to be in a state indicating "Supremely Trained" for Super Training medals.
/// </summary>
/// <param name="value">Current value</param>
/// <returns>Supremely Trained value</returns>
public static uint SetSuperTrainSupremelyTrained(uint value) => (value & 0x3) | 0xFFFF_FFFC; // set all but the 2 unused low bits.
/// <summary>
/// Checks if the entity participated in battles for the <see cref="IRibbonSetCommon8.RibbonTowerMaster"/> ribbon.

View File

@ -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);