mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 12:33:06 +00:00
verifyEncounterG3Transfer function
For gen 3 transfer pokemon it checks the non egg possible encounter and if the pokemon could have been hatched egg encounter Return the result from one of the two encounters that is valid, with non egg preference but marking WasEgg a True if it can be from an egg In verify moves both possible encounters are considered, there is no way to discart one or another
This commit is contained in:
parent
286c8524d5
commit
7f21973038
1 changed files with 53 additions and 13 deletions
|
@ -729,7 +729,12 @@ namespace PKHeX.Core
|
||||||
if (result != null)
|
if (result != null)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pkm.Gen3 && !pkm.HasOriginalMetLocation)
|
||||||
|
{
|
||||||
|
return verifyEncounterG3Transfer();
|
||||||
|
}
|
||||||
|
|
||||||
if (null != (EncounterMatch = Legal.getValidStaticEncounter(pkm)))
|
if (null != (EncounterMatch = Legal.getValidStaticEncounter(pkm)))
|
||||||
{
|
{
|
||||||
var result = verifyEncounterStatic();
|
var result = verifyEncounterStatic();
|
||||||
|
@ -739,18 +744,7 @@ namespace PKHeX.Core
|
||||||
EncounterMatch = null; // Reset Encounter Object, test for remaining encounters
|
EncounterMatch = null; // Reset Encounter Object, test for remaining encounters
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pkm.Gen3 && !pkm.HasOriginalMetLocation)
|
if (pkm.WasEgg)
|
||||||
{
|
|
||||||
bool WasEgg = Legal.getWasEgg23(pkm) && !Legal.NoHatchFromEgg.Contains(pkm.Species);
|
|
||||||
if(WasEgg)
|
|
||||||
{
|
|
||||||
pkm.WasEgg = true;
|
|
||||||
var v = verifyEncounterEgg();
|
|
||||||
if (v.Valid)
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (pkm.WasEgg)
|
|
||||||
return verifyEncounterEgg();
|
return verifyEncounterEgg();
|
||||||
|
|
||||||
if (null != (EncounterMatch = Legal.getValidFriendSafari(pkm)))
|
if (null != (EncounterMatch = Legal.getValidFriendSafari(pkm)))
|
||||||
|
@ -766,6 +760,52 @@ namespace PKHeX.Core
|
||||||
? new CheckResult(Severity.Invalid, V78, CheckIdentifier.Encounter)
|
? new CheckResult(Severity.Invalid, V78, CheckIdentifier.Encounter)
|
||||||
: new CheckResult(Severity.Invalid, V80, CheckIdentifier.Encounter);
|
: new CheckResult(Severity.Invalid, V80, CheckIdentifier.Encounter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private CheckResult verifyEncounterG3Transfer()
|
||||||
|
{
|
||||||
|
CheckResult EggResult = null;
|
||||||
|
CheckResult NonEggResult = null;
|
||||||
|
bool WasEgg = Legal.getWasEgg23(pkm) && !Legal.NoHatchFromEgg.Contains(pkm.Species);
|
||||||
|
if (WasEgg)
|
||||||
|
{
|
||||||
|
pkm.WasEgg = true;
|
||||||
|
EggResult = verifyEncounterEgg3Transfer();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null != (EncounterMatch = Legal.getValidStaticEncounter(pkm)))
|
||||||
|
{
|
||||||
|
NonEggResult = verifyEncounterStatic();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NonEggResult !=null)
|
||||||
|
{
|
||||||
|
EncounterMatch = null; // Reset Encounter Object, test for remaining encounters
|
||||||
|
if (null != (EncounterMatch = Legal.getValidWildEncounters(pkm)))
|
||||||
|
NonEggResult = verifyEncounterWild();
|
||||||
|
|
||||||
|
if (null != (EncounterMatch = Legal.getValidIngameTrade(pkm)))
|
||||||
|
NonEggResult = verifyEncounterTrade();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Even if EggResult is not returned WasEgg is keep true to check in verifymoves first the
|
||||||
|
// non egg encounter moves and after that egg encounter moves, because there is no way to tell
|
||||||
|
// what of the two encounters was the real origin
|
||||||
|
if (EggResult != null && NonEggResult!=null)
|
||||||
|
{
|
||||||
|
// Return the valid result of both, with non egg preference,
|
||||||
|
// there is more data in the pkm for non egg encounters
|
||||||
|
if (NonEggResult.Valid)
|
||||||
|
return NonEggResult;
|
||||||
|
if (EggResult.Valid)
|
||||||
|
return EggResult;
|
||||||
|
// if both are invalid returns non egg information, because
|
||||||
|
// there is more data in the pokemon to found normal encounter
|
||||||
|
return NonEggResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NonEggResult ?? EggResult;
|
||||||
|
|
||||||
|
}
|
||||||
private CheckResult verifyVCEncounter(int baseSpecies)
|
private CheckResult verifyVCEncounter(int baseSpecies)
|
||||||
{
|
{
|
||||||
// Sanitize Species to non-future species#
|
// Sanitize Species to non-future species#
|
||||||
|
|
Loading…
Reference in a new issue