mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 12:33:06 +00:00
Mark EncounterSlot/Static types as immutable record types
This commit is contained in:
parent
0a3f45218f
commit
afdd2bd57e
45 changed files with 67 additions and 81 deletions
|
@ -67,28 +67,18 @@ namespace PKHeX.Core
|
||||||
if (slot.Form != evo.Form && slot.Form != RandomForm)
|
if (slot.Form != evo.Form && slot.Form != RandomForm)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
var clone = (EncounterSlot6AO)slot.Clone();
|
// Track some metadata about how this slot was matched.
|
||||||
MarkSlotDetails(pkm, clone, evo);
|
var ao = (EncounterSlot6AO)slot;
|
||||||
|
var clone = ao with
|
||||||
|
{
|
||||||
|
WhiteFlute = evo.MinLevel < slot.LevelMin,
|
||||||
|
BlackFlute = evo.MinLevel > slot.LevelMax && evo.MinLevel <= slot.LevelMax + FluteBoostMax,
|
||||||
|
DexNav = ao.CanDexNav && (evo.MinLevel != slot.LevelMax || pkm.RelearnMove1 != 0 || pkm.AbilityNumber == 4),
|
||||||
|
};
|
||||||
yield return clone;
|
yield return clone;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void MarkSlotDetails(PKM pkm, EncounterSlot6AO slot, EvoCriteria evo)
|
|
||||||
{
|
|
||||||
if (slot.LevelMin > evo.MinLevel)
|
|
||||||
slot.WhiteFlute = true;
|
|
||||||
if (slot.LevelMax + 1 <= evo.MinLevel && evo.MinLevel <= slot.LevelMax + FluteBoostMax)
|
|
||||||
slot.BlackFlute = true;
|
|
||||||
|
|
||||||
if (!slot.CanDexNav)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (slot.LevelMax != evo.MinLevel)
|
|
||||||
slot.DexNav = true;
|
|
||||||
if (pkm.RelearnMove1 != 0 || pkm.AbilityNumber == 4)
|
|
||||||
slot.DexNav = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace PKHeX.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Egg Encounter Data
|
/// Egg Encounter Data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class EncounterEgg : IEncounterable
|
public record EncounterEgg : IEncounterable
|
||||||
{
|
{
|
||||||
public int Species { get; }
|
public int Species { get; }
|
||||||
public int Form { get; }
|
public int Form { get; }
|
||||||
|
@ -144,7 +144,7 @@ namespace PKHeX.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class EncounterEggSplit : EncounterEgg
|
public sealed record EncounterEggSplit : EncounterEgg
|
||||||
{
|
{
|
||||||
public int OtherSpecies { get; }
|
public int OtherSpecies { get; }
|
||||||
public EncounterEggSplit(int species, int form, int level, int gen, GameVersion game, int otherSpecies) : base(species, form, level, gen, game) => OtherSpecies = otherSpecies;
|
public EncounterEggSplit(int species, int form, int level, int gen, GameVersion game, int otherSpecies) : base(species, form, level, gen, game) => OtherSpecies = otherSpecies;
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace PKHeX.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invalid Encounter Data
|
/// Invalid Encounter Data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class EncounterInvalid : IEncounterable
|
public sealed record EncounterInvalid : IEncounterable
|
||||||
{
|
{
|
||||||
public static readonly EncounterInvalid Default = new();
|
public static readonly EncounterInvalid Default = new();
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace PKHeX.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Rejected Encounter Data containing a reason why the encounter was rejected (not compatible).
|
/// Rejected Encounter Data containing a reason why the encounter was rejected (not compatible).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class EncounterRejected : IEncounterable
|
public sealed record EncounterRejected : IEncounterable
|
||||||
{
|
{
|
||||||
public readonly IEncounterable Encounter;
|
public readonly IEncounterable Encounter;
|
||||||
public readonly CheckResult Check;
|
public readonly CheckResult Check;
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace PKHeX.Core
|
||||||
/// Wild Encounter Slot data
|
/// Wild Encounter Slot data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>Wild encounter slots are found as random encounters in-game.</remarks>
|
/// <remarks>Wild encounter slots are found as random encounters in-game.</remarks>
|
||||||
public abstract class EncounterSlot : IEncounterable, ILocation
|
public abstract record EncounterSlot : IEncounterable, ILocation
|
||||||
{
|
{
|
||||||
public int Species { get; protected init; }
|
public int Species { get; protected init; }
|
||||||
public int Form { get; protected init; }
|
public int Form { get; protected init; }
|
||||||
|
@ -23,8 +23,6 @@ namespace PKHeX.Core
|
||||||
|
|
||||||
protected EncounterSlot(EncounterArea area) => Area = area;
|
protected EncounterSlot(EncounterArea area) => Area = area;
|
||||||
|
|
||||||
public EncounterSlot Clone() => (EncounterSlot)MemberwiseClone();
|
|
||||||
|
|
||||||
public bool FixedLevel => LevelMin == LevelMax;
|
public bool FixedLevel => LevelMin == LevelMax;
|
||||||
|
|
||||||
private protected const string wild = "Wild Encounter";
|
private protected const string wild = "Wild Encounter";
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/// Encounter Slot found in <see cref="GameVersion.Gen1"/>.
|
/// Encounter Slot found in <see cref="GameVersion.Gen1"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterSlot"/>
|
/// <inheritdoc cref="EncounterSlot"/>
|
||||||
public sealed class EncounterSlot1 : EncounterSlot, INumberedSlot
|
public sealed record EncounterSlot1 : EncounterSlot, INumberedSlot
|
||||||
{
|
{
|
||||||
public override int Generation => 1;
|
public override int Generation => 1;
|
||||||
public int SlotNumber { get; }
|
public int SlotNumber { get; }
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
/// Referenced Area object contains Time data which is used for <see cref="GameVersion.C"/> origin data.
|
/// Referenced Area object contains Time data which is used for <see cref="GameVersion.C"/> origin data.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <inheritdoc cref="EncounterSlot"/>
|
/// <inheritdoc cref="EncounterSlot"/>
|
||||||
public sealed class EncounterSlot2 : EncounterSlot, INumberedSlot
|
public sealed record EncounterSlot2 : EncounterSlot, INumberedSlot
|
||||||
{
|
{
|
||||||
public override int Generation => 2;
|
public override int Generation => 2;
|
||||||
public int SlotNumber { get; }
|
public int SlotNumber { get; }
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace PKHeX.Core
|
||||||
/// Encounter Slot found in <see cref="GameVersion.Gen3"/>.
|
/// Encounter Slot found in <see cref="GameVersion.Gen3"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterSlot"/>
|
/// <inheritdoc cref="EncounterSlot"/>
|
||||||
public class EncounterSlot3 : EncounterSlot, IMagnetStatic, INumberedSlot
|
public record EncounterSlot3 : EncounterSlot, IMagnetStatic, INumberedSlot
|
||||||
{
|
{
|
||||||
public sealed override int Generation => 3;
|
public sealed override int Generation => 3;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace PKHeX.Core
|
||||||
/// Encounter Slot found in <see cref="GameVersion.XD"/>.
|
/// Encounter Slot found in <see cref="GameVersion.XD"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterSlot"/>
|
/// <inheritdoc cref="EncounterSlot"/>
|
||||||
public sealed class EncounterSlot3PokeSpot : EncounterSlot, INumberedSlot
|
public sealed record EncounterSlot3PokeSpot : EncounterSlot, INumberedSlot
|
||||||
{
|
{
|
||||||
public override int Generation => 3;
|
public override int Generation => 3;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace PKHeX.Core
|
||||||
/// Handled differently as these slots have fixed moves that are different from their normal level-up moves.
|
/// Handled differently as these slots have fixed moves that are different from their normal level-up moves.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <inheritdoc cref="EncounterSlot"/>
|
/// <inheritdoc cref="EncounterSlot"/>
|
||||||
internal sealed class EncounterSlot3Swarm : EncounterSlot3, IMoveset
|
internal sealed record EncounterSlot3Swarm : EncounterSlot3, IMoveset
|
||||||
{
|
{
|
||||||
public IReadOnlyList<int> Moves { get; }
|
public IReadOnlyList<int> Moves { get; }
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace PKHeX.Core
|
||||||
/// Encounter Slot found in <see cref="GameVersion.Gen4"/>.
|
/// Encounter Slot found in <see cref="GameVersion.Gen4"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterSlot"/>
|
/// <inheritdoc cref="EncounterSlot"/>
|
||||||
public sealed class EncounterSlot4 : EncounterSlot, IMagnetStatic, INumberedSlot, IEncounterTypeTile
|
public sealed record EncounterSlot4 : EncounterSlot, IMagnetStatic, INumberedSlot, IEncounterTypeTile
|
||||||
{
|
{
|
||||||
public override int Generation => 4;
|
public override int Generation => 4;
|
||||||
public EncounterType TypeEncounter => ((EncounterArea4)Area).TypeEncounter;
|
public EncounterType TypeEncounter => ((EncounterArea4)Area).TypeEncounter;
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace PKHeX.Core
|
||||||
/// Encounter Slot found in <see cref="GameVersion.Gen5"/>.
|
/// Encounter Slot found in <see cref="GameVersion.Gen5"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterSlot"/>
|
/// <inheritdoc cref="EncounterSlot"/>
|
||||||
public sealed class EncounterSlot5 : EncounterSlot
|
public sealed record EncounterSlot5 : EncounterSlot
|
||||||
{
|
{
|
||||||
public override int Generation => 5;
|
public override int Generation => 5;
|
||||||
|
|
||||||
|
|
|
@ -4,15 +4,15 @@ namespace PKHeX.Core
|
||||||
/// Encounter Slot found in <see cref="GameVersion.ORAS"/>.
|
/// Encounter Slot found in <see cref="GameVersion.ORAS"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterSlot"/>
|
/// <inheritdoc cref="EncounterSlot"/>
|
||||||
public sealed class EncounterSlot6AO : EncounterSlot
|
public sealed record EncounterSlot6AO : EncounterSlot
|
||||||
{
|
{
|
||||||
public override int Generation => 6;
|
public override int Generation => 6;
|
||||||
public bool CanDexNav => Area.Type != SlotType.Rock_Smash;
|
public bool CanDexNav => Area.Type != SlotType.Rock_Smash;
|
||||||
|
|
||||||
public bool Pressure { get; set; }
|
public bool Pressure { get; init; }
|
||||||
public bool DexNav { get; set; }
|
public bool DexNav { get; init; }
|
||||||
public bool WhiteFlute { get; set; }
|
public bool WhiteFlute { get; init; }
|
||||||
public bool BlackFlute { get; set; }
|
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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace PKHeX.Core
|
||||||
/// Encounter Slot found in <see cref="GameVersion.XY"/>.
|
/// Encounter Slot found in <see cref="GameVersion.XY"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterSlot"/>
|
/// <inheritdoc cref="EncounterSlot"/>
|
||||||
public sealed class EncounterSlot6XY : EncounterSlot
|
public sealed record EncounterSlot6XY : EncounterSlot
|
||||||
{
|
{
|
||||||
public override int Generation => 6;
|
public override int Generation => 6;
|
||||||
public bool Pressure { get; init; }
|
public bool Pressure { get; init; }
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace PKHeX.Core
|
||||||
/// Encounter Slot found in <see cref="GameVersion.Gen7"/>.
|
/// Encounter Slot found in <see cref="GameVersion.Gen7"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterSlot"/>
|
/// <inheritdoc cref="EncounterSlot"/>
|
||||||
public sealed class EncounterSlot7 : EncounterSlot
|
public sealed record EncounterSlot7 : EncounterSlot
|
||||||
{
|
{
|
||||||
public override int Generation => 7;
|
public override int Generation => 7;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace PKHeX.Core
|
||||||
/// Encounter Slot found in <see cref="GameVersion.GG"/>.
|
/// Encounter Slot found in <see cref="GameVersion.GG"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterSlot"/>
|
/// <inheritdoc cref="EncounterSlot"/>
|
||||||
public sealed class EncounterSlot7b : EncounterSlot
|
public sealed record EncounterSlot7b : EncounterSlot
|
||||||
{
|
{
|
||||||
public override int Generation => 7;
|
public override int Generation => 7;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace PKHeX.Core
|
||||||
/// Encounter Slot found in <see cref="GameVersion.SWSH"/>.
|
/// Encounter Slot found in <see cref="GameVersion.SWSH"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterSlot"/>
|
/// <inheritdoc cref="EncounterSlot"/>
|
||||||
public sealed class EncounterSlot8 : EncounterSlot
|
public sealed record EncounterSlot8 : EncounterSlot
|
||||||
{
|
{
|
||||||
public readonly AreaWeather8 Weather;
|
public readonly AreaWeather8 Weather;
|
||||||
public override string LongName => Weather == AreaWeather8.All ? wild : $"{wild} - {Weather.ToString().Replace("_", string.Empty)}";
|
public override string LongName => Weather == AreaWeather8.All ? wild : $"{wild} - {Weather.ToString().Replace("_", string.Empty)}";
|
||||||
|
|
|
@ -2,9 +2,9 @@ namespace PKHeX.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Encounter Slot found in <see cref="GameVersion.Gen7"/> (GO Park, <seealso cref="GameVersion.GG"/>).
|
/// Encounter Slot found in <see cref="GameVersion.Gen7"/> (GO Park, <seealso cref="GameVersion.GG"/>).
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc cref="EncounterSlotGO" />
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class EncounterSlot7GO : EncounterSlotGO
|
public sealed record EncounterSlot7GO : EncounterSlotGO
|
||||||
{
|
{
|
||||||
public override int Generation => 7;
|
public override int Generation => 7;
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@ namespace PKHeX.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Encounter Slot representing data transferred to <see cref="GameVersion.Gen8"/> (HOME).
|
/// Encounter Slot representing data transferred to <see cref="GameVersion.Gen8"/> (HOME).
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc cref="EncounterSlotGO" />
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class EncounterSlot8GO : EncounterSlotGO
|
public sealed record EncounterSlot8GO : EncounterSlotGO
|
||||||
{
|
{
|
||||||
public override int Generation => 8;
|
public override int Generation => 8;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace PKHeX.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contains details about an encounter that can be found in <see cref="GameVersion.GO"/>.
|
/// Contains details about an encounter that can be found in <see cref="GameVersion.GO"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class EncounterSlotGO : EncounterSlot, IPogoSlot
|
public abstract record EncounterSlotGO : EncounterSlot, IPogoSlot
|
||||||
{
|
{
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public int Start { get; }
|
public int Start { get; }
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace PKHeX.Core
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Static Encounters are fixed position encounters with properties that are not subject to Wild Encounter conditions.
|
/// Static Encounters are fixed position encounters with properties that are not subject to Wild Encounter conditions.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public abstract class EncounterStatic : IEncounterable, IMoveset, ILocation, IVersionSet
|
public abstract record EncounterStatic : IEncounterable, IMoveset, ILocation, IVersionSet
|
||||||
{
|
{
|
||||||
public int Species { get; init; }
|
public int Species { get; init; }
|
||||||
public int Form { get; init; }
|
public int Form { get; init; }
|
||||||
|
@ -39,8 +39,6 @@ namespace PKHeX.Core
|
||||||
public bool SkipFormCheck { get; init; }
|
public bool SkipFormCheck { get; init; }
|
||||||
public bool EggEncounter => EggLocation > 0;
|
public bool EggEncounter => EggLocation > 0;
|
||||||
|
|
||||||
internal EncounterStatic Clone() => (EncounterStatic)MemberwiseClone();
|
|
||||||
|
|
||||||
private const string _name = "Static Encounter";
|
private const string _name = "Static Encounter";
|
||||||
public string Name => _name;
|
public string Name => _name;
|
||||||
public string LongName => Version == GameVersion.Any ? _name : $"{_name} ({Version})";
|
public string LongName => Version == GameVersion.Any ? _name : $"{_name} ({Version})";
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/// Generation 1 Static Encounter
|
/// Generation 1 Static Encounter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic"/>
|
/// <inheritdoc cref="EncounterStatic"/>
|
||||||
public class EncounterStatic1 : EncounterStatic
|
public record EncounterStatic1 : EncounterStatic
|
||||||
{
|
{
|
||||||
public override int Generation => 1;
|
public override int Generation => 1;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace PKHeX.Core
|
||||||
/// Event data for Generation 1
|
/// Event data for Generation 1
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic1"/>
|
/// <inheritdoc cref="EncounterStatic1"/>
|
||||||
public sealed class EncounterStatic1E : EncounterStatic1, IFixedGBLanguage
|
public sealed record EncounterStatic1E : EncounterStatic1, IFixedGBLanguage
|
||||||
{
|
{
|
||||||
public EncounterGBLanguage Language { get; init; } = EncounterGBLanguage.Japanese;
|
public EncounterGBLanguage Language { get; init; } = EncounterGBLanguage.Japanese;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace PKHeX.Core
|
||||||
/// Generation 2 Static Encounter
|
/// Generation 2 Static Encounter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic"/>
|
/// <inheritdoc cref="EncounterStatic"/>
|
||||||
public class EncounterStatic2 : EncounterStatic
|
public record EncounterStatic2 : EncounterStatic
|
||||||
{
|
{
|
||||||
public sealed override int Generation => 2;
|
public sealed override int Generation => 2;
|
||||||
public sealed override int Level { get; init; }
|
public sealed override int Level { get; init; }
|
||||||
|
@ -81,7 +81,7 @@ namespace PKHeX.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class EncounterStatic2Odd : EncounterStatic2
|
public sealed record EncounterStatic2Odd : EncounterStatic2
|
||||||
{
|
{
|
||||||
private const int Dizzy = 146;
|
private const int Dizzy = 146;
|
||||||
private static readonly int[] _dizzy = { Dizzy };
|
private static readonly int[] _dizzy = { Dizzy };
|
||||||
|
@ -106,7 +106,7 @@ namespace PKHeX.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class EncounterStatic2Roam : EncounterStatic2
|
public sealed record EncounterStatic2Roam : EncounterStatic2
|
||||||
{
|
{
|
||||||
private static readonly int[] Roaming_MetLocation_GSC_Grass =
|
private static readonly int[] Roaming_MetLocation_GSC_Grass =
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace PKHeX.Core
|
||||||
/// Event data for Generation 2
|
/// Event data for Generation 2
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic2"/>
|
/// <inheritdoc cref="EncounterStatic2"/>
|
||||||
public sealed class EncounterStatic2E : EncounterStatic2, IFixedGBLanguage
|
public sealed record EncounterStatic2E : EncounterStatic2, IFixedGBLanguage
|
||||||
{
|
{
|
||||||
public EncounterGBLanguage Language { get; init; } = EncounterGBLanguage.Japanese;
|
public EncounterGBLanguage Language { get; init; } = EncounterGBLanguage.Japanese;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace PKHeX.Core
|
||||||
/// Generation 3 Static Encounter
|
/// Generation 3 Static Encounter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic"/>
|
/// <inheritdoc cref="EncounterStatic"/>
|
||||||
public sealed class EncounterStatic3 : EncounterStatic
|
public sealed record EncounterStatic3 : EncounterStatic
|
||||||
{
|
{
|
||||||
public override int Generation => 3;
|
public override int Generation => 3;
|
||||||
public bool Roaming { get; init; }
|
public bool Roaming { get; init; }
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace PKHeX.Core
|
||||||
/// Generation 4 Static Encounter
|
/// Generation 4 Static Encounter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic"/>
|
/// <inheritdoc cref="EncounterStatic"/>
|
||||||
public sealed class EncounterStatic4 : EncounterStatic, IEncounterTypeTile
|
public sealed record EncounterStatic4 : EncounterStatic, IEncounterTypeTile
|
||||||
{
|
{
|
||||||
public override int Generation => 4;
|
public override int Generation => 4;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/// Generation 4 Pokéwalker Encounter
|
/// Generation 4 Pokéwalker Encounter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic"/>
|
/// <inheritdoc cref="EncounterStatic"/>
|
||||||
public sealed class EncounterStatic4Pokewalker : EncounterStatic
|
public sealed record EncounterStatic4Pokewalker : EncounterStatic
|
||||||
{
|
{
|
||||||
public override int Generation => 4;
|
public override int Generation => 4;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace PKHeX.Core
|
||||||
/// Generation 5 Static Encounter
|
/// Generation 5 Static Encounter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic"/>
|
/// <inheritdoc cref="EncounterStatic"/>
|
||||||
public class EncounterStatic5 : EncounterStatic
|
public record EncounterStatic5 : EncounterStatic
|
||||||
{
|
{
|
||||||
public sealed override int Generation => 5;
|
public sealed override int Generation => 5;
|
||||||
public bool Roaming { get; init; }
|
public bool Roaming { get; init; }
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/// Generation 5 Dream Radar gift encounters
|
/// Generation 5 Dream Radar gift encounters
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic"/>
|
/// <inheritdoc cref="EncounterStatic"/>
|
||||||
public sealed class EncounterStatic5DR : EncounterStatic5
|
public sealed record EncounterStatic5DR : EncounterStatic5
|
||||||
{
|
{
|
||||||
public EncounterStatic5DR(int species, int form, int abilityIndex = 4)
|
public EncounterStatic5DR(int species, int form, int abilityIndex = 4)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/// Generation 5 Static Encounter from N
|
/// Generation 5 Static Encounter from N
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic"/>
|
/// <inheritdoc cref="EncounterStatic"/>
|
||||||
internal sealed class EncounterStatic5N : EncounterStatic5
|
internal sealed record EncounterStatic5N : EncounterStatic5
|
||||||
{
|
{
|
||||||
public readonly uint PID;
|
public readonly uint PID;
|
||||||
public const bool NSparkle = true;
|
public const bool NSparkle = true;
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace PKHeX.Core
|
||||||
/// Generation 6 Static Encounter
|
/// Generation 6 Static Encounter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic"/>
|
/// <inheritdoc cref="EncounterStatic"/>
|
||||||
public sealed class EncounterStatic6 : EncounterStatic, IContestStats
|
public sealed record EncounterStatic6 : EncounterStatic, IContestStats
|
||||||
{
|
{
|
||||||
public override int Generation => 6;
|
public override int Generation => 6;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace PKHeX.Core
|
||||||
/// Generation 7 Static Encounter
|
/// Generation 7 Static Encounter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic"/>
|
/// <inheritdoc cref="EncounterStatic"/>
|
||||||
public sealed class EncounterStatic7 : EncounterStatic, IRelearn
|
public sealed record EncounterStatic7 : EncounterStatic, IRelearn
|
||||||
{
|
{
|
||||||
public override int Generation => 7;
|
public override int Generation => 7;
|
||||||
public IReadOnlyList<int> Relearn { get; init; } = Array.Empty<int>();
|
public IReadOnlyList<int> Relearn { get; init; } = Array.Empty<int>();
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/// Generation 7 Static Encounter (<see cref="GameVersion.GG"/>
|
/// Generation 7 Static Encounter (<see cref="GameVersion.GG"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic"/>
|
/// <inheritdoc cref="EncounterStatic"/>
|
||||||
public sealed class EncounterStatic7b : EncounterStatic
|
public sealed record EncounterStatic7b : EncounterStatic
|
||||||
{
|
{
|
||||||
public override int Generation => 7;
|
public override int Generation => 7;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace PKHeX.Core
|
||||||
/// Generation 8 Static Encounter
|
/// Generation 8 Static Encounter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic"/>
|
/// <inheritdoc cref="EncounterStatic"/>
|
||||||
public class EncounterStatic8 : EncounterStatic, IDynamaxLevel, IGigantamax, IRelearn
|
public record EncounterStatic8 : EncounterStatic, IDynamaxLevel, IGigantamax, IRelearn
|
||||||
{
|
{
|
||||||
public sealed override int Generation => 8;
|
public sealed override int Generation => 8;
|
||||||
public bool ScriptedNoMarks { get; init; }
|
public bool ScriptedNoMarks { get; init; }
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace PKHeX.Core
|
||||||
/// Generation 8 Nest Encounter (Regular Raid Dens)
|
/// Generation 8 Nest Encounter (Regular Raid Dens)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic8Nest{T}"/>
|
/// <inheritdoc cref="EncounterStatic8Nest{T}"/>
|
||||||
public sealed class EncounterStatic8N : EncounterStatic8Nest<EncounterStatic8N>
|
public sealed record EncounterStatic8N : EncounterStatic8Nest<EncounterStatic8N>
|
||||||
{
|
{
|
||||||
private readonly uint MinRank;
|
private readonly uint MinRank;
|
||||||
private readonly uint MaxRank;
|
private readonly uint MaxRank;
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace PKHeX.Core
|
||||||
/// Generation 8 Nest Encounter (Distributed Crystal Data)
|
/// Generation 8 Nest Encounter (Distributed Crystal Data)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic8Nest{T}"/>
|
/// <inheritdoc cref="EncounterStatic8Nest{T}"/>
|
||||||
public sealed class EncounterStatic8NC : EncounterStatic8Nest<EncounterStatic8NC>
|
public sealed record EncounterStatic8NC : EncounterStatic8Nest<EncounterStatic8NC>
|
||||||
{
|
{
|
||||||
protected override bool IsMatchLocation(PKM pkm)
|
protected override bool IsMatchLocation(PKM pkm)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace PKHeX.Core
|
||||||
/// Generation 8 Nest Encounter (Distributed Data)
|
/// Generation 8 Nest Encounter (Distributed Data)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic8Nest{T}"/>
|
/// <inheritdoc cref="EncounterStatic8Nest{T}"/>
|
||||||
public sealed class EncounterStatic8ND : EncounterStatic8Nest<EncounterStatic8ND>
|
public sealed record EncounterStatic8ND : EncounterStatic8Nest<EncounterStatic8ND>
|
||||||
{
|
{
|
||||||
public EncounterStatic8ND(byte lvl, byte dyna, byte flawless)
|
public EncounterStatic8ND(byte lvl, byte dyna, byte flawless)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace PKHeX.Core
|
||||||
/// Generation 8 Nest Encounter (Raid)
|
/// Generation 8 Nest Encounter (Raid)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic"/>
|
/// <inheritdoc cref="EncounterStatic"/>
|
||||||
public abstract class EncounterStatic8Nest<T> : EncounterStatic, IGigantamax, IDynamaxLevel where T : EncounterStatic8Nest<T>
|
public abstract record EncounterStatic8Nest<T> : EncounterStatic, IGigantamax, IDynamaxLevel where T : EncounterStatic8Nest<T>
|
||||||
{
|
{
|
||||||
public sealed override int Generation => 8;
|
public sealed override int Generation => 8;
|
||||||
public static Func<PKM, T, bool>? VerifyCorrelation { private get; set; }
|
public static Func<PKM, T, bool>? VerifyCorrelation { private get; set; }
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace PKHeX.Core
|
||||||
/// <see cref="EncounterStatic8"/> with multiple references (used for multiple met locations)
|
/// <see cref="EncounterStatic8"/> with multiple references (used for multiple met locations)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic"/>
|
/// <inheritdoc cref="EncounterStatic"/>
|
||||||
public sealed class EncounterStatic8S : EncounterStatic8
|
public sealed record EncounterStatic8S : EncounterStatic8
|
||||||
{
|
{
|
||||||
public override int Location { get => Locations[0]; init { } }
|
public override int Location { get => Locations[0]; init { } }
|
||||||
public IReadOnlyList<int> Locations { get; init; } = Array.Empty<int>();
|
public IReadOnlyList<int> Locations { get; init; } = Array.Empty<int>();
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace PKHeX.Core
|
||||||
/// Generation 8 Nest Encounter (Max Raid) Underground
|
/// Generation 8 Nest Encounter (Max Raid) Underground
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic8Nest{T}"/>
|
/// <inheritdoc cref="EncounterStatic8Nest{T}"/>
|
||||||
public sealed class EncounterStatic8U : EncounterStatic8Nest<EncounterStatic8U>
|
public sealed record EncounterStatic8U : EncounterStatic8Nest<EncounterStatic8U>
|
||||||
{
|
{
|
||||||
public override int Location { get => MaxLair; init { } }
|
public override int Location { get => MaxLair; init { } }
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace PKHeX.Core
|
||||||
/// Shadow Pokémon Encounter found in <see cref="GameVersion.CXD"/>
|
/// Shadow Pokémon Encounter found in <see cref="GameVersion.CXD"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <inheritdoc cref="EncounterStatic"/>
|
/// <inheritdoc cref="EncounterStatic"/>
|
||||||
public sealed class EncounterStaticShadow : EncounterStatic
|
public sealed record EncounterStaticShadow : EncounterStatic
|
||||||
{
|
{
|
||||||
public override int Generation => 3;
|
public override int Generation => 3;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace PKHeX.Core
|
||||||
get => _match;
|
get => _match;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_match != EncounterInvalid.Default && (value.LevelMin != _match.LevelMin || value.Species != _match.Species))
|
if (!ReferenceEquals(_match, EncounterInvalid.Default) && (value.LevelMin != _match.LevelMin || value.Species != _match.Species))
|
||||||
_evochains = null; // clear if evo chain has the potential to be different
|
_evochains = null; // clear if evo chain has the potential to be different
|
||||||
_match = value;
|
_match = value;
|
||||||
Parse.Clear();
|
Parse.Clear();
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace PKHeX.Core
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pkm.OT_Gender != 0)
|
if (pkm.OT_Gender != 0)
|
||||||
data.AddLine(GetInvalid(LG5OTGenderN, CheckIdentifier.Shiny));
|
data.AddLine(GetInvalid(LG5OTGenderN, CheckIdentifier.Trainer));
|
||||||
if (pkm.IVTotal != 30*6)
|
if (pkm.IVTotal != 30*6)
|
||||||
data.AddLine(GetInvalid(LG5IVAll30, CheckIdentifier.IVs));
|
data.AddLine(GetInvalid(LG5IVAll30, CheckIdentifier.IVs));
|
||||||
if (!VerifyNsPKMOTValid(pkm))
|
if (!VerifyNsPKMOTValid(pkm))
|
||||||
|
|
|
@ -21,19 +21,19 @@ namespace PKHeX.Core
|
||||||
public PIDType Method;
|
public PIDType Method;
|
||||||
|
|
||||||
public override string OT_Name { get; set; } = string.Empty;
|
public override string OT_Name { get; set; } = string.Empty;
|
||||||
public int OT_Gender { get; set; } = 3;
|
public int OT_Gender { get; init; } = 3;
|
||||||
public override int TID { get; set; }
|
public override int TID { get; set; }
|
||||||
public override int SID { get; set; }
|
public override int SID { get; set; }
|
||||||
public override int Location { get; set; } = 255;
|
public override int Location { get; set; } = 255;
|
||||||
public override int EggLocation { get => 0; set {} }
|
public override int EggLocation { get => 0; set {} }
|
||||||
public override GameVersion Version { get; set; }
|
public override GameVersion Version { get; set; }
|
||||||
public int Language { get; set; } = -1;
|
public int Language { get; init; } = -1;
|
||||||
public override int Species { get; set; }
|
public override int Species { get; set; }
|
||||||
public override bool IsEgg { get; set; }
|
public override bool IsEgg { get; set; }
|
||||||
public override IReadOnlyList<int> Moves { get; set; } = Array.Empty<int>();
|
public override IReadOnlyList<int> Moves { get; set; } = Array.Empty<int>();
|
||||||
public bool NotDistributed { get; set; }
|
public bool NotDistributed { get; init; }
|
||||||
public Shiny Shiny { get; set; } = Shiny.Random;
|
public Shiny Shiny { get; init; } = Shiny.Random;
|
||||||
public bool Fateful { get; set; } // Obedience Flag
|
public bool Fateful { get; init; } // Obedience Flag
|
||||||
|
|
||||||
// Mystery Gift Properties
|
// Mystery Gift Properties
|
||||||
public override int Generation => 3;
|
public override int Generation => 3;
|
||||||
|
@ -62,12 +62,12 @@ namespace PKHeX.Core
|
||||||
public override int Form { get; set; }
|
public override int Form { get; set; }
|
||||||
|
|
||||||
// Synthetic
|
// Synthetic
|
||||||
private int? _metLevel;
|
private readonly int? _metLevel;
|
||||||
|
|
||||||
public int Met_Level
|
public int Met_Level
|
||||||
{
|
{
|
||||||
get => _metLevel ?? (IsEgg ? 0 : Level);
|
get => _metLevel ?? (IsEgg ? 0 : Level);
|
||||||
set => _metLevel = value;
|
init => _metLevel = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PKM ConvertToPKM(ITrainerInfo sav, EncounterCriteria criteria)
|
public override PKM ConvertToPKM(ITrainerInfo sav, EncounterCriteria criteria)
|
||||||
|
|
Loading…
Reference in a new issue