Memory 3 updates, revert todo

This commit is contained in:
Kurt 2021-08-22 23:39:23 -07:00
parent 3a8947cc59
commit 86fde6d42e
2 changed files with 12 additions and 5 deletions

View file

@ -32,7 +32,7 @@ namespace PKHeX.Core
if (KeyItemMemoryArgsGen6.Values.Any(z => z.Contains((ushort)item)))
return true;
return false;
return true; // todo
}
public override IEnumerable<ushort> GetMemoryItemParams() => Legal.HeldItem_AO.Distinct()

View file

@ -50,7 +50,7 @@ namespace PKHeX.Core
return false;
if (memory is 1 or 2 or 3) // Encounter only
return IsInvalidGenLoc8(memory, pk.Met_Location, pk.Egg_Location, variable, enc);
return IsInvalidGenLoc8(memory, pk.Met_Location, pk.Egg_Location, variable, pk, enc);
return IsInvalidGenLoc8Other(memory, variable);
}
@ -67,16 +67,16 @@ namespace PKHeX.Core
return PurchaseableItemSWSH.Contains((ushort)item);
}
private static bool IsInvalidGenLoc8(int memory, int loc, int egg, int variable, IEncounterTemplate enc)
private static bool IsInvalidGenLoc8(int memory, int loc, int egg, int variable, PKM pk, IEncounterTemplate enc)
{
if (variable > 255)
return true;
switch (memory)
{
case 1 when enc.EggEncounter:
case 1 when enc.EggEncounter || IsCurryEncounter(pk, enc):
case 2 when !enc.EggEncounter:
case 3 when enc is not (EncounterTrade or EncounterStatic {Gift: true} or WC8 {IsHOMEGift: false}):
case 3 when (enc is not (EncounterTrade or EncounterStatic {Gift: true} or WC8 {IsHOMEGift: false}) && !IsCurryEncounter(pk, enc)):
return true;
}
@ -94,6 +94,13 @@ namespace PKHeX.Core
return false;
}
private static bool IsCurryEncounter(PKM pk, IEncounterTemplate enc)
{
if (enc is not EncounterSlot8)
return false;
return pk is IRibbonSetMark8 { RibbonMarkCurry: true } || pk.Species == (int)Species.Shedinja;
}
private static bool IsInvalidGenLoc8Other(int memory, int variable)
{
if (variable > byte.MaxValue)