Fix gen1/2 evo move edge case

Closes #1112
Encounter matched was set to an egg (err 1, core.cs), and the GB
encounter info was not set (err 2, checks.cs).

Fix by preventing eggs if Gen2 is disallowed (reuse allowg1tradeback),
and set the species if it is an egg (future case).

switch pidiv return to null, as it should always be null (not whatever
is returned by the last pidiv finder).
This commit is contained in:
Kurt
2017-05-09 19:07:21 -07:00
parent d0e2b7784a
commit 8154af64c3
3 changed files with 7 additions and 4 deletions

View File

@@ -797,12 +797,14 @@ private CheckResult verifyEncounterG12()
if (EncountersGBMatch == null)
return new CheckResult(Severity.Invalid, V80, CheckIdentifier.Encounter);
if (EncountersGBMatch.First().Type == GBEncounterType.EggEncounter)
var first = EncountersGBMatch.First();
if (first.Type == GBEncounterType.EggEncounter)
{
pkm.WasEgg = true;
EncounterOriginalGB = first.Species;
return verifyEncounterEgg();
}
EncounterMatch = EncounterOriginalGB = EncountersGBMatch.FirstOrDefault()?.Encounter;
EncounterMatch = EncounterOriginalGB = first.Encounter;
if (EncounterMatch is EncounterSlot)
return new CheckResult(Severity.Valid, V68, CheckIdentifier.Encounter);
if (EncounterMatch is EncounterStatic)

View File

@@ -15,6 +15,7 @@ public static partial class Legal
/// <summary>Setting to specify if an analysis should permit data sourced from the physical cartridge era of GameBoy games.</summary>
public static bool AllowGBCartEra = false;
public static bool AllowGen1Tradeback = false;
public static bool AllowGen2VCTransfer => AllowGen1Tradeback;
/// <summary>Setting to specify if the e-berry index item is an eningma berry or a e-reader berry and the name of the e-reader berry</summary>
public static bool EReaderBerryIsEnigma = true;
@@ -1967,7 +1968,7 @@ private static GBEncounterData getEncounter12(PKM pkm, GameVersion game)
internal static List<GBEncounterData> getEncounter12(PKM pkm)
{
var g1 = pkm.Gen2_NotTradeback ? null : getEncounter12(pkm, GameVersion.RBY);
var g2 = pkm.Gen1_NotTradeback ? null : getEncounter12(pkm, GameVersion.GSC);
var g2 = pkm.Gen1_NotTradeback || !AllowGen2VCTransfer ? null : getEncounter12(pkm, GameVersion.GSC);
if (g1 == null && g2 == null)
return null;
if (g1 == null || g2 == null)

View File

@@ -55,7 +55,7 @@ public static PIDIV Analyze(PKM pk)
if (getBACDMatch(pk, pid, IVs, out pidiv))
return pidiv;
return pidiv; // no match
return null; // no match
}
private static bool getLCRNGMatch(uint top, uint bot, uint[] IVs, out PIDIV pidiv)