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
This commit is contained in:
Kurt
2018-04-29 08:31:57 -07:00
parent 120f5380c9
commit 08603c5664
3 changed files with 15 additions and 15 deletions

View File

@@ -357,7 +357,7 @@ private static EncounterArea GetUnownArea(int location, IReadOnlyList<int> 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<int> 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<int> 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<int> 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<EncounterStatic> CloneMirorB(EncounterStatic arg)
{
yield return arg;

View File

@@ -32,7 +32,7 @@ public IEncounterable EncounterMatch
private IEncounterable _match;
/// <summary>Indicates whether or not the <see cref="PKM"/> originated from <see cref="GameVersion.XD"/>.</summary>
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;
/// <summary>Base Relearn Moves for the <see cref="EncounterMatch"/>.</summary>
public int[] RelearnBase { get; set; }

View File

@@ -282,7 +282,7 @@ private static IEnumerable<RibbonResult> 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);
}
}