Minor tweaks

Check egg encounter for state rather than re-deriving some properties on the fly
Only check memories if memories are exposed
Remove debug assert (not always true?)
This commit is contained in:
Kurt 2020-08-04 22:56:55 -07:00
parent 00443dcae4
commit ad6728fb5c
5 changed files with 10 additions and 9 deletions

View file

@ -327,7 +327,9 @@ namespace PKHeX.Core
ConsoleRegion.Verify(this); // Gen 7->8 transfer deletes geolocation tracking data
History.Verify(this);
Memory.Verify(this);
if (pkm is ITrainerMemories)
Memory.Verify(this);
if (pkm is ISuperTrain)
Medal.Verify(this);

View file

@ -261,7 +261,7 @@ namespace PKHeX.Core
LearnLevel = Math.Min(LearnLevel, info.EncounterMatch.LevelMin);
// If the encounter is a player hatched egg check if the move could be an egg move or inherited level up move
if (info.EncounterMatch.EggEncounter && !pkm.WasGiftEgg && !pkm.WasEventEgg && allowegg)
if (info.EncounterMatch is EncounterEgg)
{
if (IsMoveInherited(pkm, info, moves))
LearnLevel = Math.Min(LearnLevel, gen <= 3 ? 6 : 2);

View file

@ -306,7 +306,7 @@ namespace PKHeX.Core
ParseMovesByGeneration(pkm, res, gen, info, learnInfo);
if (gen == last)
ParseMovesByGenerationLast(pkm, res, gen, learnInfo);
ParseMovesByGenerationLast(pkm, res, gen, learnInfo, info.EncounterMatch);
switch (gen)
{
@ -403,11 +403,11 @@ namespace PKHeX.Core
}
}
private static void ParseMovesByGenerationLast(PKM pkm, CheckMoveResult[] res, int gen, LearnInfo learnInfo)
private static void ParseMovesByGenerationLast(PKM pkm, CheckMoveResult[] res, int gen, LearnInfo learnInfo, IEncounterable enc)
{
ParseEggMovesInherited(pkm, res, gen, learnInfo);
ParseEggMoves(pkm, res, gen, learnInfo);
ParseEggMovesRemaining(pkm, res, learnInfo);
ParseEggMovesRemaining(pkm, res, learnInfo, enc);
}
private static void ParseEggMovesInherited(PKM pkm, CheckMoveResult[] res, int gen, LearnInfo learnInfo)
@ -492,7 +492,7 @@ namespace PKHeX.Core
}
}
private static void ParseEggMovesRemaining(PKM pkm, CheckMoveResult[] res, LearnInfo learnInfo)
private static void ParseEggMovesRemaining(PKM pkm, CheckMoveResult[] res, LearnInfo learnInfo, IEncounterable enc)
{
// A pokemon could have normal egg moves and regular egg moves
// Only if all regular egg moves are event egg moves or all event egg moves are regular egg moves
@ -513,7 +513,7 @@ namespace PKHeX.Core
res[m] = new CheckMoveResult(res[m], Invalid, LMoveEventEggLevelUp, Move);
}
}
else if (RegularEggMovesLearned.Count != 0 && (pkm.WasGiftEgg || pkm.WasEventEgg))
else if (!(enc is EncounterEgg))
{
// Event eggs cannot inherit moves from parents; they are not bred.
foreach (int m in RegularEggMovesLearned)

View file

@ -276,7 +276,7 @@ namespace PKHeX.Core
data.AddLine(commonResult);
}
private static bool WasTradedSWSHEgg(PKM pkm) => pkm.Gen8 && (pkm.WasTradedEgg || pkm.WasBredEgg);
private static bool WasTradedSWSHEgg(PKM pkm) => pkm.Gen8 && pkm.WasBredEgg;
private void VerifyHTMemoryTransferTo7(LegalityAnalysis data, PKM pkm, LegalInfo Info)
{

View file

@ -14,7 +14,6 @@ namespace PKHeX.Core
{
MaxLength = data.Length;
int eCount = data.Length/SIZE_ENTRY;
Debug.Assert(MaxCount == eCount);
Entries = new ShadowInfoEntryXD[eCount];
for (int i = 0; i < eCount; i++)
{