namespace PKHeX.Core;
///
/// Logic for determining if a value is required for a given encounter.
///
public static class HomeTrackerUtil
{
///
/// Indicates if a value is required for the given encounter.
///
/// Encounter source
/// Entity to check
/// True if the encounter must have a value
public static bool IsRequired(IEncounterTemplate enc, PKM pk) => IsRequired(enc, pk.Context);
///
public static bool IsRequired(IEncounterTemplate enc, EntityContext current)
{
if (IsRequired(current, enc.Context))
return true;
if (IsRequired(enc))
return true;
return false;
}
///
public static bool IsRequired(EntityContext current, EntityContext origin) => origin != current;
///
///
/// Encounters that originate in HOME -> transfer to save data
///
public static bool IsRequired(IEncounterTemplate enc) => enc switch
{
EncounterSlot8GO => true,
WC8 { IsHOMEGift: true } => true,
WB8 { IsHOMEGift: true } => true,
WA8 { IsHOMEGift: true } => true,
WC9 { IsHOMEGift: true } => true,
_ => enc.Generation < 8,
};
}