diff --git a/PKHeX.Core/Editing/Applicators/MoveSetApplicator.cs b/PKHeX.Core/Editing/Applicators/MoveSetApplicator.cs
index e769758d3..566031efc 100644
--- a/PKHeX.Core/Editing/Applicators/MoveSetApplicator.cs
+++ b/PKHeX.Core/Editing/Applicators/MoveSetApplicator.cs
@@ -15,7 +15,7 @@ public static class MoveSetApplicator
public static int[] GetMoveSet(this PKM pk, bool random = false)
{
var la = new LegalityAnalysis(pk);
- var moves = pk.GetMoveSet(la, random);
+ var moves = la.GetMoveSet(random);
if (random)
return moves;
@@ -31,16 +31,16 @@ public static int[] GetMoveSet(this PKM pk, bool random = false)
///
/// Gets a moveset for the provided data.
///
- /// PKM to generate for
/// Precomputed optional
/// Full movepool & shuffling
/// 4 moves
- public static int[] GetMoveSet(this PKM pk, LegalityAnalysis la, bool random = false)
+ public static int[] GetMoveSet(this LegalityAnalysis la, bool random = false)
{
int[] m = la.GetSuggestedMoves(tm: random, tutor: random, reminder: random);
- if (!m.All(z => la.AllSuggestedMovesAndRelearn().Contains(z)))
- m = m.Intersect(la.AllSuggestedMovesAndRelearn()).ToArray();
+ var learn = la.AllSuggestedMovesAndRelearn();
+ if (!m.All(z => learn.Contains(z)))
+ m = m.Intersect(learn).ToArray();
if (random)
Util.Shuffle(m);
diff --git a/PKHeX.Core/Editing/Bulk/BatchEditing.cs b/PKHeX.Core/Editing/Bulk/BatchEditing.cs
index 5461c88b3..3fff45b32 100644
--- a/PKHeX.Core/Editing/Bulk/BatchEditing.cs
+++ b/PKHeX.Core/Editing/Bulk/BatchEditing.cs
@@ -251,7 +251,7 @@ private static ModifyResult SetPKMProperty(StringInstruction cmd, PKMInfo info,
if (cmd.PropertyValue.StartsWith(CONST_SUGGEST))
return SetSuggestedPKMProperty(cmd.PropertyName, info, cmd.PropertyValue);
if (cmd.PropertyValue == CONST_RAND && cmd.PropertyName == nameof(PKM.Moves))
- return SetMoves(pk, pk.GetMoveSet(info.Legality, true));
+ return SetMoves(pk, info.Legality.GetMoveSet(true));
if (SetComplexProperty(pk, cmd))
return ModifyResult.Modified;
@@ -427,7 +427,7 @@ private static ModifyResult SetSuggestedPKMProperty(string name, PKMInfo info, s
return ModifyResult.Modified;
case nameof(PKM.Moves):
- return SetMoves(pk, pk.GetMoveSet(la: info.Legality));
+ return SetMoves(pk, info.Legality.GetMoveSet());
case nameof(PKM.Ball):
BallApplicator.ApplyBallLegalByColor(pk);
diff --git a/PKHeX.Core/Legality/LegalityCheckStrings.cs b/PKHeX.Core/Legality/LegalityCheckStrings.cs
index 667b45c46..6b2ac45bb 100644
--- a/PKHeX.Core/Legality/LegalityCheckStrings.cs
+++ b/PKHeX.Core/Legality/LegalityCheckStrings.cs
@@ -31,13 +31,13 @@ public static class LegalityCheckStrings
/// Format text for exporting a legality check result for a Relearn Move.
public static string L_F0_RM_1_2 { get; set; } = "{0} Relearn Move {1}: {2}";
- /// Format text for exporting the type of Encounter that was matched for the the
+ /// Format text for exporting the type of Encounter that was matched for the
public static string L_FEncounterType_0 { get; set; } = "Encounter Type: {0}";
- /// Format text for exporting the that was matched for the the
+ /// Format text for exporting the that was matched for the
public static string L_FOriginSeed_0 { get; set; } = "Origin Seed: {0}";
- /// Format text for exporting the that was matched for the the
+ /// Format text for exporting the that was matched for the
public static string L_FPIDType_0 { get; set; } = "PID Type: {0}";
/// Severity string for
diff --git a/PKHeX.Core/Saves/Access/SaveBlockAccessor8SWSH.cs b/PKHeX.Core/Saves/Access/SaveBlockAccessor8SWSH.cs
index e305d3cd3..2f021ea16 100644
--- a/PKHeX.Core/Saves/Access/SaveBlockAccessor8SWSH.cs
+++ b/PKHeX.Core/Saves/Access/SaveBlockAccessor8SWSH.cs
@@ -76,7 +76,7 @@ public SaveBlockAccessor8SWSH(SAV8SWSH sav)
private const uint KMyStatus = 0xf25c070e; // Trainer Details
private const uint KFriendLeagueCards = 0x28e707f5; // League Cards received from other players
private const uint KNPCLeagueCards = 0xb1c26fb0; // League Cards received from NPCs
-
+
// Rental Teams - Objects (Blocks) (Incrementing internal names?)
private const uint KRentalTeam1 = 0x149A1DD0;
//private const uint KRentalTeam2 = 0x159A1F63; // does not exist
diff --git a/PKHeX.Core/Saves/SAV4Sinnoh.cs b/PKHeX.Core/Saves/SAV4Sinnoh.cs
index 903cf1b22..c029a64bb 100644
--- a/PKHeX.Core/Saves/SAV4Sinnoh.cs
+++ b/PKHeX.Core/Saves/SAV4Sinnoh.cs
@@ -72,7 +72,7 @@ public PoketchColor PoketchColor
public bool PoketchFlag6 { get => (PoketchPacked & 0x40) != 0; set => PoketchPacked = (byte)(value ? (PoketchPacked | 0x40) : (PoketchPacked & ~0x40)); }
public bool PoketchFlag7 { get => (PoketchPacked & 0x80) != 0; set => PoketchPacked = (byte)(value ? (PoketchPacked | 0x80) : (PoketchPacked & ~0x80)); }
- private byte Poketch1 { get => General[PoketchStart + 1]; set => General[PoketchStart + 1] = value; }
+ public byte Poketch1 { get => General[PoketchStart + 1]; set => General[PoketchStart + 1] = value; }
public sbyte CurrentPoketchApp { get => (sbyte)General[PoketchStart + 2]; set => General[PoketchStart + 2] = (byte)Math.Min((sbyte)PoketchApp.Alarm_Clock, value); }
public bool GetPoketchAppUnlocked(PoketchApp index)
diff --git a/PKHeX.Core/Saves/Substructures/Inventory/InventoryPouch8.cs b/PKHeX.Core/Saves/Substructures/Inventory/InventoryPouch8.cs
index 551845d4f..8d901397b 100644
--- a/PKHeX.Core/Saves/Substructures/Inventory/InventoryPouch8.cs
+++ b/PKHeX.Core/Saves/Substructures/Inventory/InventoryPouch8.cs
@@ -84,11 +84,10 @@ internal void SanitizeCounts()
public static int GetSuggestedCount(InventoryType t, int item, int requestVal)
{
- switch (t)
+ return t switch
{
- default:
- return requestVal;
- }
+ _ => requestVal
+ };
}
}
-}
\ No newline at end of file
+}
diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs
index 2bb4b8716..012394614 100644
--- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs
+++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs
@@ -97,7 +97,7 @@ public bool HideSecretValues
public bool Unicode { get; set; } = true;
private bool _hax;
public bool HaX { get => _hax; set => _hax = Stats.HaX = value; }
- public byte[] LastData { private get; set; }
+ private byte[] LastData;
public PKM Data { get => Entity; set => Entity = value; }
public PKM Entity { get; private set; }
@@ -581,7 +581,7 @@ private void ClickPP(object sender, EventArgs e)
private void ClickPPUps(object sender, EventArgs e)
{
bool min = ModifierKeys.HasFlag(Keys.Control);
- static int getValue(ComboBox cb, bool zero) => zero || WinFormsUtil.GetIndex(cb) == 0 ? 0 : 3;
+ static int getValue(ListControl cb, bool zero) => zero || WinFormsUtil.GetIndex(cb) == 0 ? 0 : 3;
CB_PPu1.SelectedIndex = getValue(CB_Move1, min);
CB_PPu2.SelectedIndex = getValue(CB_Move2, min);
CB_PPu3.SelectedIndex = getValue(CB_Move3, min);
@@ -703,8 +703,8 @@ private void ClickMoves(object sender, EventArgs e)
private bool SetSuggestedMoves(bool random = false, bool silent = false)
{
- int[] m = Entity.GetMoveSet(random);
- if (m.Any(z => z != 0) != true)
+ var m = Entity.GetMoveSet(random);
+ if (m.All(z => z == 0) || m.Length == 0)
{
if (!silent)
WinFormsUtil.Alert(MsgPKMSuggestionFormat);
diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs
index 5f5ce4a91..5331c06f4 100644
--- a/PKHeX.WinForms/MainWindow/Main.cs
+++ b/PKHeX.WinForms/MainWindow/Main.cs
@@ -849,7 +849,7 @@ private static bool TryBackupExportCheck(SaveFile sav, string path)
private static bool IsFileLocked(string path)
{
- try { return File.GetAttributes(path).HasFlag(FileAttributes.ReadOnly); }
+ try { return (File.GetAttributes(path) & FileAttributes.ReadOnly) != 0; }
catch { return true; }
}