2022-08-16 04:04:30 +00:00
|
|
|
using static PKHeX.Core.RibbonIndex;
|
|
|
|
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Parsing logic for <see cref="IRibbonSetCommon7"/>.
|
|
|
|
/// </summary>
|
|
|
|
public static class RibbonVerifierCommon7
|
|
|
|
{
|
|
|
|
public static void Parse(this IRibbonSetCommon7 r, RibbonVerifierArguments args, ref RibbonResultList list)
|
|
|
|
{
|
|
|
|
bool inhabited7 = args.History.HasVisitedGen7;
|
|
|
|
bool alolaValid = RibbonRules.IsRibbonValidAlolaChamp(r, args.Encounter, inhabited7);
|
|
|
|
if (!alolaValid)
|
2022-08-18 06:47:15 +00:00
|
|
|
list.Add(ChampionAlola, !r.RibbonChampionAlola);
|
2022-08-16 04:04:30 +00:00
|
|
|
|
|
|
|
var pk = args.Entity;
|
2022-08-22 02:15:02 +00:00
|
|
|
if (inhabited7)
|
2022-08-19 20:22:39 +00:00
|
|
|
{
|
2022-08-22 02:15:02 +00:00
|
|
|
var species = args.History.Gen7[0].Species;
|
|
|
|
bool allowed = RibbonRules.IsAllowedBattleFrontier(species);
|
|
|
|
if (allowed)
|
|
|
|
return; // Can have all 3 ribbons.
|
|
|
|
|
|
|
|
if (r.RibbonBattleRoyale)
|
|
|
|
list.Add(BattleRoyale);
|
|
|
|
if (r.RibbonBattleTreeMaster)
|
|
|
|
list.Add(BattleTreeMaster);
|
|
|
|
|
|
|
|
// Great ribbon is only available in US/UM for banned species.
|
|
|
|
if (r.RibbonBattleTreeGreat && !(pk.USUM || !pk.IsUntraded))
|
2022-08-19 20:22:39 +00:00
|
|
|
list.Add(BattleTreeGreat);
|
2022-08-22 02:15:02 +00:00
|
|
|
return;
|
2022-08-19 20:22:39 +00:00
|
|
|
}
|
2022-08-16 04:04:30 +00:00
|
|
|
|
|
|
|
if (r.RibbonBattleRoyale)
|
|
|
|
list.Add(BattleRoyale);
|
2022-08-19 20:22:39 +00:00
|
|
|
if (r.RibbonBattleTreeGreat)
|
2022-08-16 04:04:30 +00:00
|
|
|
list.Add(BattleTreeGreat);
|
|
|
|
if (r.RibbonBattleTreeMaster)
|
|
|
|
list.Add(BattleTreeMaster);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void ParseEgg(this IRibbonSetCommon7 r, ref RibbonResultList list)
|
|
|
|
{
|
|
|
|
if (r.RibbonChampionAlola)
|
|
|
|
list.Add(ChampionAlola);
|
|
|
|
|
|
|
|
if (r.RibbonBattleRoyale)
|
|
|
|
list.Add(BattleRoyale);
|
|
|
|
if (r.RibbonBattleTreeGreat)
|
|
|
|
list.Add(BattleTreeGreat);
|
|
|
|
if (r.RibbonBattleTreeMaster)
|
|
|
|
list.Add(BattleTreeMaster);
|
|
|
|
}
|
|
|
|
}
|