mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-14 16:27:21 +00:00
Handle bred Oricorio original tera type eggs
This commit is contained in:
parent
d904bfad4c
commit
00e174d240
3 changed files with 33 additions and 12 deletions
|
@ -57,11 +57,29 @@ public static class Tera9RNG
|
|||
}
|
||||
throw new ArgumentOutOfRangeException(nameof(gem), gem, null);
|
||||
}
|
||||
|
||||
private static bool IsMatchType(IPersonalType pi, in byte original) => original == pi.Type1 || original == pi.Type2;
|
||||
|
||||
public static bool IsMatchTeraTypePersonal(in ushort species, in byte form, in byte original)
|
||||
public static bool IsMatchTeraTypePersonalEgg(in ushort species, in byte form, in byte original) =>
|
||||
FormInfo.IsFormChangeEgg(species)
|
||||
? IsMatchTeraTypePersonalAnyForm(species, original)
|
||||
: IsMatchTeraTypePersonal(species, form, original);
|
||||
|
||||
public static bool IsMatchTeraTypePersonal(in ushort species, in byte form, in byte original) => IsMatchType(PersonalTable.SV[species, form], original);
|
||||
public static bool IsMatchTeraTypePersonalAnyForm(in ushort species, in byte original)
|
||||
{
|
||||
var pi = PersonalTable.SV[species, form];
|
||||
return original == pi.Type1 || original == pi.Type2;
|
||||
var pt = PersonalTable.SV;
|
||||
var pi = pt.GetFormEntry(species, 0);
|
||||
if (pi.IsPresentInGame && IsMatchType(pi, original))
|
||||
return true;
|
||||
var fc = pi.FormCount;
|
||||
for (byte form = 1; form < fc; form++)
|
||||
{
|
||||
pi = pt.GetFormEntry(species, form);
|
||||
if (pi.IsPresentInGame && IsMatchType(pi, original))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static byte GetTeraTypeFromPersonal(in ushort species, in byte form, in ulong pivot)
|
||||
|
|
|
@ -109,17 +109,23 @@ public static class FormInfo
|
|||
return false;
|
||||
}
|
||||
|
||||
public static bool IsFormChangeEgg(ushort species) => System.Array.IndexOf(FormChangeEgg, species) != -1;
|
||||
|
||||
private static readonly ushort[] FormChangeEgg =
|
||||
{
|
||||
(int)Burmy,
|
||||
(int)Furfrou,
|
||||
(int)Oricorio,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Species that can change between their forms, regardless of origin.
|
||||
/// </summary>
|
||||
/// <remarks>Excludes Zygarde as it has special conditions. Check separately.</remarks>
|
||||
private static readonly HashSet<ushort> FormChange = new()
|
||||
private static readonly HashSet<ushort> FormChange = new(FormChangeEgg)
|
||||
{
|
||||
// Sometimes considered for wild encounters
|
||||
(int)Burmy,
|
||||
(int)Rotom,
|
||||
(int)Furfrou,
|
||||
(int)Oricorio,
|
||||
|
||||
(int)Deoxys,
|
||||
(int)Dialga,
|
||||
|
|
|
@ -148,16 +148,13 @@ public sealed class MiscVerifier : Verifier
|
|||
if (enc is EncounterEgg g && UnreleasedSV.Contains(g.Species | g.Form << 11))
|
||||
data.AddLine(GetInvalid(LTransferBad));
|
||||
|
||||
var expectObey = enc is IObedienceLevelReadOnly l ? l.Obedience_Level : Math.Max(1, pk9.Met_Level);
|
||||
var current = pk9.Obedience_Level;
|
||||
if (!IsObedienceLevelValid(pk9, current, expectObey))
|
||||
if (!IsObedienceLevelValid(pk9, pk9.Obedience_Level, pk9.Met_Level))
|
||||
data.AddLine(GetInvalid(LTransferObedienceLevel));
|
||||
|
||||
if (pk9.Tracker != 0)
|
||||
data.AddLine(GetInvalid(LTransferTrackerShouldBeZero));
|
||||
|
||||
bool onlyDefaultTeraType = enc.Context is not EntityContext.Gen9 || enc is EncounterEgg;
|
||||
if (onlyDefaultTeraType && !Tera9RNG.IsMatchTeraTypePersonal(enc.Species, enc.Form, (byte)pk9.TeraTypeOriginal))
|
||||
if (enc is EncounterEgg && !Tera9RNG.IsMatchTeraTypePersonalEgg(enc.Species, enc.Form, (byte)pk9.TeraTypeOriginal))
|
||||
data.AddLine(GetInvalid(LTeraTypeMismatch));
|
||||
|
||||
VerifyTechRecordSV(data, pk9);
|
||||
|
|
Loading…
Reference in a new issue