mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-15 00:21:23 -05:00
Make Species/Form/Min/Max readonly, not init
Pass them to the abstract class's constructor
This commit is contained in:
parent
4cdbb431d8
commit
4e01e78734
|
|
@ -9,21 +9,28 @@ namespace PKHeX.Core
|
|||
/// <remarks>Wild encounter slots are found as random encounters in-game.</remarks>
|
||||
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";
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,11 +19,8 @@ public abstract record EncounterSlotGO : EncounterSlot, IPogoSlot
|
|||
/// <inheritdoc/>
|
||||
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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user