diff --git a/PKHeX.Core/Legality/Areas/EncounterArea8.cs b/PKHeX.Core/Legality/Areas/EncounterArea8.cs
index a01edddbe..6fd205c6b 100644
--- a/PKHeX.Core/Legality/Areas/EncounterArea8.cs
+++ b/PKHeX.Core/Legality/Areas/EncounterArea8.cs
@@ -281,24 +281,4 @@ public enum AreaWeather8
NotWeather = Shaking_Trees | Fishing,
}
-
- ///
- /// Encounter Slot found in
- ///
- public sealed class EncounterSlot8 : EncounterSlot
- {
- public readonly AreaWeather8 Weather;
- 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)
- {
- Species = specForm & 0x7FF;
- Form = specForm >> 11;
- LevelMin = min;
- LevelMax = max;
-
- Weather = weather;
- }
- }
}
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot.cs
index 5575b874c..fe4a0e76e 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot.cs
@@ -5,6 +5,7 @@ namespace PKHeX.Core
///
/// Wild Encounter Slot data
///
+ /// Wild encounter slots are found as random encounters in-game.
public abstract class EncounterSlot : IEncounterable, ILocation
{
public int Species { get; protected set; }
@@ -160,15 +161,19 @@ private void SetMetData(PKM pk, int level, int location)
pk.MetDate = DateTime.Today;
}
+ private const int FormDynamic = FormVivillon;
+ private const int FormVivillon = 30;
+ private const int FormRandom = 31;
+
private static int GetWildAltForm(PKM pk, int form, ITrainerInfo sav)
{
- if (form < 30) // specified form
+ if (form < FormDynamic) // specified form
{
if (pk.Species == (int) Core.Species.Minior)
return Util.Rand.Next(7, 14);
return form;
}
- if (form == 31) // flagged as totally random
+ if (form == FormRandom) // flagged as totally random
return Util.Rand.Next(pk.PersonalInfo.FormeCount);
int spec = pk.Species;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot1.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot1.cs
index c9daca0c6..f55b29728 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot1.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot1.cs
@@ -1,12 +1,13 @@
namespace PKHeX.Core
{
///
- /// Generation 1 Wild Encounter Slot data
+ /// Encounter Slot found in .
///
+ ///
public sealed class EncounterSlot1 : EncounterSlot, INumberedSlot
{
public override int Generation => 1;
- public int SlotNumber { get; set; }
+ public int SlotNumber { get; }
public EncounterSlot1(EncounterArea1 area, int species, int min, int max, int slot) : base(area)
{
@@ -23,6 +24,7 @@ protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteri
var pk1 = (PK1)pk;
if (Version == GameVersion.YW)
{
+ // Since we don't keep track of Yellow's Personal Data, just handle any differences here.
pk1.Catch_Rate = Species switch
{
(int) Core.Species.Kadabra => 96,
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot2.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot2.cs
index c30d06256..6e559bbfc 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot2.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot2.cs
@@ -1,15 +1,16 @@
namespace PKHeX.Core
{
///
- /// Generation 2 Wild Encounter Slot data
+ /// Encounter Slot found in .
///
///
- /// Contains Time data which is present in origin data.
+ /// Referenced Area object contains Time data which is used for origin data.
///
+ ///
public sealed class EncounterSlot2 : EncounterSlot, INumberedSlot
{
public override int Generation => 2;
- public int SlotNumber { get; set; }
+ public int SlotNumber { get; }
public EncounterSlot2(EncounterArea2 area, int species, int min, int max, int slot) : base(area)
{
@@ -25,7 +26,7 @@ protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteri
var pk2 = (PK2)pk;
if (Version == GameVersion.C)
- pk2.Met_TimeOfDay = ((EncounterArea2)Area!).Time.RandomValidTime();
+ pk2.Met_TimeOfDay = ((EncounterArea2)Area).Time.RandomValidTime();
}
}
}
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3.cs
index 3bf64d65f..0ac98ed4d 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3.cs
@@ -1,15 +1,19 @@
namespace PKHeX.Core
{
+ ///
+ /// Encounter Slot found in .
+ ///
+ ///
public class EncounterSlot3 : EncounterSlot, IMagnetStatic, INumberedSlot
{
public sealed override int Generation => 3;
- public int StaticIndex { get; set; }
- public int MagnetPullIndex { get; set; }
- public int StaticCount { get; set; }
- public int MagnetPullCount { get; set; }
+ public int StaticIndex { get; }
+ public int MagnetPullIndex { get; }
+ public int StaticCount { get; }
+ public int MagnetPullCount { get; }
- public int SlotNumber { get; set; }
+ 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)
{
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3PokeSpot.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3PokeSpot.cs
index f8146b71d..cecd0f8a3 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3PokeSpot.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3PokeSpot.cs
@@ -1,10 +1,14 @@
namespace PKHeX.Core
{
+ ///
+ /// Encounter Slot found in .
+ ///
+ ///
public sealed class EncounterSlot3PokeSpot : EncounterSlot, INumberedSlot
{
public override int Generation => 3;
- public int SlotNumber { get; set; }
+ public int SlotNumber { get; }
public EncounterSlot3PokeSpot(EncounterArea3XD area, int species, int min, int max, int slot) : base(area)
{
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3Swarm.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3Swarm.cs
index 616ae781e..73fd1be73 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3Swarm.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3Swarm.cs
@@ -2,6 +2,13 @@
namespace PKHeX.Core
{
+ ///
+ /// Encounter Slot found in .
+ ///
+ ///
+ /// Handled differently as these slots have fixed moves that are different from their normal level-up moves.
+ ///
+ ///
internal sealed class EncounterSlot3Swarm : EncounterSlot3, IMoveset
{
public IReadOnlyList Moves { get; }
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot4.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot4.cs
index 26e1319b4..bc9f31e0b 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot4.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot4.cs
@@ -1,16 +1,20 @@
namespace PKHeX.Core
{
+ ///
+ /// Encounter Slot found in .
+ ///
+ ///
public sealed class EncounterSlot4 : EncounterSlot, IMagnetStatic, INumberedSlot, IEncounterTypeTile
{
public override int Generation => 4;
public EncounterType TypeEncounter => ((EncounterArea4)Area).TypeEncounter;
- public int StaticIndex { get; set; }
- public int MagnetPullIndex { get; set; }
- public int StaticCount { get; set; }
- public int MagnetPullCount { get; set; }
+ public int StaticIndex { get; }
+ public int MagnetPullIndex { get; }
+ public int StaticCount { get; }
+ public int MagnetPullCount { get; }
- public int SlotNumber { get; set; }
+ 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)
{
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot5.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot5.cs
index 0bc0e1bec..af45abbae 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot5.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot5.cs
@@ -1,5 +1,9 @@
namespace PKHeX.Core
{
+ ///
+ /// Encounter Slot found in .
+ ///
+ ///
public sealed class EncounterSlot5 : EncounterSlot
{
public override int Generation => 5;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6AO.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6AO.cs
index e5a177483..4944acbba 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6AO.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6AO.cs
@@ -1,8 +1,18 @@
namespace PKHeX.Core
{
+ ///
+ /// Encounter Slot found in .
+ ///
+ ///
public sealed class EncounterSlot6AO : EncounterSlot
{
public override int Generation => 6;
+ public bool CanDexNav => Area.Type != SlotType.Rock_Smash;
+
+ public bool Pressure { get; set; }
+ public bool DexNav { get; set; }
+ public bool WhiteFlute { get; set; }
+ public bool BlackFlute { get; set; }
public EncounterSlot6AO(EncounterArea6AO area, int species, int form, int min, int max) : base(area)
{
@@ -12,13 +22,6 @@ public EncounterSlot6AO(EncounterArea6AO area, int species, int form, int min, i
LevelMax = max;
}
- public bool Pressure { get; set; }
- public bool DexNav { get; set; }
- public bool WhiteFlute { get; set; }
- public bool BlackFlute { get; set; }
-
- public bool CanDexNav => Area.Type != SlotType.Rock_Smash;
-
protected override void SetFormatSpecificData(PKM pk)
{
var pk6 = (PK6)pk;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6XY.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6XY.cs
index efa4b29fa..4fcb17e81 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6XY.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot6XY.cs
@@ -1,5 +1,9 @@
namespace PKHeX.Core
{
+ ///
+ /// Encounter Slot found in .
+ ///
+ ///
public sealed class EncounterSlot6XY : EncounterSlot
{
public override int Generation => 6;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7.cs
index cd37ebf5d..97bb394b3 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7.cs
@@ -1,7 +1,13 @@
namespace PKHeX.Core
{
+ ///
+ /// Encounter Slot found in .
+ ///
+ ///
public sealed class EncounterSlot7 : EncounterSlot
{
+ public override int Generation => 7;
+
public EncounterSlot7(EncounterArea7 area, int species, int form, int min, int max) : base(area)
{
Species = species;
@@ -9,8 +15,5 @@ public EncounterSlot7(EncounterArea7 area, int species, int form, int min, int m
LevelMin = min;
LevelMax = max;
}
-
- public override int Generation => 7;
- public bool Pressure { get; set; }
}
-}
\ 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 6819e4735..e704e8d75 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7b.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot7b.cs
@@ -1,5 +1,9 @@
namespace PKHeX.Core
{
+ ///
+ /// Encounter Slot found in .
+ ///
+ ///
public sealed class EncounterSlot7b : EncounterSlot
{
public override int Generation => 7;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot8.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot8.cs
new file mode 100644
index 000000000..e671b0ddd
--- /dev/null
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot8.cs
@@ -0,0 +1,23 @@
+namespace PKHeX.Core
+{
+ ///
+ /// Encounter Slot found in .
+ ///
+ ///
+ public sealed class EncounterSlot8 : EncounterSlot
+ {
+ public readonly AreaWeather8 Weather;
+ 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)
+ {
+ 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 bad1b1bb5..93154e5f6 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlot7GO.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlot7GO.cs
@@ -1,7 +1,8 @@
namespace PKHeX.Core
{
///
- /// Generation 7 Wild Encounter Slot data (GO Park)
+ /// Encounter Slot found in (GO Park, ).
+ ///
///
public sealed class EncounterSlot7GO : EncounterSlotGO
{
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlot8GO.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlot8GO.cs
index 3edeeb8af..b8244f0a7 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlot8GO.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlot8GO.cs
@@ -1,11 +1,20 @@
namespace PKHeX.Core
{
///
- /// Generation 8 Wild Encounter Slot data (GO -> HOME)
+ /// Encounter Slot representing data transferred to (HOME).
+ ///
///
public sealed class EncounterSlot8GO : EncounterSlotGO
{
public override int Generation => 8;
+
+ ///
+ /// Encounters need a Parent Game to determine the original moves when transferred to HOME.
+ ///
+ ///
+ /// Future game releases might change this value.
+ /// With respect to date legality, new dates might be incompatible with initial values.
+ ///
public GameVersion OriginGroup { get; }
public EncounterSlot8GO(EncounterArea8g area, int species, int form, int start, int end, Shiny shiny, PogoType type, GameVersion originGroup)
@@ -17,7 +26,14 @@ public EncounterSlot8GO(EncounterArea8g area, int species, int form, int start,
OriginGroup = originGroup;
}
+ ///
+ /// Gets the minimum IV (in GO) the encounter must have.
+ ///
public int GetMinIV() => Type.GetMinIV();
+
+ ///
+ /// Checks if the is compatible with the .
+ ///
public bool IsBallValid(Ball ball) => Type.IsBallValid(ball);
protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria, PKM pk)
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlotGO.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlotGO.cs
index ad310457d..d4af68637 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlotGO.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/EncounterSlotGO.cs
@@ -3,21 +3,20 @@
namespace PKHeX.Core
{
///
- /// Contains details about an encounter that can be found in
+ /// Contains details about an encounter that can be found in .
///
public abstract class EncounterSlotGO : EncounterSlot, IPogoSlot
{
- /// Start Date timestamp of when the encounter became available.
+ ///
public int Start { get; }
- /// End Date timestamp of when the encounter became unavailable.
- /// If there is no end date (yet), we'll try to clamp to a date in the near-future to prevent it from being open-ended.
+ ///
public int End { get; }
- /// Possibility of being shiny.
+ ///
public Shiny Shiny { get; }
- /// How the encounter was captured.
+ ///
public PogoType Type { get; }
protected EncounterSlotGO(EncounterArea area, int start, int end, Shiny shiny, PogoType type) : base(area)
@@ -56,7 +55,7 @@ private static DateTime GetDate(int time)
public bool IsWithinStartEnd(int stamp)
{
if (End == 0)
- return Start <= stamp && GetDate(stamp) <= DateTime.Now;
+ return Start <= stamp && GetDate(stamp) <= DateTime.UtcNow;
if (Start == 0)
return stamp <= End;
return Start <= stamp && stamp <= End;
@@ -73,7 +72,7 @@ public bool IsWithinStartEnd(int stamp)
public DateTime GetRandomValidDate()
{
if (Start == 0)
- return End == 0 ? DateTime.Now : GetDate(End);
+ return End == 0 ? DateTime.UtcNow : GetDate(End);
var start = GetDate(Start);
if (End == 0)
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/IPogoSlot.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/IPogoSlot.cs
index 0e194459f..6d4a275c1 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/IPogoSlot.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/GO/IPogoSlot.cs
@@ -9,6 +9,7 @@ public interface IPogoSlot
int Start { get; }
/// Last day the encounter was available. If zero, no date specified (unbounded finish).
+ /// If there is no end date (yet), we'll try to clamp to a date in the near-future to prevent it from being open-ended.
int End { get; }
/// Possibility of shiny for the encounter.
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/IEncounterTypeTile.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/IEncounterTypeTile.cs
index 0ef556a60..976ae5b68 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/IEncounterTypeTile.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/IEncounterTypeTile.cs
@@ -1,7 +1,17 @@
namespace PKHeX.Core
{
+ ///
+ /// Contains information pertaining the floor tile the was obtained on in .
+ ///
+ ///
+ ///
+ ///
+ ///
public interface IEncounterTypeTile
{
+ ///
+ /// Tile Type the was obtained on.
+ ///
EncounterType TypeEncounter { get; }
}
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/IMagnetStatic.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/IMagnetStatic.cs
index 37c3e8bd0..1fd3f5e80 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/IMagnetStatic.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/IMagnetStatic.cs
@@ -1,12 +1,24 @@
namespace PKHeX.Core
{
+ ///
+ /// Contains information about the RNG restrictions for the slot, and any mutated RNG values.
+ ///
+ ///
+ /// When encountering a Wild Pokémon with a lead that has an ability of or ,
+ /// the game picks encounters from the that match the type.
+ /// The values in this interface change the to allow different values for slot yielding.
+ ///
public interface IMagnetStatic
{
- int StaticIndex { get; set; }
- int MagnetPullIndex { get; set; }
+ /// if the lead is
+ int StaticIndex { get; }
+ /// if the lead is
+ int MagnetPullIndex { get; }
- int StaticCount { get; set; }
- int MagnetPullCount { get; set; }
+ /// Count of slots in the parent area that can be yielded by
+ int StaticCount { get; }
+ /// Count of slots in the parent area that can be yielded by
+ int MagnetPullCount { get; }
}
public static class MagnetStaticExtensions
diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/INumberedSlot.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/INumberedSlot.cs
index 740e5cbc4..8dbbc15bb 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterSlot/INumberedSlot.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/INumberedSlot.cs
@@ -1,7 +1,16 @@
namespace PKHeX.Core
{
+ ///
+ /// that contains information about what Index it is within the 's type-group of slots.
+ ///
+ ///
+ /// Useful for checking legality (if the RNG can yield this slot).
+ ///
public interface INumberedSlot
{
- int SlotNumber { get; set; }
+ ///
+ /// Number Index of the .
+ ///
+ int SlotNumber { get; }
}
}
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic1.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic1.cs
index 5aa69b3f6..4112ba294 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic1.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic1.cs
@@ -1,5 +1,9 @@
namespace PKHeX.Core
{
+ ///
+ /// Generation 1 Static Encounter
+ ///
+ ///
public class EncounterStatic1 : EncounterStatic
{
public override int Generation => 1;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic1E.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic1E.cs
index 98acf4c1b..d44d0a866 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic1E.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic1E.cs
@@ -7,6 +7,7 @@ namespace PKHeX.Core
///
/// Event data for Generation 1
///
+ ///
public sealed class EncounterStatic1E : EncounterStatic1
{
public EncounterGBLanguage Language { get; set; } = EncounterGBLanguage.Japanese;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2.cs
index 61226d951..1299e2404 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2.cs
@@ -3,6 +3,10 @@
namespace PKHeX.Core
{
+ ///
+ /// Generation 2 Static Encounter
+ ///
+ ///
public class EncounterStatic2 : EncounterStatic
{
public sealed override int Generation => 2;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2E.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2E.cs
index 2d971c14d..1910e01e2 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2E.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2E.cs
@@ -7,6 +7,7 @@ namespace PKHeX.Core
///
/// Event data for Generation 2
///
+ ///
public sealed class EncounterStatic2E : EncounterStatic2
{
public EncounterGBLanguage Language { get; set; } = EncounterGBLanguage.Japanese;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic3.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic3.cs
index 5f0ad5572..ee14a985a 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic3.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic3.cs
@@ -3,6 +3,10 @@
namespace PKHeX.Core
{
+ ///
+ /// Generation 3 Static Encounter
+ ///
+ ///
public sealed class EncounterStatic3 : EncounterStatic
{
public override int Generation => 3;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic4.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic4.cs
index 858221ab2..77c8e5f7d 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic4.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic4.cs
@@ -1,5 +1,9 @@
namespace PKHeX.Core
{
+ ///
+ /// Generation 4 Static Encounter
+ ///
+ ///
public class EncounterStatic4 : EncounterStatic
{
public sealed override int Generation => 4;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic5.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic5.cs
index 112414058..9ee7b9ccd 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic5.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic5.cs
@@ -2,6 +2,10 @@
namespace PKHeX.Core
{
+ ///
+ /// Generation 5 Static Encounter
+ ///
+ ///
public class EncounterStatic5 : EncounterStatic
{
public sealed override int Generation => 5;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic5DR.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic5DR.cs
index 08f99a2d1..3872fff0e 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic5DR.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic5DR.cs
@@ -3,6 +3,7 @@
///
/// Generation 5 Dream Radar gift encounters
///
+ ///
public sealed class EncounterStatic5DR : EncounterStatic5
{
public EncounterStatic5DR(int species, int form, int abilityIndex = 4)
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic5N.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic5N.cs
index 5775bd946..4af5fe27c 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic5N.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic5N.cs
@@ -1,5 +1,9 @@
namespace PKHeX.Core
{
+ ///
+ /// Generation 5 Static Encounter from N
+ ///
+ ///
internal sealed class EncounterStatic5N : EncounterStatic5
{
public readonly uint PID;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic6.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic6.cs
index 688621a9f..ef6c69517 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic6.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic6.cs
@@ -2,6 +2,10 @@
namespace PKHeX.Core
{
+ ///
+ /// Generation 6 Static Encounter
+ ///
+ ///
public sealed class EncounterStatic6 : EncounterStatic, IContestStats
{
public override int Generation => 6;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic7.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic7.cs
index 8b2fda96b..7d9f9b568 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic7.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic7.cs
@@ -3,6 +3,10 @@
namespace PKHeX.Core
{
+ ///
+ /// Generation 7 Static Encounter
+ ///
+ ///
public sealed class EncounterStatic7 : EncounterStatic, IRelearn
{
public override int Generation => 7;
@@ -20,9 +24,9 @@ protected override bool IsMatchForm(PKM pkm, DexLevel evo)
if (SkipFormCheck)
return true;
- if (FormConverter.IsTotemForm(Species, Form, Generation))
+ if (AltFormInfo.IsTotemForm(Species, Form, Generation))
{
- var expectForm = pkm.Format == 7 ? Form : FormConverter.GetTotemBaseForm(Species, Form);
+ var expectForm = pkm.Format == 7 ? Form : AltFormInfo.GetTotemBaseForm(Species, Form);
return expectForm == evo.Form;
}
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic7b.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic7b.cs
index 76c477539..f75d7f6c0 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic7b.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic7b.cs
@@ -1,5 +1,9 @@
namespace PKHeX.Core
{
+ ///
+ /// Generation 7 Static Encounter (
+ ///
+ ///
public sealed class EncounterStatic7b : EncounterStatic
{
public override int Generation => 7;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8.cs
index 35b66622b..ec9b51887 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8.cs
@@ -3,6 +3,10 @@
namespace PKHeX.Core
{
+ ///
+ /// Generation 8 Static Encounter
+ ///
+ ///
public class EncounterStatic8 : EncounterStatic, IDynamaxLevel, IGigantamax, IRelearn
{
public sealed override int Generation => 8;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8N.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8N.cs
index 87b59906a..8de230d04 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8N.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8N.cs
@@ -5,8 +5,9 @@
namespace PKHeX.Core
{
///
- /// Generation 8 Nest Encounter (Raid)
+ /// Generation 8 Nest Encounter (Regular Raid Dens)
///
+ ///
public sealed class EncounterStatic8N : EncounterStatic8Nest
{
private readonly uint MinRank;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8NC.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8NC.cs
index e6e155fea..dd194e093 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8NC.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8NC.cs
@@ -5,6 +5,7 @@ namespace PKHeX.Core
///
/// Generation 8 Nest Encounter (Distributed Crystal Data)
///
+ ///
public sealed class EncounterStatic8NC : EncounterStatic8Nest
{
public override int Location { get => SharedNest; set { } }
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8ND.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8ND.cs
index 62a66b247..6af827748 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8ND.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8ND.cs
@@ -5,6 +5,7 @@ namespace PKHeX.Core
///
/// Generation 8 Nest Encounter (Distributed Data)
///
+ ///
public sealed class EncounterStatic8ND : EncounterStatic8Nest
{
public EncounterStatic8ND(byte lvl, byte dyna, byte flawless)
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8Nest.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8Nest.cs
index e44d09f82..4126a28d0 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8Nest.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8Nest.cs
@@ -3,9 +3,13 @@
namespace PKHeX.Core
{
+ ///
+ /// Generation 8 Nest Encounter (Raid)
+ ///
+ ///
public abstract class EncounterStatic8Nest : EncounterStatic, IGigantamax, IDynamaxLevel where T : EncounterStatic8Nest
{
- public override int Generation => 8;
+ public sealed override int Generation => 8;
public static Func? VerifyCorrelation { private get; set; }
public static Action? GenerateData { private get; set; }
@@ -41,7 +45,7 @@ public override bool IsMatch(PKM pkm, DexLevel evo)
return base.IsMatch(pkm, evo);
}
- public override bool IsMatchDeferred(PKM pkm)
+ public sealed override bool IsMatchDeferred(PKM pkm)
{
if (base.IsMatchDeferred(pkm))
return true;
@@ -75,7 +79,7 @@ public override bool IsMatchDeferred(PKM pkm)
return false;
}
- protected override void SetPINGA(PKM pk, EncounterCriteria criteria)
+ protected sealed override void SetPINGA(PKM pk, EncounterCriteria criteria)
{
if (GenerateData != null)
GenerateData(pk, (T)this, criteria);
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8S.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8S.cs
index d62cd2951..95a3b045a 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8S.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8S.cs
@@ -7,6 +7,7 @@ namespace PKHeX.Core
///
/// with multiple references (used for multiple met locations)
///
+ ///
public sealed class EncounterStatic8S : EncounterStatic8
{
public override int Location { get => Locations[0]; set { } }
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8U.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8U.cs
index 646a473b1..cc5521149 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8U.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8U.cs
@@ -5,6 +5,7 @@ namespace PKHeX.Core
///
/// Generation 8 Nest Encounter (Max Raid) Underground
///
+ ///
public sealed class EncounterStatic8U : EncounterStatic8Nest
{
public override int Location { get => MaxLair; set { } }
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStaticShadow.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStaticShadow.cs
index 5ca5e3a94..61d77c37f 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStaticShadow.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStaticShadow.cs
@@ -7,6 +7,7 @@ namespace PKHeX.Core
///
/// Shadow Pokémon Encounter found in
///
+ ///
public sealed class EncounterStaticShadow : EncounterStatic
{
public override int Generation => 3;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStaticTyped.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStaticTyped.cs
index a16c28fca..6af14b6bb 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStaticTyped.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStaticTyped.cs
@@ -3,6 +3,10 @@
namespace PKHeX.Core
{
+ ///
+ /// Generation 4 Static Encounter
+ ///
+ ///
public sealed class EncounterStaticTyped : EncounterStatic4, IEncounterTypeTile
{
public bool Roaming { get; set; }
@@ -17,6 +21,7 @@ protected override bool IsMatchLocation(PKM pkm)
if (!Roaming)
return base.IsMatchLocation(pkm);
+ // Met location is lost on transfer
if (!(pkm is G4PKM pk4))
return true;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade.cs b/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade.cs
index 9c77204c8..f26394aa5 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade.cs
@@ -259,16 +259,16 @@ public virtual bool IsMatch(PKM pkm, DexLevel evo)
private bool IsMatchLevel(PKM pkm, DexLevel evo)
{
if (!pkm.HasOriginalMetLocation)
- return Level <= evo.Level;
+ return evo.Level >= Level;
var loc = Location != 0 ? Location : GetDefaultMetLocation(Generation);
if (loc != pkm.Met_Location)
return false;
if (pkm.Format < 5)
- return Level <= evo.Level;
+ return evo.Level >= Level;
- return Level == pkm.Met_Level;
+ return pkm.Met_Level == Level;
}
protected virtual bool IsMatchNatureGenderShiny(PKM pkm)
diff --git a/PKHeX.Core/Legality/Encounters/Generator/EncounterEggGenerator.cs b/PKHeX.Core/Legality/Encounters/Generator/EncounterEggGenerator.cs
index cec0dbb2a..aeff445f5 100644
--- a/PKHeX.Core/Legality/Encounters/Generator/EncounterEggGenerator.cs
+++ b/PKHeX.Core/Legality/Encounters/Generator/EncounterEggGenerator.cs
@@ -60,7 +60,7 @@ private static bool NoHatchFromEggForm(int species, int form, int gen)
{
if (form == 0)
return false;
- if (FormConverter.IsTotemForm(species, form, gen))
+ if (AltFormInfo.IsTotemForm(species, form, gen))
return true;
if (species == (int) Species.Pichu)
return true; // can't get Spiky Ear Pichu eggs
diff --git a/PKHeX.Core/Legality/Tables/AltFormInfo.cs b/PKHeX.Core/Legality/Tables/AltFormInfo.cs
index 3b7fe3dba..92ecd289a 100644
--- a/PKHeX.Core/Legality/Tables/AltFormInfo.cs
+++ b/PKHeX.Core/Legality/Tables/AltFormInfo.cs
@@ -204,5 +204,88 @@ private static HashSet GetBattleFormSet()
hs.UnionWith(BattlePrimals);
return hs;
}
+
+ ///
+ /// Chhecks if the for the is a Totem form.
+ ///
+ /// Entity species
+ /// Entity form
+ /// Current generation format
+ public static bool IsTotemForm(int species, int form, int format)
+ {
+ if (format != 7)
+ return false;
+ if (form == 0)
+ return false;
+ if (!Legal.Totem_USUM.Contains(species))
+ return false;
+ if (species == (int)Mimikyu)
+ return form == 2 || form == 3;
+ if (Legal.Totem_Alolan.Contains(species))
+ return form == 2;
+ return form == 1;
+ }
+
+ ///
+ /// Gets the base for the when the Totem form is reverted (on transfer).
+ ///
+ /// Entity species
+ /// Entity form
+ public static int GetTotemBaseForm(int species, int form)
+ {
+ if (species == (int)Mimikyu)
+ return form - 2;
+ return form - 1;
+ }
+
+ ///
+ /// Checks if the exists for the without having an associated index.
+ ///
+ /// Entity species
+ /// Entity form
+ /// Current generation format
+ ///
+ public static bool IsValidOutOfBoundsForme(int species, int form, int format)
+ {
+ return (Species) species switch
+ {
+ Unown => form < (format == 2 ? 26 : 28), // A-Z : A-Z?!
+ Mothim => form < 3, // Burmy base form is kept
+
+ Scatterbug => form < 18, // Vivillon Pre-evolutions
+ Spewpa => form < 18, // Vivillon Pre-evolutions
+
+ _ => false
+ };
+ }
+
+ ///
+ /// Checks if the data should have a drop-down selection visible for the value.
+ ///
+ /// Game specific personal info
+ /// ID
+ /// ID
+ /// True if has formes that can be provided by , otherwise false for none.
+ public static bool HasFormSelection(PersonalInfo pi, int species, int format)
+ {
+ if (format <= 3 && species != (int)Unown)
+ return false;
+
+ if (HasFormeValuesNotIndicatedByPersonal.Contains(species))
+ return true;
+
+ int count = pi.FormeCount;
+ return count > 1;
+ }
+
+ ///
+ ///
+ ///
+ private static readonly HashSet HasFormeValuesNotIndicatedByPersonal = new HashSet
+ {
+ (int)Unown,
+ (int)Mothim, // (Burmy forme carried over, not cleared)
+ (int)Scatterbug, (int)Spewpa, // Vivillon pre-evos
+ };
}
}
diff --git a/PKHeX.Core/Legality/Verifiers/FormVerifier.cs b/PKHeX.Core/Legality/Verifiers/FormVerifier.cs
index 41c577e27..116dd3aee 100644
--- a/PKHeX.Core/Legality/Verifiers/FormVerifier.cs
+++ b/PKHeX.Core/Legality/Verifiers/FormVerifier.cs
@@ -39,7 +39,7 @@ private CheckResult VerifyForm(LegalityAnalysis data)
var EncounterMatch = data.EncounterMatch;
var Info = data.Info;
- if (!PersonalInfo.IsFormeWithinRange(form) && !FormConverter.IsValidOutOfBoundsForme(species, form, Info.Generation))
+ if (!PersonalInfo.IsFormeWithinRange(form) && !AltFormInfo.IsValidOutOfBoundsForme(species, form, Info.Generation))
return GetInvalid(string.Format(LFormInvalidRange, count - 1, form));
if (EncounterMatch is EncounterSlot w && w.Area.Type == SlotType.FriendSafari)
@@ -48,7 +48,7 @@ private CheckResult VerifyForm(LegalityAnalysis data)
}
else if (EncounterMatch is EncounterEgg)
{
- if (FormConverter.IsTotemForm(species, form, data.Info.Generation))
+ if (AltFormInfo.IsTotemForm(species, form, data.Info.Generation))
return GetInvalid(LFormInvalidGame);
}
diff --git a/PKHeX.Core/Legality/Verifiers/TransferVerifier.cs b/PKHeX.Core/Legality/Verifiers/TransferVerifier.cs
index 0ab950e5c..55e34f08d 100644
--- a/PKHeX.Core/Legality/Verifiers/TransferVerifier.cs
+++ b/PKHeX.Core/Legality/Verifiers/TransferVerifier.cs
@@ -128,11 +128,11 @@ public void VerifyTransferLegalityG8(LegalityAnalysis data)
}
else if (enc.Generation < 8 && pkm.Format >= 8)
{
- if (enc is EncounterStatic7 s && FormConverter.IsTotemForm(s.Species, s.Form, 7))
+ if (enc is EncounterStatic7 s && AltFormInfo.IsTotemForm(s.Species, s.Form, 7))
{
if (Legal.Totem_NoTransfer.Contains(s.Species))
data.AddLine(GetInvalid(LTransferBad));
- if (pkm.AltForm != FormConverter.GetTotemBaseForm(s.Species, s.Form))
+ if (pkm.AltForm != AltFormInfo.GetTotemBaseForm(s.Species, s.Form))
data.AddLine(GetInvalid(LTransferBad));
}
diff --git a/PKHeX.Core/PKHeX.Core.csproj b/PKHeX.Core/PKHeX.Core.csproj
index d98d299c2..48230e3aa 100644
--- a/PKHeX.Core/PKHeX.Core.csproj
+++ b/PKHeX.Core/PKHeX.Core.csproj
@@ -1713,9 +1713,4 @@
-
-
-
-
-
diff --git a/PKHeX.Core/PKM/PK7.cs b/PKHeX.Core/PKM/PK7.cs
index 230baa742..773d175cf 100644
--- a/PKHeX.Core/PKM/PK7.cs
+++ b/PKHeX.Core/PKM/PK7.cs
@@ -633,8 +633,8 @@ public PK8 ConvertToPK8()
};
// Wipe Totem Forms
- if (FormConverter.IsTotemForm(Species, AltForm, 7))
- pk8.AltForm = FormConverter.GetTotemBaseForm(Species, AltForm);
+ if (AltFormInfo.IsTotemForm(Species, AltForm, 7))
+ pk8.AltForm = AltFormInfo.GetTotemBaseForm(Species, AltForm);
// Fix PP and Stats
pk8.Heal();
diff --git a/PKHeX.Core/PKM/Util/FormConverter.cs b/PKHeX.Core/PKM/Util/FormConverter.cs
index 527c56403..bbe86d166 100644
--- a/PKHeX.Core/PKM/Util/FormConverter.cs
+++ b/PKHeX.Core/PKM/Util/FormConverter.cs
@@ -5,7 +5,7 @@
namespace PKHeX.Core
{
///
- /// Logic for various related requests.
+ /// Retrieves localized form names for indicating values.
///
public static class FormConverter
{
@@ -47,44 +47,6 @@ public static string[] GetFormList(int species, IReadOnlyList types, IRe
// this is a hack; depends on currently loaded SaveFile's Game ID
private static bool IsGG() => PKMConverter.Game == (int)GameVersion.GP || PKMConverter.Game == (int)GameVersion.GE;
- public static bool IsTotemForm(int species, int form, int generation)
- {
- if (generation != 7)
- return false;
- if (form == 0)
- return false;
- if (!Legal.Totem_USUM.Contains(species))
- return false;
- if (species == (int)Mimikyu)
- return form == 2 || form == 3;
- if (Legal.Totem_Alolan.Contains(species))
- return form == 2;
- return form == 1;
- }
-
- public static int GetTotemBaseForm(int species, int form)
- {
- if (species == (int)Mimikyu)
- return form - 2;
- return form - 1;
- }
-
- public static bool IsValidOutOfBoundsForme(int species, int form, int generation)
- {
- switch ((Species)species)
- {
- case Unown:
- return form < (generation == 2 ? 26 : 28); // A-Z : A-Z?!
- case Mothim: // Burmy base form is kept
- return form < 3;
- case Scatterbug:
- case Spewpa: // Vivillon Pre-evolutions
- return form < 18;
- default:
- return false;
- }
- }
-
private static readonly string[] EMPTY = { string.Empty };
private const string Starter = nameof(Starter);
@@ -904,32 +866,6 @@ private static string[] GetFormsUnown(int generation)
015, 018, 080, 208, 254, 260, 302, 319, 323, 334, 362, 373, 376, 384, 428, 475, 531, 719,
};
- ///
- /// Checks if the data should have a drop-down selection visible for the value.
- ///
- /// Game specific personal info
- /// ID
- /// ID
- /// True if has formes that can be provided by , otherwise false for none.
- public static bool HasFormSelection(PersonalInfo pi, int species, int format)
- {
- if (format <= 3 && species != (int)Unown)
- return false;
-
- if (HasFormeValuesNotIndicatedByPersonal.Contains(species))
- return true;
-
- int count = pi.FormeCount;
- return count > 1;
- }
-
- private static readonly HashSet HasFormeValuesNotIndicatedByPersonal = new HashSet
- {
- (int)Unown,
- (int)Mothim, // (Burmy forme carried over, not cleared)
- (int)Scatterbug, (int)Spewpa, // Vivillon pre-evos
- };
-
private static string[] GetMegaSingle(IReadOnlyList types, IReadOnlyList forms)
{
return new[]
@@ -969,7 +905,7 @@ private static string[] GetFormsGalarSlowbro(IReadOnlyList types, IReadO
}
private const int Galarian = 1068;
- // private const int Gigantamax = 1069;
+ private const int Gigantamax = 1069;
private const int Gulping = 1070;
private const int Gorging = 1071;
private const int LowKey = 1072;
@@ -995,6 +931,8 @@ private static string[] GetFormsGalarSlowbro(IReadOnlyList types, IReadO
private const int CalyIce = 1089; // Ice
private const int CalyGhost = 1090; // Shadow
+ public static string GetGigantamaxName(IReadOnlyList forms) => forms[Gigantamax];
+
public static string[] GetAlcremieFormList(IReadOnlyList forms)
{
var result = new string[63];
diff --git a/PKHeX.Core/Saves/Util/SaveExtensions.cs b/PKHeX.Core/Saves/Util/SaveExtensions.cs
index dd2a84807..627084656 100644
--- a/PKHeX.Core/Saves/Util/SaveExtensions.cs
+++ b/PKHeX.Core/Saves/Util/SaveExtensions.cs
@@ -95,7 +95,7 @@ private static IReadOnlyList GetSaveFileErrata(this SaveFile sav, PKM pk
else if (sav.MaxSpeciesID < pkm.Species)
errata.Add($"{MsgIndexSpeciesGame} {strings.Species[pkm.Species]}");
- if (!sav.Personal[pkm.Species].IsFormeWithinRange(pkm.AltForm) && !FormConverter.IsValidOutOfBoundsForme(pkm.Species, pkm.AltForm, pkm.GenNumber))
+ if (!sav.Personal[pkm.Species].IsFormeWithinRange(pkm.AltForm) && !AltFormInfo.IsValidOutOfBoundsForme(pkm.Species, pkm.AltForm, pkm.GenNumber))
errata.Add(string.Format(LegalityCheckStrings.LFormInvalidRange, Math.Max(0, sav.Personal[pkm.Species].FormeCount - 1), pkm.AltForm));
if (pkm.Moves.Any(m => m > strings.Move.Count))
diff --git a/PKHeX.Drawing/Sprites/SpriteBuilder.cs b/PKHeX.Drawing/Sprites/SpriteBuilder.cs
index bf4101f1b..66b3a0ac8 100644
--- a/PKHeX.Drawing/Sprites/SpriteBuilder.cs
+++ b/PKHeX.Drawing/Sprites/SpriteBuilder.cs
@@ -84,7 +84,7 @@ public Image GetSprite(Image baseSprite, int species, int heldItem, bool isEgg,
private Image GetBaseImage(int species, int form, int gender, uint formarg, bool shiny, int generation)
{
- var img = FormConverter.IsTotemForm(species, form, generation)
+ var img = AltFormInfo.IsTotemForm(species, form, generation)
? GetBaseImageTotem(species, form, gender, formarg, shiny, generation)
: GetBaseImageDefault(species, form, gender, formarg, shiny, generation);
return img ?? GetBaseImageFallback(species, form, gender, formarg, shiny, generation);
@@ -92,7 +92,7 @@ private Image GetBaseImage(int species, int form, int gender, uint formarg, bool
private Image? GetBaseImageTotem(int species, int form, int gender, uint formarg, bool shiny, int generation)
{
- var baseform = FormConverter.GetTotemBaseForm(species, form);
+ var baseform = AltFormInfo.GetTotemBaseForm(species, form);
var baseImage = GetBaseImageDefault(species, baseform, gender, formarg, shiny, generation);
if (baseImage == null)
return null;
diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs
index 50a5bad46..4a2bf8ce8 100644
--- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs
+++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs
@@ -427,7 +427,7 @@ private void SetForms()
{
int species = Entity.Species;
var pi = RequestSaveFile.Personal[species];
- bool hasForms = FormConverter.HasFormSelection(pi, species, Entity.Format);
+ bool hasForms = AltFormInfo.HasFormSelection(pi, species, Entity.Format);
CB_Form.Enabled = CB_Form.Visible = Label_Form.Visible = hasForms;
if (HaX && Entity.Format >= 4)
diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen6/SAV_SecretBase.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen6/SAV_SecretBase.cs
index d59e1be96..9acad5716 100644
--- a/PKHeX.WinForms/Subforms/Save Editors/Gen6/SAV_SecretBase.cs
+++ b/PKHeX.WinForms/Subforms/Save Editors/Gen6/SAV_SecretBase.cs
@@ -458,7 +458,7 @@ private void SetAbilityList()
private void SetForms()
{
int species = WinFormsUtil.GetIndex(CB_Species);
- bool hasForms = FormConverter.HasFormSelection(PersonalTable.AO[species], species, 6);
+ bool hasForms = AltFormInfo.HasFormSelection(PersonalTable.AO[species], species, 6);
CB_Form.Enabled = CB_Form.Visible = hasForms;
CB_Form.InitializeBinding();
diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_PokedexGG.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_PokedexGG.cs
index 3f1dfd0d3..740ac5594 100644
--- a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_PokedexGG.cs
+++ b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_PokedexGG.cs
@@ -133,7 +133,7 @@ private bool FillLBForms()
int fspecies = LB_Species.SelectedIndex + 1;
var bspecies = Dex.GetBaseSpecies(fspecies);
- bool hasForms = FormConverter.HasFormSelection(SAV.Personal[bspecies], bspecies, 7);
+ bool hasForms = AltFormInfo.HasFormSelection(SAV.Personal[bspecies], bspecies, 7);
LB_Forms.Enabled = hasForms;
if (!hasForms) return false;
var ds = FormConverter.GetFormList(bspecies, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation).ToList();
diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_PokedexSM.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_PokedexSM.cs
index 00f2c8df2..19af489f2 100644
--- a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_PokedexSM.cs
+++ b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_PokedexSM.cs
@@ -120,7 +120,7 @@ private bool FillLBForms()
int fspecies = LB_Species.SelectedIndex + 1;
var bspecies = Dex.GetBaseSpecies(fspecies);
- bool hasForms = FormConverter.HasFormSelection(SAV.Personal[bspecies], bspecies, 7);
+ bool hasForms = AltFormInfo.HasFormSelection(SAV.Personal[bspecies], bspecies, 7);
LB_Forms.Enabled = hasForms;
if (!hasForms)
return false;