From 08603c56643c213f58809de4d339ca3e4ddcb5d9 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 29 Apr 2018 08:31:57 -0700 Subject: [PATCH] Fix xd miror b encounters not receiving versionID version was set to Encounter_XD, which did not contain the miror b encounters. simplify XD check to be O(1) now that version is stored in the encounter obj --- .../Legality/Encounters/Data/Encounters3.cs | 26 +++++++++---------- PKHeX.Core/Legality/Encounters/LegalInfo.cs | 2 +- PKHeX.Core/Legality/Ribbons/RibbonVerifier.cs | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters3.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters3.cs index a883aa6a5..42fb96092 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Encounters3.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Encounters3.cs @@ -357,7 +357,7 @@ private static EncounterArea GetUnownArea(int location, IReadOnlyList SlotF #endregion #region Colosseum - internal static readonly EncounterStatic[] Encounter_Colo = + private static readonly EncounterStatic[] Encounter_Colo = { // Colosseum Starters: Gender locked to male new EncounterStatic { Gift = true, Species = 196, Level = 25, Location = 254, Gender = 0 }, // Espeon @@ -462,7 +462,16 @@ private static EncounterArea GetUnownArea(int location, IReadOnlyList SlotF #region XD - internal static readonly EncounterStatic[] Encounter_XD = + private static readonly int[] MirorBXDLocations = + { + 090, // Rock + 091, // Oasis + 092, // Cave + 113, // Pyrite Town + 059, // Realgam Tower + }; + + private static readonly EncounterStatic[] Encounter_XD = new[] { new EncounterStatic { Fateful = true, Gift = true, Species = 133, Level = 10, Location = 000, Moves = new[] {044} }, // Eevee (Bite) new EncounterStatic { Fateful = true, Gift = true, Species = 152, Level = 05, Location = 016, Moves = new[] {246,033,045,338} }, // Chikorita @@ -577,7 +586,7 @@ private static EncounterArea GetUnownArea(int location, IReadOnlyList SlotF new EncounterStaticShadow { Fateful = true, Species = 144, Level = 50, Gauge = 10000, Moves = new[] {326,215,114,058}, Location = 074 }, // Articuno: Grand Master Greevil @ Citadark Isle new EncounterStaticShadow { Fateful = true, Species = 145, Level = 50, Gauge = 10000, Moves = new[] {326,226,319,085}, Location = 074 }, // Zapdos: Grand Master Greevil @ Citadark Isle new EncounterStaticShadow { Fateful = true, Species = 149, Level = 55, Gauge = 09000, Moves = new[] {063,215,349,089}, Location = 162 }, // Dragonite: Wanderer Miror B. @ Gateon Port - }; + }.SelectMany(CloneMirorB).ToArray(); internal static readonly EncounterArea[] SlotsXD = { @@ -603,16 +612,7 @@ private static EncounterArea GetUnownArea(int location, IReadOnlyList SlotF } }, }; - - private static readonly int[] MirorBXDLocations = - { - 090, // Rock - 091, // Oasis - 092, // Cave - 113, // Pyrite Town - 059, // Realgam Tower - }; - internal static readonly EncounterStatic[] Encounter_CXD = Encounter_Colo.Concat(Encounter_XD.SelectMany(CloneMirorB)).ToArray(); + internal static readonly EncounterStatic[] Encounter_CXD = ConcatAll(Encounter_Colo, Encounter_XD); private static IEnumerable CloneMirorB(EncounterStatic arg) { yield return arg; diff --git a/PKHeX.Core/Legality/Encounters/LegalInfo.cs b/PKHeX.Core/Legality/Encounters/LegalInfo.cs index 39b82222a..77ec2b45e 100644 --- a/PKHeX.Core/Legality/Encounters/LegalInfo.cs +++ b/PKHeX.Core/Legality/Encounters/LegalInfo.cs @@ -32,7 +32,7 @@ public IEncounterable EncounterMatch private IEncounterable _match; /// Indicates whether or not the originated from . - public bool WasXD => pkm?.Version == 15 && EncounterMatch != null && !Encounters3.Encounter_Colo.Contains(EncounterMatch); + public bool WasXD => pkm?.Version == 15 && EncounterMatch is IVersion v && v.Version == GameVersion.XD; /// Base Relearn Moves for the . public int[] RelearnBase { get; set; } diff --git a/PKHeX.Core/Legality/Ribbons/RibbonVerifier.cs b/PKHeX.Core/Legality/Ribbons/RibbonVerifier.cs index d519a7859..4d3a9cd97 100644 --- a/PKHeX.Core/Legality/Ribbons/RibbonVerifier.cs +++ b/PKHeX.Core/Legality/Ribbons/RibbonVerifier.cs @@ -282,7 +282,7 @@ private static IEnumerable GetInvalidRibbonsEvent1(PKM pkm, object if (pkm.Version == 15 && encounterContent is EncounterStaticShadow s) { // only require national ribbon if no longer on origin game - bool xd = !Encounters3.Encounter_Colo.Contains(s); + bool xd = s.Version == GameVersion.XD; eb[1] = !(xd && pkm is XK3 x && !x.RibbonNational || !xd && pkm is CK3 c && !c.RibbonNational); } }