diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot.cs index 1475b778e..5551f72d4 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot.cs @@ -9,21 +9,28 @@ namespace PKHeX.Core /// Wild encounter slots are found as random encounters in-game. public abstract record EncounterSlot : IEncounterable, ILocation { - public int Species { get; protected init; } - public int Form { get; protected init; } - public int LevelMin { get; protected init; } - public int LevelMax { get; protected init; } + public int Species { get; } + public int Form { get; } + public int LevelMin { get; } + public int LevelMax { get; } public abstract int Generation { get; } public bool EggEncounter => false; public override string ToString() => $"{(Species) Species} @ {LevelMin}-{LevelMax}"; + protected EncounterSlot(EncounterArea area, int species, int form, int min, int max) + { + Area = area; + Species = species; + Form = form; + LevelMin = min; + LevelMax = max; + } + internal readonly EncounterArea Area; public GameVersion Version => Area.Version; public int Location => Area.Location; public int EggLocation => 0; - protected EncounterSlot(EncounterArea area) => Area = area; - public bool FixedLevel => LevelMin == LevelMax; private protected const string wild = "Wild Encounter"; diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot1.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot1.cs index 9940d82ac..c7029dd3d 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot1.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot1.cs @@ -9,11 +9,8 @@ public sealed record EncounterSlot1 : EncounterSlot, INumberedSlot public override int Generation => 1; public int SlotNumber { get; } - public EncounterSlot1(EncounterArea1 area, int species, int min, int max, int slot) : base(area) + public EncounterSlot1(EncounterArea1 area, int species, int min, int max, int slot) : base(area, species, 0, min, max) { - Species = species; - LevelMin = min; - LevelMax = max; SlotNumber = slot; } diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot2.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot2.cs index bbdae6464..ae1523078 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot2.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot2.cs @@ -12,11 +12,8 @@ public sealed record EncounterSlot2 : EncounterSlot, INumberedSlot public override int Generation => 2; public int SlotNumber { get; } - public EncounterSlot2(EncounterArea2 area, int species, int min, int max, int slot) : base(area) + public EncounterSlot2(EncounterArea2 area, int species, int min, int max, int slot) : base(area, species, 0, min, max) { - Species = species; - LevelMin = min; - LevelMax = max; SlotNumber = slot; } diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3.cs index 0cf0e947a..502fe6a91 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3.cs @@ -15,12 +15,8 @@ public record EncounterSlot3 : EncounterSlot, IMagnetStatic, INumberedSlot public int SlotNumber { get; } - public EncounterSlot3(EncounterArea3 area, int species, int form, int min, int max, int slot, int mpi, int mpc, int sti, int stc) : 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, form, min, max) { - Species = species; - Form = form; - LevelMin = min; - LevelMax = max; SlotNumber = slot; MagnetPullIndex = mpi; diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3PokeSpot.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3PokeSpot.cs index 8192801f9..7b44b4a88 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3PokeSpot.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3PokeSpot.cs @@ -10,11 +10,8 @@ public sealed record EncounterSlot3PokeSpot : EncounterSlot, INumberedSlot public int SlotNumber { get; } - public EncounterSlot3PokeSpot(EncounterArea3XD area, int species, int min, int max, int slot) : base(area) + public EncounterSlot3PokeSpot(EncounterArea3XD area, int species, int min, int max, int slot) : base(area, species, 0, min, max) { - Species = species; - LevelMin = min; - LevelMax = max; SlotNumber = slot; } diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot4.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot4.cs index e293e11d2..6735a1eb4 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot4.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot4.cs @@ -16,12 +16,8 @@ public sealed record EncounterSlot4 : EncounterSlot, IMagnetStatic, INumberedSlo public int SlotNumber { get; } - public EncounterSlot4(EncounterArea4 area, int species, int form, int min, int max, int slot, int mpi, int mpc, int sti, int stc) : 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, form, min, max) { - Species = species; - Form = form; - LevelMin = min; - LevelMax = max; SlotNumber = slot; MagnetPullIndex = mpi; diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot5.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot5.cs index 1c3409b3a..677bc8944 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot5.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot5.cs @@ -8,12 +8,8 @@ public sealed record EncounterSlot5 : EncounterSlot { public override int Generation => 5; - public EncounterSlot5(EncounterArea5 area, int species, int form, int min, int max) : base(area) + public EncounterSlot5(EncounterArea5 area, int species, int form, int min, int max) : base(area, species, form, min, max) { - Species = species; - Form = form; - LevelMin = min; - LevelMax = max; } } } diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6AO.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6AO.cs index a59ec3a44..f802dd5c1 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6AO.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6AO.cs @@ -14,12 +14,8 @@ public sealed record EncounterSlot6AO : EncounterSlot public bool WhiteFlute { get; init; } public bool BlackFlute { get; init; } - public EncounterSlot6AO(EncounterArea6AO area, int species, int form, int min, int max) : base(area) + public EncounterSlot6AO(EncounterArea6AO area, int species, int form, int min, int max) : base(area, species, form, min, max) { - Species = species; - Form = form; - LevelMin = min; - LevelMax = max; } protected override void SetFormatSpecificData(PKM pk) diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6XY.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6XY.cs index fad00b026..c6e60e554 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6XY.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6XY.cs @@ -9,12 +9,8 @@ public sealed record EncounterSlot6XY : EncounterSlot public override int Generation => 6; public bool Pressure { get; init; } - public EncounterSlot6XY(EncounterArea6XY area, int species, int form, int min, int max) : base(area) + public EncounterSlot6XY(EncounterArea6XY area, int species, int form, int min, int max) : base(area, species, form, min, max) { - Species = species; - Form = form; - LevelMin = min; - LevelMax = max; } protected override void SetFormatSpecificData(PKM pk) diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7.cs index b084740c3..103373e5c 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7.cs @@ -8,12 +8,8 @@ public sealed record EncounterSlot7 : EncounterSlot { public override int Generation => 7; - public EncounterSlot7(EncounterArea7 area, int species, int form, int min, int max) : base(area) + public EncounterSlot7(EncounterArea7 area, int species, int form, int min, int max) : base(area, species, form, min, max) { - Species = species; - Form = form; - LevelMin = min; - LevelMax = max; } } } diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7b.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7b.cs index 4fc6aca1e..ba45864a8 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7b.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7b.cs @@ -8,11 +8,8 @@ public sealed record EncounterSlot7b : EncounterSlot { public override int Generation => 7; - public EncounterSlot7b(EncounterArea7b area, int species, int min, int max) : base(area) + public EncounterSlot7b(EncounterArea7b area, int species, int min, int max) : base(area, species, 0, min, max) { - Species = species; - LevelMin = min; - LevelMax = max; } } } diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot8.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot8.cs index 867ae198e..951ee64b3 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot8.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot8.cs @@ -10,13 +10,8 @@ public sealed record EncounterSlot8 : EncounterSlot public override string LongName => Weather == AreaWeather8.All ? wild : $"{wild} - {Weather.ToString().Replace("_", string.Empty)}"; public override int Generation => 8; - public EncounterSlot8(EncounterArea8 area, int specForm, int min, int max, AreaWeather8 weather) : base(area) + public EncounterSlot8(EncounterArea8 area, int species, int form, int min, int max, AreaWeather8 weather) : base(area, species, form, min, max) { - Species = specForm & 0x7FF; - Form = specForm >> 11; - LevelMin = min; - LevelMax = max; - Weather = weather; } } diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlot7GO.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlot7GO.cs index 637677cfa..5b6543e3d 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlot7GO.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlot7GO.cs @@ -9,10 +9,8 @@ public sealed record EncounterSlot7GO : EncounterSlotGO public override int Generation => 7; public EncounterSlot7GO(EncounterArea7g area, int species, int form, int start, int end, Shiny shiny, PogoType type) - : base(area, start, end, shiny, type) + : base(area, species, form, start, end, shiny, type) { - Species = species; - Form = form; } protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria, PKM pk) diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlot8GO.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlot8GO.cs index cf54a4910..ffb09db00 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlot8GO.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlot8GO.cs @@ -18,11 +18,8 @@ public sealed record EncounterSlot8GO : EncounterSlotGO public GameVersion OriginGroup { get; } public EncounterSlot8GO(EncounterArea8g area, int species, int form, int start, int end, Shiny shiny, PogoType type, GameVersion originGroup) - : base(area, start, end, shiny, type) + : base(area, species, form, start, end, shiny, type) { - Species = species; - Form = form; - OriginGroup = originGroup; } diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlotGO.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlotGO.cs index 94457f7a7..0a4120b3c 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlotGO.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlotGO.cs @@ -19,11 +19,8 @@ public abstract record EncounterSlotGO : EncounterSlot, IPogoSlot /// public PogoType Type { get; } - protected EncounterSlotGO(EncounterArea area, int start, int end, Shiny shiny, PogoType type) : base(area) + protected EncounterSlotGO(EncounterArea area, int species, int form, int start, int end, Shiny shiny, PogoType type) : base(area, species, form, type.GetMinLevel(), EncountersGO.MAX_LEVEL) { - LevelMin = type.GetMinLevel(); - LevelMax = EncountersGO.MAX_LEVEL; - Start = start; End = end;