using static PKHeX.Core.Species; namespace PKHeX.Core; /// /// Exposes details about the quality of a potential match compared to an input . /// public interface IEncounterMatch { /// /// Checks if the implementing object's details might have been the originator of the current data. /// bool IsMatchExact(PKM pk, EvoCriteria evo); /// /// Checks if the potential match may not be a perfect match (might be a better match later during iteration). /// EncounterMatchRating GetMatchRating(PKM pk); } internal static class EncounterMatchExtensions { /// /// Some species do not have a Hidden Ability, but can be altered to have the HA slot via pre-evolution. /// /// Match object /// Species ID /// True if it should not originate as this species. private static bool IsPartialMatchHidden(this IEncounterMatch _, ushort species) { return species is (int)Metapod or (int)Kakuna or (int)Pupitar or (int)Silcoon or (int)Cascoon or (int)Vibrava or (int)Flygon; } /// /// Some species do not have a Hidden Ability, but can be altered to have the HA slot via pre-evolution. /// /// Match object /// Current Species ID /// Original Species ID /// True if it should not originate as this species. public static bool IsPartialMatchHidden(this IEncounterMatch _, ushort current, ushort original) { if (current == original) return false; if (!_.IsPartialMatchHidden(original)) return false; return _.IsPartialMatchHidden(current); } }