Enhance traded eggs version sharing check

No longer indicate traded eggs from gen3 as sharing OT details.
This commit is contained in:
Kurt 2022-10-28 16:18:06 -07:00
parent e1f2a90c6b
commit 49d40d2e26

View File

@ -359,11 +359,20 @@ private static bool IsSharedVersion(PKM pp, LegalityAnalysis pa, PKM cp, Legalit
if (pa.Info.Generation != ca.Info.Generation)
return false;
if (pa.EncounterMatch.EggEncounter && pp.WasTradedEgg)
// Gen3/4 traded eggs do not have an Egg Location, and do not update the Version upon hatch.
// These eggs can obtain another trainer's TID/SID/OT and be valid with a different version ID.
if (pa.EncounterMatch.EggEncounter && IsTradedEggVersionNoUpdate(pp, pa))
return false; // version doesn't update on trade
if (ca.EncounterMatch.EggEncounter && cp.WasTradedEgg)
if (ca.EncounterMatch.EggEncounter && IsTradedEggVersionNoUpdate(cp, ca))
return false; // version doesn't update on trade
static bool IsTradedEggVersionNoUpdate(PKM pk, LegalityAnalysis la) => la.Info.Generation switch
{
3 => true, // No egg location, assume can be traded. Doesn't update version upon hatch.
4 => pk.WasTradedEgg, // Gen4 traded eggs do not update version upon hatch.
_ => false, // Gen5+ eggs have an egg location, and update the version upon hatch.
};
return true;
}