mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-23 00:38:36 +00:00
parent
48ace3ca49
commit
e571a0b95f
4 changed files with 12 additions and 6 deletions
PKHeX.Core
Tests/PKHeX.Core.Tests/Legality/Legal/Generation 1 Only
|
@ -62,7 +62,7 @@
|
||||||
{
|
{
|
||||||
if (pkm is not PK1 pk1)
|
if (pkm is not PK1 pk1)
|
||||||
return false;
|
return false;
|
||||||
if (PK1.IsCatchRateHeldItem(pk1.Catch_Rate))
|
if (ParseSettings.AllowGen1Tradeback && PK1.IsCatchRateHeldItem(pk1.Catch_Rate))
|
||||||
return false;
|
return false;
|
||||||
if (IsCatchRateValid(pk1))
|
if (IsCatchRateValid(pk1))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -126,10 +126,16 @@ namespace PKHeX.Core
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (pkm is PK1 pk1 && !ParseSettings.AllowGen1Tradeback)
|
else if (pkm is PK1 pk1)
|
||||||
{
|
{
|
||||||
if (!Array.TrueForAll(info.Moves, z => z.Generation is 1) && !PK1.IsCatchRateHeldItem(pk1.Catch_Rate))
|
var hasGen2 = Array.Exists(info.Moves, z => z.Generation is not 1);
|
||||||
return false;
|
if (hasGen2)
|
||||||
|
{
|
||||||
|
if (!ParseSettings.AllowGen1Tradeback)
|
||||||
|
return false;
|
||||||
|
if (!PK1.IsCatchRateHeldItem(pk1.Catch_Rate))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
info.Parse.Add(evo);
|
info.Parse.Add(evo);
|
||||||
|
|
|
@ -80,7 +80,7 @@ namespace PKHeX.Core
|
||||||
public override int Stat_SPD { get => Stat_SPC; set { } }
|
public override int Stat_SPD { get => Stat_SPC; set { } }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public static bool IsCatchRateHeldItem(int rate) => ParseSettings.AllowGen1Tradeback && Array.IndexOf(Legal.HeldItems_GSC, (ushort)rate) >= 0;
|
public static bool IsCatchRateHeldItem(int rate) => rate == 0 || Array.IndexOf(Legal.HeldItems_GSC, (ushort)rate) >= 0;
|
||||||
|
|
||||||
private static bool IsCatchRatePreEvolutionRate(int baseSpecies, int finalSpecies, int rate)
|
private static bool IsCatchRatePreEvolutionRate(int baseSpecies, int finalSpecies, int rate)
|
||||||
{
|
{
|
||||||
|
@ -113,7 +113,7 @@ namespace PKHeX.Core
|
||||||
|
|
||||||
private static bool IsValidCatchRateAnyPreEvo(int species, int rate)
|
private static bool IsValidCatchRateAnyPreEvo(int species, int rate)
|
||||||
{
|
{
|
||||||
if (rate is 0 || IsCatchRateHeldItem(rate))
|
if (IsCatchRateHeldItem(rate))
|
||||||
return true;
|
return true;
|
||||||
if (species == (int)Core.Species.Pikachu && rate == 0xA3) // Light Ball (starter)
|
if (species == (int)Core.Species.Pikachu && rate == 0xA3) // Light Ball (starter)
|
||||||
return true;
|
return true;
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Reference in a new issue