Rework partialmatch hidden check

Want to check if it has been evolved from the original species, and the current species is a non-changeable hidden ability
This commit is contained in:
Kurt 2021-02-01 20:45:48 -08:00
parent 5ef1850e46
commit a7afa58156
3 changed files with 19 additions and 3 deletions

View file

@ -205,7 +205,7 @@ namespace PKHeX.Core
if (pkm.Format >= 5)
{
bool isHidden = pkm.AbilityNumber == 4;
if (isHidden && this.IsPartialMatchHidden(Species))
if (isHidden && this.IsPartialMatchHidden(pkm.Species, Species))
return EncounterMatchRating.PartialMatch;
if (IsDeferredHiddenAbility(isHidden))
return EncounterMatchRating.Deferred;

View file

@ -305,7 +305,7 @@ namespace PKHeX.Core
protected virtual bool IsMatchPartial(PKM pkm)
{
if (pkm.Format >= 5 && pkm.AbilityNumber == 4 && this.IsPartialMatchHidden(Species))
if (pkm.Format >= 5 && pkm.AbilityNumber == 4 && this.IsPartialMatchHidden(pkm.Species, Species))
return true;
return pkm.FatefulEncounter != Fateful;
}

View file

@ -16,12 +16,28 @@ namespace PKHeX.Core
/// <param name="_">Match object</param>
/// <param name="species">Species ID</param>
/// <returns>True if it should not originate as this species.</returns>
public static bool IsPartialMatchHidden(this IEncounterMatch _, int species)
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);
}
}
}