diff --git a/PKHeX.Core/Editing/CommonEdits.cs b/PKHeX.Core/Editing/CommonEdits.cs
index ba6a804e8..f6413760b 100644
--- a/PKHeX.Core/Editing/CommonEdits.cs
+++ b/PKHeX.Core/Editing/CommonEdits.cs
@@ -9,14 +9,14 @@ namespace PKHeX.Core
public static class CommonEdits
{
///
- /// Setting which enables/disables automatic manipulation of when importing from a .
+ /// Setting which enables/disables automatic manipulation of when importing from a .
///
public static bool ShowdownSetIVMarkings { get; set; } = true;
///
/// Setting which causes the to the in Gen8+ formats.
///
- public static bool ShowdownSetBehaviorNature { get; set; } = false;
+ public static bool ShowdownSetBehaviorNature { get; set; }
///
/// Sets the to the provided value.
@@ -185,11 +185,11 @@ public static void SetNature(this PKM pk, int nature)
}
///
- /// Copies details to the .
+ /// Copies details to the .
///
/// Pokémon to modify.
- /// details to copy from.
- public static void ApplySetDetails(this PKM pk, ShowdownSet Set)
+ /// details to copy from.
+ public static void ApplySetDetails(this PKM pk, IBattleTemplate Set)
{
pk.Species = Math.Min(pk.MaxSpeciesID, Set.Species);
pk.SetMoves(Set.Moves, true);
diff --git a/PKHeX.Core/Editing/IBattleTemplate.cs b/PKHeX.Core/Editing/IBattleTemplate.cs
new file mode 100644
index 000000000..8045f4a74
--- /dev/null
+++ b/PKHeX.Core/Editing/IBattleTemplate.cs
@@ -0,0 +1,85 @@
+namespace PKHeX.Core
+{
+ public interface IBattleTemplate : IGigantamax
+ {
+ ///
+ /// of the Set entity.
+ ///
+ int Species { get; }
+
+ ///
+ /// of the Set entity it is specific to.
+ ///
+ int Format { get; }
+
+ ///
+ /// of the Set entity.
+ ///
+ string Nickname { get; }
+
+ ///
+ /// name of the Set entity.
+ ///
+ string Gender { get; }
+
+ ///
+ /// of the Set entity.
+ ///
+ int HeldItem { get; }
+
+ ///
+ /// of the Set entity.
+ ///
+ int Ability { get; }
+
+ ///
+ /// of the Set entity.
+ ///
+ int Level { get; }
+
+ ///
+ /// of the Set entity.
+ ///
+ bool Shiny { get; }
+
+ ///
+ /// of the Set entity.
+ ///
+ int Friendship { get; }
+
+ ///
+ /// of the Set entity.
+ ///
+ int Nature { get; }
+
+ ///
+ /// name of the Set entity, stored in PKHeX style (instead of Showdown's)
+ ///
+ string Form { get; }
+
+ ///
+ /// of the Set entity.
+ ///
+ int FormIndex { get; }
+
+ ///
+ /// of the Set entity.
+ ///
+ int HiddenPowerType { get; }
+
+ ///
+ /// of the Set entity.
+ ///
+ int[] EVs { get; }
+
+ ///
+ /// of the Set entity.
+ ///
+ int[] IVs { get; }
+
+ ///
+ /// of the Set entity.
+ ///
+ int[] Moves { get; }
+ }
+}
diff --git a/PKHeX.Core/Editing/ShowdownSet.cs b/PKHeX.Core/Editing/ShowdownSet.cs
index 6fe138b56..5762f4144 100644
--- a/PKHeX.Core/Editing/ShowdownSet.cs
+++ b/PKHeX.Core/Editing/ShowdownSet.cs
@@ -7,7 +7,7 @@ namespace PKHeX.Core
///
/// Logic for exporting and importing data in Pokémon Showdown's text format.
///
- public sealed class ShowdownSet : IGigantamax
+ public sealed class ShowdownSet : IBattleTemplate
{
private static readonly string[] genders = {"M", "F", ""};
private static readonly string[] genderForms = {"", "F", ""};
@@ -21,89 +21,55 @@ public sealed class ShowdownSet : IGigantamax
private const int MAX_SPECIES = (int)Core.Species.MAX_COUNT - 1;
private static readonly GameStrings DefaultStrings = GameInfo.GetStrings(GameLanguage.DefaultLanguage);
- ///
- /// of the Set entity.
- ///
+ ///
public int Species { get; private set; } = -1;
- ///
- /// of the Set entity it is specific to.
- ///
+ ///
public int Format { get; private set; } = PKMConverter.Format;
- ///
- /// of the Set entity.
- ///
+ ///
public string Nickname { get; set; } = string.Empty;
- ///
- /// name of the Set entity.
- ///
+ ///
public string Gender { get; private set; } = string.Empty;
- ///
- /// of the Set entity.
- ///
+ ///
public int HeldItem { get; private set; }
- ///
- /// of the Set entity.
- ///
+ ///
public int Ability { get; private set; } = -1;
- ///
- /// of the Set entity.
- ///
+ ///
public int Level { get; private set; } = 100;
- ///
- /// of the Set entity.
- ///
+ ///
public bool Shiny { get; private set; }
- ///
- /// of the Set entity.
- ///
+ ///
public int Friendship { get; private set; } = 255;
- ///
- /// of the Set entity.
- ///
+ ///
public int Nature { get; set; } = -1;
- ///
- /// name of the Set entity, stored in PKHeX style (instead of Showdown's)
- ///
+ ///
public string Form { get; private set; } = string.Empty;
- ///
- /// of the Set entity.
- ///
+ ///
public int FormIndex { get; private set; }
- ///
- /// of the Set entity.
- ///
+ ///
public int[] EVs { get; private set; } = {00, 00, 00, 00, 00, 00};
- ///
- /// of the Set entity.
- ///
+ ///
public int[] IVs { get; private set; } = {31, 31, 31, 31, 31, 31};
- ///
- /// of the Set entity.
- ///
+ ///
public int HiddenPowerType { get; set; } = -1;
- ///
- /// of the Set entity.
- ///
+ ///
public int[] Moves { get; } = {0, 0, 0, 0};
- ///
- /// of the Set entity.
- ///
+ ///
public bool CanGigantamax { get; set; }
///
@@ -118,29 +84,17 @@ public sealed class ShowdownSet : IGigantamax
private int[] EVsSpeedFirst => new[] {EVs[0], EVs[1], EVs[2], EVs[5], EVs[3], EVs[4]};
private int[] EVsSpeedLast => new[] {EVs[0], EVs[1], EVs[2], EVs[4], EVs[5], EVs[3]};
- ///
- /// Loads a new blank .
- ///
- public ShowdownSet() { }
-
///
/// Loads a new from the input string.
///
/// Single-line string which will be split before loading.
- public ShowdownSet(string input)
- {
- var lines = input.Split(Splitters, StringSplitOptions.None);
- LoadLines(lines);
- }
+ public ShowdownSet(string input) : this(input.Split(Splitters, 0)) { }
///
/// Loads a new from the input string.
///
/// Enumerable list of lines.
- public ShowdownSet(IEnumerable lines)
- {
- LoadLines(lines);
- }
+ public ShowdownSet(IEnumerable lines) => LoadLines(lines);
private void LoadLines(IEnumerable lines)
{
@@ -164,7 +118,6 @@ private void LoadLines(IEnumerable lines)
private void ParseLines(IEnumerable lines)
{
- // ReSharper disable once GenericEnumeratorNotDisposed
using var e = lines.GetEnumerator();
if (!e.MoveNext())
return;
diff --git a/PKHeX.Core/Legality/Encounters/Generator/EncounterCriteria.cs b/PKHeX.Core/Legality/Encounters/Generator/EncounterCriteria.cs
index e24e5759d..517765bad 100644
--- a/PKHeX.Core/Legality/Encounters/Generator/EncounterCriteria.cs
+++ b/PKHeX.Core/Legality/Encounters/Generator/EncounterCriteria.cs
@@ -43,7 +43,7 @@ bool ivCanMatch(int spec, int enc)
return true;
}
- public static EncounterCriteria GetCriteria(ShowdownSet s)
+ public static EncounterCriteria GetCriteria(IBattleTemplate s)
{
int gender = string.IsNullOrWhiteSpace(s.Gender) ? -1 : PKX.GetGenderFromString(s.Gender);
return new EncounterCriteria
diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs
index 33e44434f..2bb4b8716 100644
--- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs
+++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs
@@ -1844,9 +1844,9 @@ public void EnableDragDrop(DragEventHandler enter, DragEventHandler drop)
}
// ReSharper disable once FieldCanBeMadeReadOnly.Global
- public Action LoadShowdownSet;
+ public Action LoadShowdownSet;
- private void LoadShowdownSetDefault(ShowdownSet Set)
+ private void LoadShowdownSetDefault(IBattleTemplate Set)
{
var pk = PreparePKM();
pk.ApplySetDetails(Set);
diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs
index 694b5eb3c..5f5ce4a91 100644
--- a/PKHeX.WinForms/MainWindow/Main.cs
+++ b/PKHeX.WinForms/MainWindow/Main.cs
@@ -494,12 +494,12 @@ private void ClickShowdownImportPKM(object sender, EventArgs e)
{ WinFormsUtil.Alert(MsgClipboardFailRead); return; }
// Get Simulator Data
- ShowdownSet Set = new ShowdownSet(Clipboard.GetText());
+ var Set = new ShowdownSet(Clipboard.GetText());
if (Set.Species < 0)
{ WinFormsUtil.Alert(MsgSimulatorFailClipboard); return; }
- if (Set.Nickname?.Length > C_SAV.SAV.NickLength)
+ if (Set.Nickname.Length > C_SAV.SAV.NickLength)
Set.Nickname = Set.Nickname.Substring(0, C_SAV.SAV.NickLength);
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MsgSimulatorLoad, Set.Text))