Handle BDSP eggs not having any trash

This commit is contained in:
Kurt 2024-06-05 23:53:01 -05:00
parent de6c1baaf2
commit 114ba4c991

View file

@ -86,9 +86,17 @@ public sealed class TrashByteVerifier : Verifier
VerifyTrashNotEmpty(data, pk.HandlingTrainerTrash, HandlingTrainer);
VerifyTrashNone(data, pk.OriginalTrainerTrash, OriginalTrainer);
if (IsTrashCleanContext(pk.Context))
{
VerifyTrashNone(data, pk.NicknameTrash, Nickname);
VerifyTrashNone(data, pk.HandlingTrainerTrash, HandlingTrainer);
}
else
{
// Species name is overwritten by "Egg"
var origName = SpeciesName.GetSpeciesName(pk.Species, pk.Language);
VerifyTrashSpecific(data, pk.NicknameTrash, origName, Nickname);
}
return;
}
@ -112,6 +120,11 @@ public sealed class TrashByteVerifier : Verifier
}
}
private static bool IsTrashCleanContext(EntityContext context)
{
return context is EntityContext.Gen8b;
}
private void VerifyTrashNickname(LegalityAnalysis data, ReadOnlySpan<byte> span)
{
var pk = data.Entity;