mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-25 22:08:40 -05:00
Revise alola champ ribbon check
This commit is contained in:
@@ -166,8 +166,9 @@ private static IEnumerable<RibbonResult> GetInvalidRibbons(PKM pk, EvolutionHist
|
||||
}
|
||||
if (pk is IRibbonSetCommon7 s7)
|
||||
{
|
||||
bool inhabited7 = gen <= 7 && !pk.GG;
|
||||
if (!inhabited7 && enc is not IRibbonSetCommon7 { RibbonChampionAlola: true })
|
||||
bool inhabited7 = evos.HasVisitedGen7;
|
||||
bool alolaValid = GetIsAlolaChampValid(s7, enc, inhabited7);
|
||||
if (!alolaValid)
|
||||
yield return new RibbonResult(nameof(s7.RibbonChampionAlola));
|
||||
|
||||
if (!inhabited7 || !IsAllowedBattleFrontier(pk.Species))
|
||||
@@ -198,6 +199,18 @@ private static IEnumerable<RibbonResult> GetInvalidRibbons(PKM pk, EvolutionHist
|
||||
}
|
||||
}
|
||||
|
||||
private static bool GetIsAlolaChampValid(IRibbonSetCommon7 s7, IEncounterTemplate enc, bool inhabited7)
|
||||
{
|
||||
// If the encounter comes with the ribbon, it must have the ribbon.
|
||||
if (enc is IRibbonSetCommon7 { RibbonChampionAlola: true })
|
||||
return s7.RibbonChampionAlola;
|
||||
// If it has visited, it can be either state.
|
||||
if (inhabited7)
|
||||
return true;
|
||||
// If it has not visited, it must not have it.
|
||||
return !s7.RibbonChampionAlola;
|
||||
}
|
||||
|
||||
private static bool IsRibbonValidEffort(PKM pk, EvolutionHistory evos, int gen) => gen switch
|
||||
{
|
||||
5 when pk.Format == 5 => false,
|
||||
|
||||
Reference in New Issue
Block a user