mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-09 04:24:36 -05:00
Flag invalid nsparkle
previously would only flag if it was missing on npokemon also fix gen5 traded egg locations move egg ribbon verification to the new class
This commit is contained in:
parent
47ca69f92b
commit
76ff629006
|
|
@ -753,7 +753,8 @@ private void VerifyRibbons()
|
|||
var encounterContent = (EncounterMatch as MysteryGift)?.Content ?? EncounterMatch;
|
||||
if (pkm.IsEgg)
|
||||
{
|
||||
VerifyRibbonsEgg(encounterContent);
|
||||
if (RibbonVerifier.GetIncorrectRibbonsEgg(pkm, encounterContent))
|
||||
AddLine(Severity.Invalid, V603, CheckIdentifier.Ribbon);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -763,28 +764,6 @@ private void VerifyRibbons()
|
|||
else
|
||||
AddLine(Severity.Valid, V602, CheckIdentifier.Ribbon);
|
||||
}
|
||||
private void VerifyRibbonsEgg(object encounter)
|
||||
{
|
||||
var event3 = encounter as IRibbonSetEvent3;
|
||||
var event4 = encounter as IRibbonSetEvent4;
|
||||
var RibbonNames = ReflectUtil.GetPropertiesStartWithPrefix(pkm.GetType(), "Ribbon");
|
||||
if (event3 != null)
|
||||
RibbonNames = RibbonNames.Except(event3.RibbonNames());
|
||||
if (event4 != null)
|
||||
RibbonNames = RibbonNames.Except(event4.RibbonNames());
|
||||
|
||||
foreach (object RibbonValue in RibbonNames.Select(RibbonName => ReflectUtil.GetValue(pkm, RibbonName)))
|
||||
{
|
||||
if (!HasFlag(RibbonValue) && !HasCount(RibbonValue))
|
||||
continue;
|
||||
|
||||
AddLine(Severity.Invalid, V603, CheckIdentifier.Ribbon);
|
||||
return;
|
||||
|
||||
bool HasFlag(object o) => o is bool z && z;
|
||||
bool HasCount(object o) => o is int z && z > 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void VerifyCXD()
|
||||
{
|
||||
|
|
@ -2017,7 +1996,7 @@ private void VerifyMisc()
|
|||
if (!Encounter.Valid)
|
||||
return;
|
||||
|
||||
if (Info.Generation == 5 && ((EncounterMatch as EncounterStatic)?.NSparkle ?? false))
|
||||
if (Info.Generation == 5)
|
||||
VerifyNsPKM();
|
||||
|
||||
switch (EncounterMatch)
|
||||
|
|
@ -2102,7 +2081,7 @@ private void VerifyFatefulIngameActive()
|
|||
}
|
||||
private void VerifyNsPKM()
|
||||
{
|
||||
bool req = (EncounterMatch as EncounterStatic)?.NSparkle ?? false;
|
||||
bool req = EncounterMatch is EncounterStatic s && s.NSparkle;
|
||||
if (pkm.Format == 5)
|
||||
{
|
||||
bool has = ((PK5)pkm).NPokémon;
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ private static CheckResult VerifyEncounterEgg(PKM pkm, IEncounterable egg)
|
|||
case 2: return new CheckResult(CheckIdentifier.Encounter); // no met location info
|
||||
case 3: return pkm.Format != 3 ? VerifyEncounterEgg3Transfer(pkm) : VerifyEncounterEgg3(pkm);
|
||||
case 4: return pkm.IsEgg ? VerifyUnhatchedEgg(pkm, 02002) : VerifyEncounterEgg4(pkm);
|
||||
case 5: return pkm.IsEgg ? VerifyUnhatchedEgg(pkm, 30002) : VerifyEncounterEgg5(pkm);
|
||||
case 5: return pkm.IsEgg ? VerifyUnhatchedEgg(pkm, 30003) : VerifyEncounterEgg5(pkm);
|
||||
case 6: return pkm.IsEgg ? VerifyUnhatchedEgg(pkm, 30002) : VerifyEncounterEgg6(pkm);
|
||||
case 7: return pkm.IsEgg ? VerifyUnhatchedEgg(pkm, 30002) : VerifyEncounterEgg7(pkm);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,26 @@ internal static List<string> GetIncorrectRibbons(PKM pkm, object encounterConten
|
|||
result.Add(string.Format(V601, string.Join(", ", invalidRibbons.Select(z => z.Replace("Ribbon", "")))));
|
||||
return result;
|
||||
}
|
||||
internal static bool GetIncorrectRibbonsEgg(PKM pkm, object encounterContent)
|
||||
{
|
||||
var event3 = encounterContent as IRibbonSetEvent3;
|
||||
var event4 = encounterContent as IRibbonSetEvent4;
|
||||
var RibbonNames = ReflectUtil.GetPropertiesStartWithPrefix(pkm.GetType(), "Ribbon");
|
||||
if (event3 != null)
|
||||
RibbonNames = RibbonNames.Except(event3.RibbonNames());
|
||||
if (event4 != null)
|
||||
RibbonNames = RibbonNames.Except(event4.RibbonNames());
|
||||
|
||||
foreach (object RibbonValue in RibbonNames.Select(RibbonName => ReflectUtil.GetValue(pkm, RibbonName)))
|
||||
{
|
||||
if (HasFlag(RibbonValue) || HasCount(RibbonValue))
|
||||
return true;
|
||||
|
||||
bool HasFlag(object o) => o is bool z && z;
|
||||
bool HasCount(object o) => o is int z && z > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private static IEnumerable<RibbonResult> GetRibbonResults(PKM pkm, object encounterContent, int gen)
|
||||
{
|
||||
return GetInvalidRibbons(pkm, gen)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user