mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 12:33:06 +00:00
Simplify match rating return value choice
Ensure it is ordered Partial->DeferredErrors->Deferred->Match
This commit is contained in:
parent
b8394516d2
commit
c7ed55ab54
2 changed files with 21 additions and 8 deletions
|
@ -57,16 +57,22 @@ public sealed record EncounterSlot8a : EncounterSlot, IAlpha
|
|||
|
||||
public override EncounterMatchRating GetMatchRating(PKM pkm)
|
||||
{
|
||||
if (pkm is IAlpha a && a.IsAlpha != IsAlpha)
|
||||
return EncounterMatchRating.DeferredErrors;
|
||||
if (Gender is not Gender.Random && pkm.Gender != (int)Gender)
|
||||
return EncounterMatchRating.PartialMatch;
|
||||
|
||||
var result = GetMatchRatingInternal(pkm);
|
||||
var orig = base.GetMatchRating(pkm);
|
||||
return result > orig ? result : orig;
|
||||
}
|
||||
|
||||
private EncounterMatchRating GetMatchRatingInternal(PKM pkm)
|
||||
{
|
||||
if (pkm is IAlpha a && a.IsAlpha != IsAlpha)
|
||||
return EncounterMatchRating.DeferredErrors;
|
||||
if (FlawlessIVCount is not 0 && pkm.FlawlessIVCount < FlawlessIVCount)
|
||||
return EncounterMatchRating.DeferredErrors;
|
||||
|
||||
var result = GetAlphaMoveCompatibility(pkm);
|
||||
var orig = base.GetMatchRating(pkm);
|
||||
return result > orig ? result : orig;
|
||||
return GetAlphaMoveCompatibility(pkm);
|
||||
}
|
||||
|
||||
private EncounterMatchRating GetAlphaMoveCompatibility(PKM pkm)
|
||||
|
|
|
@ -93,15 +93,22 @@ public sealed record EncounterStatic8a(GameVersion Version) : EncounterStatic(Ve
|
|||
}
|
||||
|
||||
public override EncounterMatchRating GetMatchRating(PKM pkm)
|
||||
{
|
||||
if (!IsForcedMasteryCorrect(pkm))
|
||||
return EncounterMatchRating.PartialMatch;
|
||||
|
||||
var result = GetMatchRatingInternal(pkm);
|
||||
var orig = base.GetMatchRating(pkm);
|
||||
return result > orig ? result : orig;
|
||||
}
|
||||
|
||||
private EncounterMatchRating GetMatchRatingInternal(PKM pkm)
|
||||
{
|
||||
if (Shiny != Shiny.Random && !Shiny.IsValid(pkm))
|
||||
return EncounterMatchRating.DeferredErrors;
|
||||
if (Gift && pkm.Ball != Ball)
|
||||
return EncounterMatchRating.DeferredErrors;
|
||||
|
||||
if (!IsForcedMasteryCorrect(pkm))
|
||||
return EncounterMatchRating.PartialMatch;
|
||||
|
||||
var orig = base.GetMatchRating(pkm);
|
||||
if (orig is not EncounterMatchRating.Match)
|
||||
return orig;
|
||||
|
|
Loading…
Reference in a new issue