diff --git a/PKHeX.Core/Legality/Evolutions/EvolutionSets/EvolutionSet4.cs b/PKHeX.Core/Legality/Evolutions/EvolutionSets/EvolutionSet4.cs deleted file mode 100644 index 898a4389f..000000000 --- a/PKHeX.Core/Legality/Evolutions/EvolutionSets/EvolutionSet4.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using static System.Buffers.Binary.BinaryPrimitives; - -namespace PKHeX.Core; - -/// -/// Generation 4 Evolution Branch Entries -/// -public static class EvolutionSet4 -{ - private static EvolutionMethod GetMethod(ReadOnlySpan data) - { - var method = data[0]; // other byte unnecessary - var arg = ReadUInt16LittleEndian(data[2..]); - var species = ReadUInt16LittleEndian(data[4..]); - - if (method == 0) - throw new ArgumentOutOfRangeException(nameof(method)); - - // To have the same structure as gen 6 - // Gen 4 Method 6 is Gen 6 Method 7, G4 7 = G6 8, and so on - if (method > 6) - method++; - - var lvl = EvolutionSet6.IsMethodWithArg(method) ? 0 : arg; - var type = (EvolutionType)method; - var lvlup = type.IsLevelUpRequired() ? (byte)1 : (byte)0; - return new EvolutionMethod(type, species, Argument: arg, Level: (byte)lvl, LevelUp: lvlup); - } - - private const int bpe = 6; // bytes per evolution entry - private const int entries = 7; // amount of entries per species - private const int size = (entries * bpe) + 2; // bytes per species entry, + 2 alignment bytes - - public static EvolutionMethod[][] GetArray(ReadOnlySpan data) - { - var result = new EvolutionMethod[data.Length / size][]; - for (int i = 0, offset = 0; i < result.Length; i++, offset += size) - result[i] = GetEntry(data.Slice(offset, size)); - return result; - } - - private static EvolutionMethod[] GetEntry(ReadOnlySpan data) - { - int count = ScanCountEvolutions(data); - if (count == 0) - return Array.Empty(); - - var result = new EvolutionMethod[count]; - for (int i = 0, offset = 0; i < result.Length; i++, offset += bpe) - result[i] = GetMethod(data.Slice(offset, bpe)); - return result; - } - - private static int ScanCountEvolutions(ReadOnlySpan data) - { - for (int count = 0; count < entries; count++) - { - var methodOffset = count * bpe; - var method = data[methodOffset]; - if (method == 0) - return count; - } - return entries; - } -} diff --git a/PKHeX.Core/Legality/Evolutions/EvolutionSets/EvolutionSet5.cs b/PKHeX.Core/Legality/Evolutions/EvolutionSets/EvolutionSet5.cs index 6235f32b7..1273e2792 100644 --- a/PKHeX.Core/Legality/Evolutions/EvolutionSets/EvolutionSet5.cs +++ b/PKHeX.Core/Legality/Evolutions/EvolutionSets/EvolutionSet5.cs @@ -13,10 +13,6 @@ private static EvolutionMethod GetMethod(ReadOnlySpan data) var method = data[0]; // other byte unnecessary var arg = ReadUInt16LittleEndian(data[2..]); var species = ReadUInt16LittleEndian(data[4..]); - - if (method == 0) - throw new ArgumentOutOfRangeException(nameof(method)); - var lvl = EvolutionSet6.IsMethodWithArg(method) ? 0 : arg; var type = (EvolutionType)method; var lvlup = type.IsLevelUpRequired() ? (byte)1 : (byte)0; @@ -24,38 +20,23 @@ private static EvolutionMethod GetMethod(ReadOnlySpan data) } private const int bpe = 6; // bytes per evolution entry - private const int entries = 7; // amount of entries per species - private const int size = entries * bpe; // bytes per species entry - public static EvolutionMethod[][] GetArray(ReadOnlySpan data) + public static EvolutionMethod[][] GetArray(BinLinkerAccessor data) { - var result = new EvolutionMethod[data.Length / size][]; - for (int i = 0, offset = 0; i < result.Length; i++, offset += size) - result[i] = GetEntry(data.Slice(offset, size)); + var result = new EvolutionMethod[data.Length][]; + for (int i = 0; i < result.Length; i++) + result[i] = GetEntry(data[i]); return result; } private static EvolutionMethod[] GetEntry(ReadOnlySpan data) { - var count = ScanCountEvolutions(data); - if (count == 0) + if (data.Length == 0) return Array.Empty(); - var result = new EvolutionMethod[count]; + var result = new EvolutionMethod[data.Length / bpe]; for (int i = 0, offset = 0; i < result.Length; i++, offset += bpe) result[i] = GetMethod(data.Slice(offset, bpe)); return result; } - - private static int ScanCountEvolutions(ReadOnlySpan data) - { - for (int count = 0; count < entries; count++) - { - var methodOffset = count * bpe; - var method = data[methodOffset]; - if (method == 0) - return count; - } - return entries; - } } diff --git a/PKHeX.Core/Legality/Evolutions/EvolutionTree.cs b/PKHeX.Core/Legality/Evolutions/EvolutionTree.cs index fbbe0aa20..c51cb6d59 100644 --- a/PKHeX.Core/Legality/Evolutions/EvolutionTree.cs +++ b/PKHeX.Core/Legality/Evolutions/EvolutionTree.cs @@ -14,8 +14,8 @@ public sealed class EvolutionTree : EvolutionNetwork public static readonly EvolutionTree Evolves1 = GetViaSpecies (PersonalTable.Y, EvolutionSet1.GetArray(GetResource("rby"), 151)); public static readonly EvolutionTree Evolves2 = GetViaSpecies (PersonalTable.C, EvolutionSet1.GetArray(GetResource("gsc"), 251)); public static readonly EvolutionTree Evolves3 = GetViaSpecies (PersonalTable.RS, EvolutionSet3.GetArray(GetResource("g3"))); - public static readonly EvolutionTree Evolves4 = GetViaSpecies (PersonalTable.DP, EvolutionSet4.GetArray(GetResource("g4"))); - public static readonly EvolutionTree Evolves5 = GetViaSpecies (PersonalTable.BW, EvolutionSet5.GetArray(GetResource("g5"))); + public static readonly EvolutionTree Evolves4 = GetViaSpecies (PersonalTable.DP, EvolutionSet5.GetArray(GetReader("g4"))); + public static readonly EvolutionTree Evolves5 = GetViaSpecies (PersonalTable.BW, EvolutionSet5.GetArray(GetReader("g5"))); public static readonly EvolutionTree Evolves6 = GetViaSpecies (PersonalTable.AO, EvolutionSet6.GetArray(GetReader("ao"))); public static readonly EvolutionTree Evolves7 = GetViaPersonal(PersonalTable.USUM, EvolutionSet7.GetArray(GetReader("uu"))); public static readonly EvolutionTree Evolves7b = GetViaPersonal(PersonalTable.GG, EvolutionSet7.GetArray(GetReader("gg"))); diff --git a/PKHeX.Core/Legality/Verifiers/NicknameVerifier.cs b/PKHeX.Core/Legality/Verifiers/NicknameVerifier.cs index 9f5d4fe20..2372d3d03 100644 --- a/PKHeX.Core/Legality/Verifiers/NicknameVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/NicknameVerifier.cs @@ -412,6 +412,14 @@ private static void VerifyTrade8b(LegalityAnalysis data, EncounterTrade8b t) if (lang == 0) // err data.AddLine(GetInvalid(string.Format(LOTLanguage, $"{Japanese}/{German}", $"{(LanguageID)pk.Language}"), CheckIdentifier.Language)); } + + if (t.Species == (int)Species.Chatot && pk.Language == (int)French) + { + // NgWord disallows the French nickname (Pijouk) and resets it back to default (Pijako). + // Let it be anything (Nicknamed or not) and just verify the OT. + VerifyTradeOTOnly(data, t); + return; + } VerifyTrade(data, t, lang); } diff --git a/PKHeX.Core/Resources/byte/evolve/evos_g4.pkl b/PKHeX.Core/Resources/byte/evolve/evos_g4.pkl index 75c68458c..a5bc3ef0b 100644 Binary files a/PKHeX.Core/Resources/byte/evolve/evos_g4.pkl and b/PKHeX.Core/Resources/byte/evolve/evos_g4.pkl differ diff --git a/PKHeX.Core/Resources/byte/evolve/evos_g5.pkl b/PKHeX.Core/Resources/byte/evolve/evos_g5.pkl index 5c1627a14..52b0cd5f7 100644 Binary files a/PKHeX.Core/Resources/byte/evolve/evos_g5.pkl and b/PKHeX.Core/Resources/byte/evolve/evos_g5.pkl differ diff --git a/PKHeX.Core/Resources/legality/wild/encounter_go_home.pkl b/PKHeX.Core/Resources/legality/wild/encounter_go_home.pkl index 71d10bc0d..3c3e7d413 100644 Binary files a/PKHeX.Core/Resources/legality/wild/encounter_go_home.pkl and b/PKHeX.Core/Resources/legality/wild/encounter_go_home.pkl differ diff --git a/PKHeX.Core/Resources/legality/wild/encounter_go_lgpe.pkl b/PKHeX.Core/Resources/legality/wild/encounter_go_lgpe.pkl index d6e57ef97..f6627b193 100644 Binary files a/PKHeX.Core/Resources/legality/wild/encounter_go_lgpe.pkl and b/PKHeX.Core/Resources/legality/wild/encounter_go_lgpe.pkl differ