mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-14 16:10:36 -05:00
Add verifyEncounterG4Transfer, is similar to gen3transfer but more simple, it just add an invalid transfer to gen 5 validation and return that if is wrong and there is no other wrong encounter result
This commit is contained in:
parent
25180a32c5
commit
8729ddf17a
|
|
@ -727,6 +727,11 @@ private CheckResult verifyEncounter()
|
|||
return verifyEncounterG3Transfer();
|
||||
}
|
||||
|
||||
if (pkm.Gen4 && !pkm.HasOriginalMetLocation)
|
||||
{
|
||||
return verifyEncounterG3Transfer();
|
||||
}
|
||||
|
||||
bool wasEvent = pkm.WasEvent || pkm.WasEventEgg;
|
||||
if (wasEvent)
|
||||
{
|
||||
|
|
@ -823,6 +828,57 @@ private CheckResult verifyEncounterG3Transfer()
|
|||
|
||||
return NonEggResult ?? InvalidTransferResult;
|
||||
}
|
||||
private CheckResult verifyEncounterG4Transfer()
|
||||
{
|
||||
CheckResult Gen4Result = null;
|
||||
CheckResult InvalidTransferResult = null;
|
||||
|
||||
var CrownLocation = -1;
|
||||
var AllowCrownLocation = pkm.Gen4 && pkm.FatefulEncounter && Legal.CrownBeasts.Contains(pkm.Species);
|
||||
if (AllowCrownLocation)
|
||||
CrownLocation = pkm.Species == 251 ? 30010 : 30012; // Celebi : Beast
|
||||
|
||||
if (pkm.Met_Location != 30001 && (!AllowCrownLocation || pkm.Met_Location != CrownLocation))
|
||||
InvalidTransferResult = new CheckResult(Severity.Invalid, V61, CheckIdentifier.Encounter);
|
||||
|
||||
bool wasEvent = pkm.WasEvent || pkm.WasEventEgg;
|
||||
if (wasEvent)
|
||||
{
|
||||
var result = verifyEncounterEvent();
|
||||
if (result != null)
|
||||
Gen4Result = result;
|
||||
}
|
||||
|
||||
if (Gen4Result == null && null != (EncounterMatch = Legal.getValidStaticEncounter(pkm)))
|
||||
{
|
||||
var result = verifyEncounterStatic();
|
||||
if (result != null)
|
||||
return result.Valid && InvalidTransferResult != null ? InvalidTransferResult : result;
|
||||
|
||||
EncounterMatch = null; // Reset Encounter Object, test for remaining encounters
|
||||
}
|
||||
|
||||
if (pkm.WasEgg) // Invalid transfer is already checked in encounter egg
|
||||
return verifyEncounterEgg();
|
||||
|
||||
if (Gen4Result == null && null != (EncounterMatch = Legal.getValidFriendSafari(pkm)))
|
||||
Gen4Result = verifyEncounterSafari();
|
||||
|
||||
if (Gen4Result == null && null != (EncounterMatch = Legal.getValidWildEncounters(pkm)))
|
||||
Gen4Result = verifyEncounterWild();
|
||||
|
||||
if (Gen4Result == null && null != (EncounterMatch = Legal.getValidIngameTrade(pkm)))
|
||||
Gen4Result = verifyEncounterTrade();
|
||||
|
||||
if (Gen4Result != null && InvalidTransferResult != null)
|
||||
return Gen4Result.Valid ? InvalidTransferResult : Gen4Result;
|
||||
if (Gen4Result != null || InvalidTransferResult != null)
|
||||
return Gen4Result ?? InvalidTransferResult;
|
||||
|
||||
return wasEvent
|
||||
? new CheckResult(Severity.Invalid, V78, CheckIdentifier.Encounter)
|
||||
: new CheckResult(Severity.Invalid, V80, CheckIdentifier.Encounter);
|
||||
}
|
||||
private CheckResult verifyVCEncounter(int baseSpecies)
|
||||
{
|
||||
// Sanitize Species to non-future species#
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user