Change shininess check

Encounter definitions should be marked as Never Shiny or not in their definition, rather than assuming
This commit is contained in:
Kurt 2020-10-18 16:05:01 -07:00
parent cce4707604
commit 83171ab133
2 changed files with 16 additions and 2 deletions

View file

@ -32,7 +32,7 @@ namespace PKHeX.Core
return false;
// EC/PID check doesn't exist for these, so check Shiny state here.
if ((Shiny == Shiny.Always) != pkm.IsShiny)
if (!IsShinyValid(pkm))
return false;
if (TID != -1 && pkm.TID != TID)
@ -52,6 +52,13 @@ namespace PKHeX.Core
return true;
}
private bool IsShinyValid(PKM pkm) => Shiny switch
{
Shiny.Never => !pkm.IsShiny,
Shiny.Always => pkm.IsShiny,
_ => true
};
public override bool IsMatchDeferred(PKM pkm)
{
if (base.IsMatchDeferred(pkm))

View file

@ -37,7 +37,7 @@ namespace PKHeX.Core
return false;
// EC/PID check doesn't exist for these, so check Shiny state here.
if ((Shiny == Shiny.Always) != pkm.IsShiny && Location != 14) // Celebi is the only Wild "event", can be either.
if (!IsShinyValid(pkm))
return false;
if (EggEncounter && !pkm.IsEgg)
@ -61,6 +61,13 @@ namespace PKHeX.Core
return true;
}
private bool IsShinyValid(PKM pkm) => Shiny switch
{
Shiny.Never => !pkm.IsShiny,
Shiny.Always => pkm.IsShiny,
_ => true
};
public override bool IsMatchDeferred(PKM pkm)
{
if (base.IsMatchDeferred(pkm))