diff --git a/PKHeX.Core/Legality/Areas/EncounterArea.cs b/PKHeX.Core/Legality/Areas/EncounterArea.cs
index fbb65d7ef..1f237acab 100644
--- a/PKHeX.Core/Legality/Areas/EncounterArea.cs
+++ b/PKHeX.Core/Legality/Areas/EncounterArea.cs
@@ -6,12 +6,15 @@ namespace PKHeX.Core
///
/// Represents an Area where can be encountered, which contains a Location ID and data.
///
- public abstract class EncounterArea
+ public abstract class EncounterArea : IVersion
{
+ public GameVersion Version { get; }
public int Location { get; protected set; }
public SlotType Type { get; protected set; } = SlotType.Any;
public EncounterSlot[] Slots = Array.Empty();
+ protected EncounterArea(GameVersion game) => Version = game;
+
///
/// Gets the slots contained in the area that match the provided data.
///
diff --git a/PKHeX.Core/Legality/Areas/EncounterArea1.cs b/PKHeX.Core/Legality/Areas/EncounterArea1.cs
index d40873733..609973342 100644
--- a/PKHeX.Core/Legality/Areas/EncounterArea1.cs
+++ b/PKHeX.Core/Legality/Areas/EncounterArea1.cs
@@ -18,7 +18,7 @@ public static EncounterArea1[] GetAreas(byte[][] input, GameVersion game)
return result;
}
- private EncounterArea1(byte[] data, GameVersion game)
+ private EncounterArea1(byte[] data, GameVersion game) : base(game)
{
Location = data[0];
// 1 byte unused
@@ -34,7 +34,7 @@ private EncounterArea1(byte[] data, GameVersion game)
int slotNum = data[offset + 1];
int min = data[offset + 2];
int max = data[offset + 3];
- slots[i] = new EncounterSlot1(this, species, min, max, slotNum, game);
+ slots[i] = new EncounterSlot1(this, species, min, max, slotNum);
}
Slots = slots;
}
diff --git a/PKHeX.Core/Legality/Areas/EncounterArea2.cs b/PKHeX.Core/Legality/Areas/EncounterArea2.cs
index e9505f252..a33425bf0 100644
--- a/PKHeX.Core/Legality/Areas/EncounterArea2.cs
+++ b/PKHeX.Core/Legality/Areas/EncounterArea2.cs
@@ -25,7 +25,7 @@ public static EncounterArea2[] GetAreas(byte[][] input, GameVersion game)
return result;
}
- private EncounterArea2(byte[] data, GameVersion game)
+ private EncounterArea2(byte[] data, GameVersion game) : base(game)
{
Location = data[0];
Time = (EncounterTime)data[1];
@@ -42,7 +42,7 @@ private EncounterArea2(byte[] data, GameVersion game)
rates[i] = data[4 + i];
Rates = rates;
- Slots = ReadSlots(data, count, 4 + count, game);
+ Slots = ReadSlots(data, count, 4 + count);
}
else
{
@@ -51,11 +51,11 @@ private EncounterArea2(byte[] data, GameVersion game)
const int size = 4;
int count = (data.Length - 4) / size;
Rates = type == SlotType.BugContest ? BCC_SlotRates : (type == SlotType.Grass) ? RatesGrass : RatesSurf;
- Slots = ReadSlots(data, count, 4, game);
+ Slots = ReadSlots(data, count, 4);
}
}
- private EncounterSlot2[] ReadSlots(byte[] data, int count, int start, GameVersion game)
+ private EncounterSlot2[] ReadSlots(byte[] data, int count, int start)
{
var slots = new EncounterSlot2[count];
for (int i = 0; i < slots.Length; i++)
@@ -65,7 +65,7 @@ private EncounterSlot2[] ReadSlots(byte[] data, int count, int start, GameVersio
int slotNum = data[offset + 1];
int min = data[offset + 2];
int max = data[offset + 3];
- slots[i] = new EncounterSlot2(this, species, min, max, slotNum, game);
+ slots[i] = new EncounterSlot2(this, species, min, max, slotNum);
}
return slots;
diff --git a/PKHeX.Core/Legality/Areas/EncounterArea3.cs b/PKHeX.Core/Legality/Areas/EncounterArea3.cs
index e89c0f148..914841cb3 100644
--- a/PKHeX.Core/Legality/Areas/EncounterArea3.cs
+++ b/PKHeX.Core/Legality/Areas/EncounterArea3.cs
@@ -11,8 +11,6 @@ public sealed class EncounterArea3 : EncounterArea
{
public readonly int Rate;
- internal EncounterArea3() { }
-
public static EncounterArea3[] GetAreas(byte[][] input, GameVersion game)
{
var result = new EncounterArea3[input.Length];
@@ -29,25 +27,25 @@ public static EncounterArea3[] GetAreasSwarm(byte[][] input, GameVersion game)
return result;
}
- private EncounterArea3(byte[] data, GameVersion game)
+ private EncounterArea3(byte[] data, GameVersion game) : base(game)
{
Location = data[0] | (data[1] << 8);
Type = (SlotType)data[2];
Rate = data[3];
- Slots = ReadRegularSlots(data, game);
+ Slots = ReadRegularSlots(data);
}
- private EncounterArea3(byte[] data, GameVersion game, bool _)
+ private EncounterArea3(byte[] data, GameVersion game, bool _) : base(game)
{
Location = data[0] | (data[1] << 8);
Type = SlotType.Swarm | SlotType.Grass;
Rate = data[3];
- Slots = ReadSwarmSlots(data, game);
+ Slots = ReadSwarmSlots(data);
}
- private EncounterSlot3[] ReadRegularSlots(byte[] data, GameVersion game)
+ private EncounterSlot3[] ReadRegularSlots(byte[] data)
{
const int size = 10;
int count = (data.Length - 4) / size;
@@ -66,13 +64,13 @@ private EncounterSlot3[] ReadRegularSlots(byte[] data, GameVersion game)
int mpc = data[offset + 7];
int sti = data[offset + 8];
int stc = data[offset + 9];
- slots[i] = new EncounterSlot3(this, species, form, min, max, slotNum, mpi, mpc, sti, stc, game);
+ slots[i] = new EncounterSlot3(this, species, form, min, max, slotNum, mpi, mpc, sti, stc);
}
return slots;
}
- private EncounterSlot3[] ReadSwarmSlots(byte[] data, GameVersion game)
+ private EncounterSlot3[] ReadSwarmSlots(byte[] data)
{
const int size = 14;
int count = (data.Length - 4) / size;
@@ -95,7 +93,7 @@ private EncounterSlot3[] ReadSwarmSlots(byte[] data, GameVersion game)
BitConverter.ToUInt16(data, offset + 12),
};
- slots[i] = new EncounterSlot3Swarm(this, species, min, max, slotNum, game, moves);
+ slots[i] = new EncounterSlot3Swarm(this, species, min, max, slotNum, moves);
}
return slots;
diff --git a/PKHeX.Core/Legality/Areas/EncounterArea3XD.cs b/PKHeX.Core/Legality/Areas/EncounterArea3XD.cs
index 5928a76c2..7b519fe3d 100644
--- a/PKHeX.Core/Legality/Areas/EncounterArea3XD.cs
+++ b/PKHeX.Core/Legality/Areas/EncounterArea3XD.cs
@@ -9,7 +9,7 @@ namespace PKHeX.Core
///
public sealed class EncounterArea3XD : EncounterArea
{
- public EncounterArea3XD(int loc, int s0, int l0, int s1, int l1, int s2, int l2)
+ public EncounterArea3XD(int loc, int s0, int l0, int s1, int l1, int s2, int l2) : base(GameVersion.XD)
{
Location = loc;
Type = SlotType.Grass;
diff --git a/PKHeX.Core/Legality/Areas/EncounterArea4.cs b/PKHeX.Core/Legality/Areas/EncounterArea4.cs
index 40b1ce76b..82563ee81 100644
--- a/PKHeX.Core/Legality/Areas/EncounterArea4.cs
+++ b/PKHeX.Core/Legality/Areas/EncounterArea4.cs
@@ -20,17 +20,17 @@ public static EncounterArea4[] GetAreas(byte[][] input, GameVersion game)
return result;
}
- private EncounterArea4(byte[] data, GameVersion game)
+ private EncounterArea4(byte[] data, GameVersion game) : base(game)
{
Location = data[0] | (data[1] << 8);
Type = (SlotType)data[2];
Rate = data[3];
TypeEncounter = (EncounterType) BitConverter.ToUInt16(data, 4);
- Slots = ReadRegularSlots(data, game);
+ Slots = ReadRegularSlots(data);
}
- private EncounterSlot4[] ReadRegularSlots(byte[] data, GameVersion game)
+ private EncounterSlot4[] ReadRegularSlots(byte[] data)
{
const int size = 10;
int count = (data.Length - 6) / size;
@@ -49,7 +49,7 @@ private EncounterSlot4[] ReadRegularSlots(byte[] data, GameVersion game)
int mpc = data[offset + 7];
int sti = data[offset + 8];
int stc = data[offset + 9];
- slots[i] = new EncounterSlot4(this, species, form, min, max, slotNum, mpi, mpc, sti, stc, game);
+ slots[i] = new EncounterSlot4(this, species, form, min, max, slotNum, mpi, mpc, sti, stc);
}
return slots;
diff --git a/PKHeX.Core/Legality/Areas/EncounterArea5.cs b/PKHeX.Core/Legality/Areas/EncounterArea5.cs
index 6b6395ba9..085a587a2 100644
--- a/PKHeX.Core/Legality/Areas/EncounterArea5.cs
+++ b/PKHeX.Core/Legality/Areas/EncounterArea5.cs
@@ -17,15 +17,15 @@ public static EncounterArea5[] GetAreas(byte[][] input, GameVersion game)
return result;
}
- private EncounterArea5(byte[] data, GameVersion game)
+ private EncounterArea5(byte[] data, GameVersion game) : base(game)
{
Location = data[0] | (data[1] << 8);
Type = (SlotType)data[2];
- Slots = ReadSlots(data, game);
+ Slots = ReadSlots(data);
}
- private EncounterSlot5[] ReadSlots(byte[] data, GameVersion game)
+ private EncounterSlot5[] ReadSlots(byte[] data)
{
const int size = 4;
int count = (data.Length - 4) / size;
@@ -38,7 +38,7 @@ private EncounterSlot5[] ReadSlots(byte[] data, GameVersion game)
int form = SpecForm >> 11;
int min = data[offset + 2];
int max = data[offset + 3];
- slots[i] = new EncounterSlot5(this, species, form, min, max, game);
+ slots[i] = new EncounterSlot5(this, species, form, min, max);
}
return slots;
diff --git a/PKHeX.Core/Legality/Areas/EncounterArea6AO.cs b/PKHeX.Core/Legality/Areas/EncounterArea6AO.cs
index 5841a7c90..80a4b27b7 100644
--- a/PKHeX.Core/Legality/Areas/EncounterArea6AO.cs
+++ b/PKHeX.Core/Legality/Areas/EncounterArea6AO.cs
@@ -17,15 +17,15 @@ public static EncounterArea6AO[] GetAreas(byte[][] input, GameVersion game)
return result;
}
- private EncounterArea6AO(byte[] data, GameVersion game)
+ private EncounterArea6AO(byte[] data, GameVersion game) : base(game)
{
Location = data[0] | (data[1] << 8);
Type = (SlotType)data[2];
- Slots = ReadSlots(data, game);
+ Slots = ReadSlots(data);
}
- private EncounterSlot6AO[] ReadSlots(byte[] data, GameVersion game)
+ private EncounterSlot6AO[] ReadSlots(byte[] data)
{
const int size = 4;
int count = (data.Length - 4) / size;
@@ -38,7 +38,7 @@ private EncounterSlot6AO[] ReadSlots(byte[] data, GameVersion game)
int form = SpecForm >> 11;
int min = data[offset + 2];
int max = data[offset + 3];
- slots[i] = new EncounterSlot6AO(this, species, form, min, max, game);
+ slots[i] = new EncounterSlot6AO(this, species, form, min, max);
}
return slots;
diff --git a/PKHeX.Core/Legality/Areas/EncounterArea6XY.cs b/PKHeX.Core/Legality/Areas/EncounterArea6XY.cs
index 708f20470..777442e55 100644
--- a/PKHeX.Core/Legality/Areas/EncounterArea6XY.cs
+++ b/PKHeX.Core/Legality/Areas/EncounterArea6XY.cs
@@ -17,7 +17,7 @@ public static EncounterArea6XY[] GetAreas(byte[][] input, GameVersion game)
return result;
}
- public EncounterArea6XY(ICollection species)
+ public EncounterArea6XY(ICollection species) : base(GameVersion.XY)
{
Location = 148;
Type = SlotType.FriendSafari;
@@ -25,19 +25,19 @@ public EncounterArea6XY(ICollection species)
var slots = new EncounterSlot6XY[species.Count];
int ctr = 0;
foreach (var s in species)
- slots[ctr++] = new EncounterSlot6XY(this, s, 0, 30, 30, GameVersion.XY);
+ slots[ctr++] = new EncounterSlot6XY(this, s, 0, 30, 30);
Slots = slots;
}
- private EncounterArea6XY(byte[] data, GameVersion game)
+ private EncounterArea6XY(byte[] data, GameVersion game) : base(game)
{
Location = data[0] | (data[1] << 8);
Type = (SlotType)data[2];
- Slots = ReadSlots(data, game);
+ Slots = ReadSlots(data);
}
- private EncounterSlot6XY[] ReadSlots(byte[] data, GameVersion game)
+ private EncounterSlot6XY[] ReadSlots(byte[] data)
{
const int size = 4;
int count = (data.Length - 4) / size;
@@ -50,7 +50,7 @@ private EncounterSlot6XY[] ReadSlots(byte[] data, GameVersion game)
int form = SpecForm >> 11;
int min = data[offset + 2];
int max = data[offset + 3];
- slots[i] = new EncounterSlot6XY(this, species, form, min, max, game);
+ slots[i] = new EncounterSlot6XY(this, species, form, min, max);
}
return slots;
@@ -83,10 +83,7 @@ public override IEnumerable GetMatchingSlots(PKM pkm, IReadOnlyLi
if (maxLevel != pkm.Met_Level)
break;
- var clone = (EncounterSlot6XY)slot.Clone();
- clone.Form = evo.Form;
- clone.Pressure = true;
- yield return clone;
+ yield return ((EncounterSlot6XY)slot).CreatePressureFormCopy(evo.Form);
break;
}
diff --git a/PKHeX.Core/Legality/Areas/EncounterArea7.cs b/PKHeX.Core/Legality/Areas/EncounterArea7.cs
index 99b2a96ca..7bc9fb900 100644
--- a/PKHeX.Core/Legality/Areas/EncounterArea7.cs
+++ b/PKHeX.Core/Legality/Areas/EncounterArea7.cs
@@ -17,15 +17,15 @@ public static EncounterArea7[] GetAreas(byte[][] input, GameVersion game)
return result;
}
- private EncounterArea7(byte[] data, GameVersion game)
+ private EncounterArea7(byte[] data, GameVersion game) : base(game)
{
Location = data[0] | (data[1] << 8);
Type = (SlotType)data[2];
- Slots = ReadSlots(data, game);
+ Slots = ReadSlots(data);
}
- private EncounterSlot7[] ReadSlots(byte[] data, GameVersion game)
+ private EncounterSlot7[] ReadSlots(byte[] data)
{
const int size = 4;
int count = (data.Length - 4) / size;
@@ -38,7 +38,7 @@ private EncounterSlot7[] ReadSlots(byte[] data, GameVersion game)
int form = SpecForm >> 11;
int min = data[offset + 2];
int max = data[offset + 3];
- slots[i] = new EncounterSlot7(this, species, form, min, max, game);
+ slots[i] = new EncounterSlot7(this, species, form, min, max);
}
return slots;
diff --git a/PKHeX.Core/Legality/Areas/EncounterArea7b.cs b/PKHeX.Core/Legality/Areas/EncounterArea7b.cs
index aaabe4756..6aaa87490 100644
--- a/PKHeX.Core/Legality/Areas/EncounterArea7b.cs
+++ b/PKHeX.Core/Legality/Areas/EncounterArea7b.cs
@@ -17,13 +17,13 @@ public static EncounterArea7b[] GetAreas(byte[][] input, GameVersion game)
return result;
}
- private EncounterArea7b(byte[] data, GameVersion game)
+ private EncounterArea7b(byte[] data, GameVersion game) : base(game)
{
Location = data[0] | (data[1] << 8);
- Slots = ReadSlots(data, game);
+ Slots = ReadSlots(data);
}
- private EncounterSlot7b[] ReadSlots(byte[] data, GameVersion game)
+ private EncounterSlot7b[] ReadSlots(byte[] data)
{
const int size = 4;
int count = (data.Length - 2) / size;
@@ -35,7 +35,7 @@ private EncounterSlot7b[] ReadSlots(byte[] data, GameVersion game)
int species = SpecForm & 0x3FF;
int min = data[offset + 2];
int max = data[offset + 3];
- slots[i] = new EncounterSlot7b(this, species, min, max, game);
+ slots[i] = new EncounterSlot7b(this, species, min, max);
}
return slots;
diff --git a/PKHeX.Core/Legality/Areas/EncounterArea7g.cs b/PKHeX.Core/Legality/Areas/EncounterArea7g.cs
index d9b450986..5b05aa585 100644
--- a/PKHeX.Core/Legality/Areas/EncounterArea7g.cs
+++ b/PKHeX.Core/Legality/Areas/EncounterArea7g.cs
@@ -9,12 +9,14 @@ namespace PKHeX.Core
///
public sealed class EncounterArea7g : EncounterArea
{
+ private EncounterArea7g() : base(GameVersion.GO) { }
+
internal static EncounterArea7g[] GetArea()
{
var area = new EncounterArea7g { Location = 50, Type = SlotType.GoPark };
- static EncounterSlot GetSlot(EncounterArea7g area, int species, int form)
+ static EncounterSlot7GO GetSlot(EncounterArea7g area, int species, int form)
{
- return new EncounterSlot7GO(area, species, form, 1, 40, GameVersion.GO);
+ return new EncounterSlot7GO(area, species, form, 1, 40);
}
var obtainable = Enumerable.Range(1, 150).Concat(Enumerable.Range(808, 2)); // count : 152
@@ -47,11 +49,11 @@ static EncounterSlot GetSlot(EncounterArea7g area, int species, int form)
var alolan = AlolanKanto.Select(z => GetSlot(area, z, 1));
var slots = regular.Concat(alolan).ToArray();
- slots[slots.Length - 1].LevelMin = 15; // Raichu
- slots[(int)Species.Mewtwo - 1].LevelMin = 15;
- slots[(int)Species.Articuno - 1].LevelMin = 15;
- slots[(int)Species.Zapdos - 1].LevelMin = 15;
- slots[(int)Species.Moltres - 1].LevelMin = 15;
+ slots[slots.Length - 1].ClampMinRaid(15); // Raichu
+ slots[(int)Species.Mewtwo - 1].ClampMinRaid(15);
+ slots[(int)Species.Articuno - 1].ClampMinRaid(15);
+ slots[(int)Species.Zapdos - 1].ClampMinRaid(15);
+ slots[(int)Species.Moltres - 1].ClampMinRaid(15);
area.Slots = slots;
return new[] { area };
diff --git a/PKHeX.Core/Legality/Areas/EncounterArea8.cs b/PKHeX.Core/Legality/Areas/EncounterArea8.cs
index 1c5c5221d..dbbbb4f41 100644
--- a/PKHeX.Core/Legality/Areas/EncounterArea8.cs
+++ b/PKHeX.Core/Legality/Areas/EncounterArea8.cs
@@ -8,7 +8,7 @@ namespace PKHeX.Core
///
/// encounter area
///
- public sealed class EncounterArea8 : EncounterAreaSH
+ public sealed class EncounterArea8 : EncounterArea
{
///
public override bool IsMatchLocation(int location)
@@ -185,42 +185,35 @@ private IEnumerable GetBoostedMatches(IReadOnlyList
// Honeycalm Island
{192, new byte[] {194}},
};
- }
- public abstract class EncounterAreaSH : EncounterArea
- {
///
/// Slots from this area can cross over to another area, resulting in a different met location.
///
public bool PermitCrossover { get; internal set; }
- ///
- /// Gets an array of areas from an array of raw area data
- ///
- /// Simplified raw format of an Area
- /// Game of origin
- /// Array of areas
- public static T[] GetArray(byte[][] entries, GameVersion game) where T : EncounterAreaSH, new()
+ public static EncounterArea8[] GetAreas(byte[][] input, GameVersion game)
{
- T[] data = new T[entries.Length];
- for (int i = 0; i < data.Length; i++)
- {
- var loc = data[i] = new T();
- loc.LoadSlots(entries[i], game);
- }
- return data;
+ var result = new EncounterArea8[input.Length];
+ for (int i = 0; i < input.Length; i++)
+ result[i] = new EncounterArea8(input[i], game);
+ return result;
}
- private void LoadSlots(byte[] areaData, GameVersion game)
+ private EncounterArea8(byte[] areaData, GameVersion game) : base(game)
{
Location = areaData[0];
- Slots = new EncounterSlot[areaData[1]];
+ Slots = ReadSlots(areaData, areaData[1]);
+ }
+
+ private EncounterSlot[] ReadSlots(byte[] areaData, byte slotCount)
+ {
+ var slots = new EncounterSlot[slotCount];
int ctr = 0;
int ofs = 2;
do
{
- var flags = (AreaWeather8)BitConverter.ToUInt16(areaData, ofs);
+ var flags = (AreaWeather8) BitConverter.ToUInt16(areaData, ofs);
var min = areaData[ofs + 2];
var max = areaData[ofs + 3];
var count = areaData[ofs + 4];
@@ -229,9 +222,11 @@ private void LoadSlots(byte[] areaData, GameVersion game)
for (int i = 0; i < count; i++, ctr++, ofs += 2)
{
var specForm = BitConverter.ToUInt16(areaData, ofs);
- Slots[ctr] = new EncounterSlot8(this, specForm, min, max, flags, game);
+ slots[ctr] = new EncounterSlot8(this, specForm, min, max, flags);
}
- } while (ctr != Slots.Length);
+ } while (ctr != slots.Length);
+
+ return slots;
}
}
@@ -270,7 +265,7 @@ public sealed class EncounterSlot8 : EncounterSlot
public override string LongName => Weather == AreaWeather8.All ? wild : $"{wild} - {Weather.ToString().Replace("_", string.Empty)}";
public override int Generation => 8;
- public EncounterSlot8(EncounterAreaSH area, int specForm, int min, int max, AreaWeather8 weather, GameVersion game) : base(area)
+ public EncounterSlot8(EncounterArea8 area, int specForm, int min, int max, AreaWeather8 weather) : base(area)
{
Species = specForm & 0x7FF;
Form = specForm >> 11;
@@ -278,7 +273,6 @@ public EncounterSlot8(EncounterAreaSH area, int specForm, int min, int max, Area
LevelMax = max;
Weather = weather;
- Version = game;
}
}
}
diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters7b.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters7b.cs
index 59387b82c..2ee302f54 100644
--- a/PKHeX.Core/Legality/Encounters/Data/Encounters7b.cs
+++ b/PKHeX.Core/Legality/Encounters/Data/Encounters7b.cs
@@ -127,7 +127,7 @@ private static void ManuallyAddRareSpawns(IEnumerable areas)
var slots = table.Slots;
var first = slots[0];
var extra = species
- .Select(z => new EncounterSlot7b(table, z, (z == 006 || z >= 144) ? 03 : first.LevelMin, (z == 006 || z >= 144) ? 56 : first.LevelMax, GameVersion.GG)).ToArray();
+ .Select(z => new EncounterSlot7b(table, z, (z == 006 || z >= 144) ? 03 : first.LevelMin, (z == 006 || z >= 144) ? 56 : first.LevelMax)).ToArray();
int count = slots.Length;
Array.Resize(ref slots, count + extra.Length);
diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters8.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters8.cs
index b17842a84..c4d9e2088 100644
--- a/PKHeX.Core/Legality/Encounters/Data/Encounters8.cs
+++ b/PKHeX.Core/Legality/Encounters/Data/Encounters8.cs
@@ -15,10 +15,10 @@ namespace PKHeX.Core
///
internal static class Encounters8
{
- private static readonly EncounterArea8[] SlotsSW_Symbol = EncounterAreaSH.GetArray(Get("sw_symbol", "sw"), SW);
- private static readonly EncounterArea8[] SlotsSH_Symbol = EncounterAreaSH.GetArray(Get("sh_symbol", "sh"), SH);
- private static readonly EncounterArea8[] SlotsSW_Hidden = EncounterAreaSH.GetArray(Get("sw_hidden", "sw"), SW);
- private static readonly EncounterArea8[] SlotsSH_Hidden = EncounterAreaSH.GetArray(Get("sh_hidden", "sh"), SH);
+ private static readonly EncounterArea8[] SlotsSW_Symbol = EncounterArea8.GetAreas(Get("sw_symbol", "sw"), SW);
+ private static readonly EncounterArea8[] SlotsSH_Symbol = EncounterArea8.GetAreas(Get("sh_symbol", "sh"), SH);
+ private static readonly EncounterArea8[] SlotsSW_Hidden = EncounterArea8.GetAreas(Get("sw_hidden", "sw"), SW);
+ private static readonly EncounterArea8[] SlotsSH_Hidden = EncounterArea8.GetAreas(Get("sh_hidden", "sh"), SH);
private static byte[][] Get(string resource, string ident) => BinLinker.Unpack(Util.GetBinaryResource($"encounter_{resource}.pkl"), ident);
internal static readonly EncounterArea8[] SlotsSW = ArrayUtil.ConcatAll(SlotsSW_Symbol, SlotsSW_Hidden);
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot.cs
index b9d573912..b90b84a57 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot.cs
@@ -5,20 +5,20 @@ namespace PKHeX.Core
///
/// Wild Encounter Slot data
///
- public abstract class EncounterSlot : IEncounterable, ILocation, IVersionSet
+ public abstract class EncounterSlot : IEncounterable, ILocation
{
- public int Species { get; set; }
- public int Form { get; set; }
- public int LevelMin { get; set; }
- public int LevelMax { get; set; }
- public GameVersion Version { get; set; }
+ public int Species { get; protected set; }
+ public int Form { get; protected set; }
+ public int LevelMin { get; protected set; }
+ public int LevelMax { get; protected set; }
public abstract int Generation { get; }
public bool EggEncounter => false;
- public int EggLocation { get => 0; set { } }
public override string ToString() => $"{(Species) Species} @ {LevelMin}-{LevelMax}";
internal readonly EncounterArea Area;
+ public GameVersion Version => Area.Version;
public int Location { get => Area.Location; set { } }
+ public int EggLocation { get => 0; set { } }
protected EncounterSlot(EncounterArea area) => Area = area;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot1.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot1.cs
index 4489dd00a..c9daca0c6 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot1.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot1.cs
@@ -8,13 +8,12 @@ public sealed class EncounterSlot1 : EncounterSlot, INumberedSlot
public override int Generation => 1;
public int SlotNumber { get; set; }
- public EncounterSlot1(EncounterArea1 area, int species, int min, int max, int slot, GameVersion game) : base(area)
+ public EncounterSlot1(EncounterArea1 area, int species, int min, int max, int slot) : base(area)
{
Species = species;
LevelMin = min;
LevelMax = max;
SlotNumber = slot;
- Version = game;
}
protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria, PKM pk)
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot2.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot2.cs
index ab529436a..c30d06256 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot2.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot2.cs
@@ -11,13 +11,12 @@ public sealed class EncounterSlot2 : EncounterSlot, INumberedSlot
public override int Generation => 2;
public int SlotNumber { get; set; }
- public EncounterSlot2(EncounterArea2 area, int species, int min, int max, int slot, GameVersion game) : base(area)
+ public EncounterSlot2(EncounterArea2 area, int species, int min, int max, int slot) : base(area)
{
Species = species;
LevelMin = min;
LevelMax = max;
SlotNumber = slot;
- Version = game;
}
protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria, PKM pk)
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3.cs
index 760746f2f..21a29271f 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3.cs
@@ -11,14 +11,13 @@ public class EncounterSlot3 : EncounterSlot, IMagnetStatic, INumberedSlot
public int SlotNumber { get; set; }
- public EncounterSlot3(EncounterArea3 area, int species, int form, int min, int max, int slot, int mpi, int mpc, int sti, int stc, GameVersion game) : base(area)
+ public EncounterSlot3(EncounterArea3 area, int species, int form, int min, int max, int slot, int mpi, int mpc, int sti, int stc) : base(area)
{
Species = species;
Form = form;
LevelMin = min;
LevelMax = max;
SlotNumber = slot;
- Version = game;
MagnetPullIndex = mpi;
MagnetPullCount = mpc;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3PokeSpot.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3PokeSpot.cs
index 2169325c2..f8146b71d 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3PokeSpot.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3PokeSpot.cs
@@ -12,7 +12,6 @@ public EncounterSlot3PokeSpot(EncounterArea3XD area, int species, int min, int m
LevelMin = min;
LevelMax = max;
SlotNumber = slot;
- Version = GameVersion.XD;
}
// PokeSpot encounters always have Fateful Encounter set.
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3Swarm.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3Swarm.cs
index 77e672448..8abfbb54a 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3Swarm.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3Swarm.cs
@@ -7,8 +7,8 @@ internal sealed class EncounterSlot3Swarm : EncounterSlot3, IMoveset
public override int Generation => 3;
public IReadOnlyList Moves { get; }
- public EncounterSlot3Swarm(EncounterArea3 area, int species, int min, int max, int slot, GameVersion game,
- IReadOnlyList moves) : base(area, species, 0, min, max, slot, 0, 0, 0, 0, game) => Moves = moves;
+ public EncounterSlot3Swarm(EncounterArea3 area, int species, int min, int max, int slot,
+ IReadOnlyList moves) : base(area, species, 0, min, max, slot, 0, 0, 0, 0) => Moves = moves;
protected override void SetEncounterMoves(PKM pk, GameVersion version, int level)
{
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot4.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot4.cs
index faf7c9069..f0274aa52 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot4.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot4.cs
@@ -12,14 +12,13 @@ public sealed class EncounterSlot4 : EncounterSlot, IMagnetStatic, INumberedSlot
public int SlotNumber { get; set; }
- public EncounterSlot4(EncounterArea4 area, int species, int form, int min, int max, int slot, int mpi, int mpc, int sti, int stc, GameVersion game) : base(area)
+ public EncounterSlot4(EncounterArea4 area, int species, int form, int min, int max, int slot, int mpi, int mpc, int sti, int stc) : base(area)
{
Species = species;
Form = form;
LevelMin = min;
LevelMax = max;
SlotNumber = slot;
- Version = game;
MagnetPullIndex = mpi;
MagnetPullCount = mpc;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot5.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot5.cs
index cbba78388..0bc0e1bec 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot5.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot5.cs
@@ -4,13 +4,12 @@ public sealed class EncounterSlot5 : EncounterSlot
{
public override int Generation => 5;
- public EncounterSlot5(EncounterArea5 area, int species, int form, int min, int max, GameVersion game) : base(area)
+ public EncounterSlot5(EncounterArea5 area, int species, int form, int min, int max) : base(area)
{
Species = species;
Form = form;
LevelMin = min;
LevelMax = max;
- Version = game;
}
}
}
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6AO.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6AO.cs
index d91ae73ca..de7ad199a 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6AO.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6AO.cs
@@ -4,13 +4,12 @@ public sealed class EncounterSlot6AO : EncounterSlot
{
public override int Generation => 6;
- public EncounterSlot6AO(EncounterArea6AO area, int species, int form, int min, int max, GameVersion game) : base(area)
+ public EncounterSlot6AO(EncounterArea6AO area, int species, int form, int min, int max) : base(area)
{
Species = species;
Form = form;
LevelMin = min;
LevelMax = max;
- Version = game;
}
public bool Pressure { get; set; }
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6XY.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6XY.cs
index bb0ed56b6..efa4b29fa 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6XY.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6XY.cs
@@ -5,13 +5,12 @@ public sealed class EncounterSlot6XY : EncounterSlot
public override int Generation => 6;
public bool Pressure { get; set; }
- public EncounterSlot6XY(EncounterArea6XY area, int species, int form, int min, int max, GameVersion game) : base(area)
+ public EncounterSlot6XY(EncounterArea6XY area, int species, int form, int min, int max) : base(area)
{
Species = species;
Form = form;
LevelMin = min;
LevelMax = max;
- Version = game;
}
protected override void SetFormatSpecificData(PKM pk)
@@ -25,5 +24,13 @@ public override string GetConditionString(out bool valid)
valid = true;
return Pressure ? LegalityCheckStrings.LEncConditionLead : LegalityCheckStrings.LEncCondition;
}
+
+ public EncounterSlot6XY CreatePressureFormCopy(int evoForm)
+ {
+ var clone = (EncounterSlot6XY)Clone();
+ clone.Form = evoForm;
+ clone.Pressure = true;
+ return clone;
+ }
}
-}
\ No newline at end of file
+}
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7.cs
index bd93427b2..cd37ebf5d 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7.cs
@@ -2,13 +2,12 @@ namespace PKHeX.Core
{
public sealed class EncounterSlot7 : EncounterSlot
{
- public EncounterSlot7(EncounterArea7 area, int species, int form, int min, int max, GameVersion game) : base(area)
+ public EncounterSlot7(EncounterArea7 area, int species, int form, int min, int max) : base(area)
{
Species = species;
Form = form;
LevelMin = min;
LevelMax = max;
- Version = game;
}
public override int Generation => 7;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7GO.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7GO.cs
index 2a5c21213..4f1680237 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7GO.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7GO.cs
@@ -4,13 +4,14 @@ public sealed class EncounterSlot7GO : EncounterSlot
{
public override int Generation => 7;
- public EncounterSlot7GO(EncounterArea7g area, int species, int form, int min, int max, GameVersion game) : base(area)
+ public EncounterSlot7GO(EncounterArea7g area, int species, int form, int min, int max) : base(area)
{
Species = species;
Form = form;
LevelMin = min;
LevelMax = max;
- Version = game;
}
+
+ public void ClampMinRaid(int level) => LevelMin = level;
}
-}
\ No newline at end of file
+}
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7b.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7b.cs
index 2958f6a13..6819e4735 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7b.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7b.cs
@@ -4,12 +4,11 @@ public sealed class EncounterSlot7b : EncounterSlot
{
public override int Generation => 7;
- public EncounterSlot7b(EncounterArea7b area, int species, int min, int max, GameVersion game) : base(area)
+ public EncounterSlot7b(EncounterArea7b area, int species, int min, int max) : base(area)
{
Species = species;
LevelMin = min;
LevelMax = max;
- Version = game;
}
}
-}
\ No newline at end of file
+}
diff --git a/PKHeX.Core/Legality/Structures/IVersion.cs b/PKHeX.Core/Legality/Structures/IVersion.cs
index 7654d29ce..9b53ad11e 100644
--- a/PKHeX.Core/Legality/Structures/IVersion.cs
+++ b/PKHeX.Core/Legality/Structures/IVersion.cs
@@ -32,12 +32,6 @@ public static GameVersion GetCompatibleVersion(this IVersion ver, GameVersion pr
}
}
- internal static void SetVersion(this IEnumerable arr, GameVersion game)
- {
- foreach (var area in arr)
- area.Slots.SetVersion(game);
- }
-
private static GameVersion GetSingleVersion(this IVersion ver)
{
const int max = (int) GameVersion.RB;