Skip to content

Commit

Permalink
Post-check defer if catchrate disallows tradeback
Browse files Browse the repository at this point in the history
Closes #3412
  • Loading branch information
kwsch committed Feb 8, 2022
1 parent a705110 commit e12f300
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions PKHeX.Core/Legality/Encounters/Generator/EncounterFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ private static bool VerifySecondaryChecks(PKM pkm, LegalInfo info, PeekEnumerato
return false;
}
}
else if (pkm is PK1 pk1)
{
if (info.Moves.Any(z => z.Generation is not 1) && !PK1.IsCatchRateHeldItem(pk1.Catch_Rate))
return false;
}

info.Parse.Add(evo);
return true;
Expand Down
2 changes: 1 addition & 1 deletion PKHeX.Core/PKM/PK1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public override PKM Clone()
public override int Stat_SPD { get => Stat_SPC; set { } }
#endregion

private static bool IsCatchRateHeldItem(int rate) => ParseSettings.AllowGen1Tradeback && Array.IndexOf(Legal.HeldItems_GSC, (ushort)rate) >= 0;
public static bool IsCatchRateHeldItem(int rate) => ParseSettings.AllowGen1Tradeback && Array.IndexOf(Legal.HeldItems_GSC, (ushort)rate) >= 0;

private static bool IsCatchRatePreEvolutionRate(int baseSpecies, int finalSpecies, int rate)
{
Expand Down

0 comments on commit e12f300

Please sign in to comment.