Fix Sirfetch'd deferral, add Tera deferral

Marill and Azurill need deferral cases as they change primary type
(normal-fairy => fairy || water-fairy => water)
This commit is contained in:
Kurt 2024-11-10 15:32:57 -06:00
parent e4e3d929a0
commit 947bbc7274

View file

@ -231,11 +231,15 @@ public sealed record EncounterSlot8GO(int StartDate, int EndDate, ushort Species
return EncounterMatchRating.PartialMatch;
if (Species is (int)Farfetchd && IsReallySirfetchd(pk))
return EncounterMatchRating.DeferredErrors;
if (pk is ITeraType ro && IsTeraTypeMismatch(ro.TeraTypeOriginal, PersonalTable.SV[Species, Form]))
return EncounterMatchRating.DeferredErrors;
if (!this.GetIVsValid(pk))
return EncounterMatchRating.Deferred;
return EncounterMatchRating.Match;
}
private static bool IsTeraTypeMismatch(MoveType original, PersonalInfo9SV pi) => original != TeraTypeUtil.GetTeraTypeImport(pi.Type1, pi.Type2);
/// <summary>
/// Checks if a Farfetch'd was originally a Sirfetch'd.
/// </summary>
@ -250,8 +254,8 @@ public sealed record EncounterSlot8GO(int StartDate, int EndDate, ushort Species
return false; // can't tell if it was originally Farfetch'd
Span<char> name = stackalloc char[pk.TrashCharCountNickname];
pk.LoadString(pk.NicknameTrash, name);
return name is "Sirfetch'd"; // only way to get the bad apostrophe is to originate in HOME with it.
int length = pk.LoadString(pk.NicknameTrash, name);
return name[..length] is "Sirfetch'd"; // only way to get the bad apostrophe is to originate in HOME with it.
}
public byte OriginalTrainerFriendship => Species switch