mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-19 08:53:28 +00:00
fc754b346b
[Language Reference](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces) Updates all the files, one less level of indentation. Some small changes were made to API surfaces, renaming `PKM pkm` -> `PKM pk`, and `LegalityAnalysis.pkm` -> `LegalityAnalysis.Entity`
52 lines
1.9 KiB
C#
52 lines
1.9 KiB
C#
using static PKHeX.Core.Species;
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
/// <summary>
|
|
/// Exposes details about the quality of a potential match compared to an input <see cref="PKM"/>.
|
|
/// </summary>
|
|
public interface IEncounterMatch
|
|
{
|
|
/// <summary>
|
|
/// Checks if the implementing object's details might have been the originator of the current <see cref="pk"/> data.
|
|
/// </summary>
|
|
bool IsMatchExact(PKM pk, EvoCriteria evo);
|
|
|
|
/// <summary>
|
|
/// Checks if the potential match may not be a perfect match (might be a better match later during iteration).
|
|
/// </summary>
|
|
EncounterMatchRating GetMatchRating(PKM pk);
|
|
}
|
|
|
|
internal static class EncounterMatchExtensions
|
|
{
|
|
/// <summary>
|
|
/// Some species do not have a Hidden Ability, but can be altered to have the HA slot via pre-evolution.
|
|
/// </summary>
|
|
/// <param name="_">Match object</param>
|
|
/// <param name="species">Species ID</param>
|
|
/// <returns>True if it should not originate as this species.</returns>
|
|
private static bool IsPartialMatchHidden(this IEncounterMatch _, int species)
|
|
{
|
|
return species is (int)Metapod or (int)Kakuna
|
|
or (int)Pupitar
|
|
or (int)Silcoon or (int)Cascoon
|
|
or (int)Vibrava or (int)Flygon;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Some species do not have a Hidden Ability, but can be altered to have the HA slot via pre-evolution.
|
|
/// </summary>
|
|
/// <param name="_">Match object</param>
|
|
/// <param name="current">Current Species ID</param>
|
|
/// <param name="original">Original Species ID</param>
|
|
/// <returns>True if it should not originate as this species.</returns>
|
|
public static bool IsPartialMatchHidden(this IEncounterMatch _, int current, int original)
|
|
{
|
|
if (current == original)
|
|
return false;
|
|
if (!_.IsPartialMatchHidden(original))
|
|
return false;
|
|
return _.IsPartialMatchHidden(current);
|
|
}
|
|
}
|