diff --git a/PKHeX.Core/Editing/Saves/Slots/Info/SlotInfoMisc.cs b/PKHeX.Core/Editing/Saves/Slots/Info/SlotInfoMisc.cs
index 7fadf697b..4c6fd5839 100644
--- a/PKHeX.Core/Editing/Saves/Slots/Info/SlotInfoMisc.cs
+++ b/PKHeX.Core/Editing/Saves/Slots/Info/SlotInfoMisc.cs
@@ -10,7 +10,7 @@ namespace PKHeX.Core
public int Offset { get; }
public bool CanWriteTo(SaveFile sav) => false;
public WriteBlockedMessage CanWriteTo(SaveFile sav, PKM pkm) => WriteBlockedMessage.InvalidDestination;
- public StorageSlotType Type { get; set; }
+ public StorageSlotType Type { get; init; }
private readonly byte[] Data; // buffer to r/w
diff --git a/PKHeX.Core/Game/GameStrings/FilteredGameDataSource.cs b/PKHeX.Core/Game/GameStrings/FilteredGameDataSource.cs
index 1f1a47570..bfa4a1d15 100644
--- a/PKHeX.Core/Game/GameStrings/FilteredGameDataSource.cs
+++ b/PKHeX.Core/Game/GameStrings/FilteredGameDataSource.cs
@@ -44,7 +44,7 @@ namespace PKHeX.Core
// Some games cannot acquire every Species that exists. Some can only acquire a subset.
return sav switch
{
- SAV7b _ => source.SpeciesDataSource // LGPE: Kanto 151, Meltan/Melmetal
+ SAV7b => source.SpeciesDataSource // LGPE: Kanto 151, Meltan/Melmetal
.Where(s => s.Value <= (int)Core.Species.Mew || s.Value == (int)Core.Species.Meltan || s.Value == (int)Core.Species.Melmetal),
_ => source.SpeciesDataSource.Where(s => s.Value <= sav.MaxSpeciesID)
};
@@ -58,7 +58,7 @@ namespace PKHeX.Core
var legal = source.LegalMoveDataSource;
return sav switch
{
- SAV7b _ => legal.Where(s => Legal.AllowedMovesGG.Contains((short) s.Value)), // LGPE: Not all moves are available
+ SAV7b => legal.Where(s => Legal.AllowedMovesGG.Contains((short) s.Value)), // LGPE: Not all moves are available
_ => legal.Where(m => m.Value <= sav.MaxMoveID)
};
}
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic.cs
index 19bf02955..7b81f9755 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic.cs
@@ -182,12 +182,12 @@ namespace PKHeX.Core
// E-Reader was only available to Japanese games.
case EncounterStaticShadow {EReader: true}:
// Old Sea Map was only distributed to Japanese games.
- case EncounterStatic3 _ when Species == (int)Core.Species.Mew:
+ case EncounterStatic3 when Species == (int)Core.Species.Mew:
pk.OT_Name = "ゲーフリ";
return (int)LanguageID.Japanese;
// Deoxys for Emerald was not available for Japanese games.
- case EncounterStatic3 _ when Species == (int)Core.Species.Deoxys && Version == GameVersion.E && lang == 1:
+ case EncounterStatic3 when Species == (int)Core.Species.Deoxys && Version == GameVersion.E && lang == 1:
pk.OT_Name = "GF";
return (int)LanguageID.English;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic1E.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic1E.cs
index 72262c44a..cfa56184d 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic1E.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic1E.cs
@@ -10,15 +10,15 @@ namespace PKHeX.Core
///
public sealed class EncounterStatic1E : EncounterStatic1, IFixedGBLanguage
{
- public EncounterGBLanguage Language { get; set; } = EncounterGBLanguage.Japanese;
+ public EncounterGBLanguage Language { get; init; } = EncounterGBLanguage.Japanese;
/// Trainer name for the event.
- public string OT_Name { get; set; } = string.Empty;
+ public string OT_Name { get; init; } = string.Empty;
- public IReadOnlyList OT_Names { get; set; } = Array.Empty();
+ public IReadOnlyList OT_Names { get; init; } = Array.Empty();
/// Trainer ID for the event.
- public int TID { get; set; } = -1;
+ public int TID { get; init; } = -1;
public EncounterStatic1E(int species, int level, GameVersion ver) : base(species, level, ver)
{
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2E.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2E.cs
index b1ff461c6..043502739 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2E.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2E.cs
@@ -10,17 +10,17 @@ namespace PKHeX.Core
///
public sealed class EncounterStatic2E : EncounterStatic2, IFixedGBLanguage
{
- public EncounterGBLanguage Language { get; set; } = EncounterGBLanguage.Japanese;
+ public EncounterGBLanguage Language { get; init; } = EncounterGBLanguage.Japanese;
/// Trainer name for the event.
- public string OT_Name { get; set; } = string.Empty;
+ public string OT_Name { get; init; } = string.Empty;
- public IReadOnlyList OT_Names { get; set; } = Array.Empty();
+ public IReadOnlyList OT_Names { get; init; } = Array.Empty();
/// Trainer ID for the event.
- public int TID { get; set; } = -1;
+ public int TID { get; init; } = -1;
- public int CurrentLevel { get; set; } = -1;
+ public int CurrentLevel { get; init; } = -1;
public EncounterStatic2E(int species, int level, GameVersion ver) : base(species, level, ver)
{
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic3.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic3.cs
index ee14a985a..6edbb37e4 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic3.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic3.cs
@@ -10,7 +10,7 @@ namespace PKHeX.Core
public sealed class EncounterStatic3 : EncounterStatic
{
public override int Generation => 3;
- public bool Roaming { get; set; }
+ public bool Roaming { get; init; }
public EncounterStatic3(int species, int level, GameVersion game)
{
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic5.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic5.cs
index 9ee7b9ccd..d22b02306 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic5.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic5.cs
@@ -9,7 +9,7 @@ namespace PKHeX.Core
public class EncounterStatic5 : EncounterStatic
{
public sealed override int Generation => 5;
- public bool Roaming { get; set; }
+ public bool Roaming { get; init; }
public sealed override bool IsMatchDeferred(PKM pkm)
{
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic6.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic6.cs
index ef6c69517..92e75b764 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic6.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic6.cs
@@ -10,7 +10,7 @@ namespace PKHeX.Core
{
public override int Generation => 6;
- internal IReadOnlyList Contest { set => this.SetContestStats(value); }
+ internal IReadOnlyList Contest { init => this.SetContestStats(value); }
public int CNT_Cool { get; set; }
public int CNT_Beauty { get; set; }
public int CNT_Cute { get; set; }
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic7.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic7.cs
index f4efa0645..da258102e 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic7.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic7.cs
@@ -10,7 +10,7 @@ namespace PKHeX.Core
public sealed class EncounterStatic7 : EncounterStatic, IRelearn
{
public override int Generation => 7;
- public IReadOnlyList Relearn { get; set; } = Array.Empty();
+ public IReadOnlyList Relearn { get; init; } = Array.Empty();
protected override bool IsMatchLocation(PKM pkm)
{
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8.cs
index 32117b5a9..21f70a1a2 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8.cs
@@ -10,7 +10,7 @@ namespace PKHeX.Core
public class EncounterStatic8 : EncounterStatic, IDynamaxLevel, IGigantamax, IRelearn
{
public sealed override int Generation => 8;
- public bool ScriptedNoMarks { get; set; }
+ public bool ScriptedNoMarks { get; init; }
public bool CanGigantamax { get; set; }
public byte DynamaxLevel { get; set; }
diff --git a/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade.cs b/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade.cs
index 460c27981..04249d584 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade.cs
@@ -28,8 +28,8 @@ namespace PKHeX.Core
public Shiny Shiny { get; init; } = Shiny.Never;
public int Ball { get; init; } = 4;
- public int TID { get; internal set; }
- public int SID { get; internal set; }
+ public int TID { get; init; }
+ public int SID { get; init; }
public int OTGender { get; init; } = -1;
public GameVersion Version { get; set; } = GameVersion.Any;
@@ -42,7 +42,7 @@ namespace PKHeX.Core
public int TID7
{
- set
+ init
{
TID = (ushort) value;
SID = value >> 16;
diff --git a/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade3.cs b/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade3.cs
index 9c19a2e50..e1d691bf3 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade3.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade3.cs
@@ -11,7 +11,7 @@ namespace PKHeX.Core
///
public readonly uint PID;
- internal IReadOnlyList Contest { set => this.SetContestStats(value); }
+ internal IReadOnlyList Contest { init => this.SetContestStats(value); }
public int CNT_Cool { get; set; }
public int CNT_Beauty { get; set; }
public int CNT_Cute { get; set; }
diff --git a/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade4PID.cs b/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade4PID.cs
index 4a3c7b660..60013c639 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade4PID.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade4PID.cs
@@ -17,7 +17,7 @@ namespace PKHeX.Core
Shiny = Shiny.FixedValue;
}
- internal IReadOnlyList Contest { set => this.SetContestStats(value); }
+ internal IReadOnlyList Contest { init => this.SetContestStats(value); }
public int CNT_Cool { get; set; }
public int CNT_Beauty { get; set; }
public int CNT_Cute { get; set; }
diff --git a/PKHeX.Core/Legality/Encounters/Generator/EncounterCriteria.cs b/PKHeX.Core/Legality/Encounters/Generator/EncounterCriteria.cs
index faf155046..eedaf7cb6 100644
--- a/PKHeX.Core/Legality/Encounters/Generator/EncounterCriteria.cs
+++ b/PKHeX.Core/Legality/Encounters/Generator/EncounterCriteria.cs
@@ -3,23 +3,23 @@
///
/// Object that can be fed to a converter to ensure that the resulting meets rough specifications.
///
- public sealed class EncounterCriteria
+ public sealed record EncounterCriteria
{
public static readonly EncounterCriteria Unrestricted = new();
- public int Ability { get; set; } = -1;
- public int Gender { get; set; } = -1;
- public Nature Nature { get; set; } = Nature.Random;
- public Shiny Shiny { get; set; } = Shiny.Random;
+ public int Ability { get; init; } = -1;
+ public int Gender { get; init; } = -1;
+ public Nature Nature { get; init; } = Nature.Random;
+ public Shiny Shiny { get; init; } = Shiny.Random;
- public int IV_HP { get; set; } = RandomIV;
- public int IV_ATK { get; set; } = RandomIV;
- public int IV_DEF { get; set; } = RandomIV;
- public int IV_SPA { get; set; } = RandomIV;
- public int IV_SPD { get; set; } = RandomIV;
- public int IV_SPE { get; set; } = RandomIV;
+ public int IV_HP { get; init; } = RandomIV;
+ public int IV_ATK { get; init; } = RandomIV;
+ public int IV_DEF { get; init; } = RandomIV;
+ public int IV_SPA { get; init; } = RandomIV;
+ public int IV_SPD { get; init; } = RandomIV;
+ public int IV_SPE { get; init; } = RandomIV;
- public int HPType { get; set; } = -1;
+ public int HPType { get; init; } = -1;
private const int RandomIV = -1;
diff --git a/PKHeX.Core/Legality/Encounters/Generator/EncounterGenerator12.cs b/PKHeX.Core/Legality/Encounters/Generator/EncounterGenerator12.cs
index a2d4a10b2..0e464c5a8 100644
--- a/PKHeX.Core/Legality/Encounters/Generator/EncounterGenerator12.cs
+++ b/PKHeX.Core/Legality/Encounters/Generator/EncounterGenerator12.cs
@@ -149,10 +149,10 @@ namespace PKHeX.Core
return Encounter switch
{
EncounterTrade1 t1 when t1.IsMatchDeferred(pkm) => GBEncounterPriority.Least,
- EncounterTrade1 _ => GBEncounterPriority.TradeEncounterG1,
- EncounterTrade2 _ => GBEncounterPriority.TradeEncounterG2,
- EncounterStatic _ => GBEncounterPriority.StaticEncounter,
- EncounterSlot _ => GBEncounterPriority.WildEncounter,
+ EncounterTrade1 => GBEncounterPriority.TradeEncounterG1,
+ EncounterTrade2 => GBEncounterPriority.TradeEncounterG2,
+ EncounterStatic => GBEncounterPriority.StaticEncounter,
+ EncounterSlot => GBEncounterPriority.WildEncounter,
_ => GBEncounterPriority.EggEncounter
};
}
diff --git a/PKHeX.Core/Legality/Encounters/Verifiers/EncounterVerifier.cs b/PKHeX.Core/Legality/Encounters/Verifiers/EncounterVerifier.cs
index 87374684f..9865b8955 100644
--- a/PKHeX.Core/Legality/Encounters/Verifiers/EncounterVerifier.cs
+++ b/PKHeX.Core/Legality/Encounters/Verifiers/EncounterVerifier.cs
@@ -45,7 +45,7 @@ namespace PKHeX.Core
return EncounterMatch switch
{
- EncounterSlot1 _ => new CheckResult(Severity.Valid, LEncCondition, CheckIdentifier.Encounter),
+ EncounterSlot1 => new CheckResult(Severity.Valid, LEncCondition, CheckIdentifier.Encounter),
EncounterSlot2 s2 => VerifyWildEncounterGen2(pkm, s2),
EncounterStatic s => VerifyEncounterStatic(pkm, s),
EncounterTrade t => VerifyEncounterTrade(pkm, t),
diff --git a/PKHeX.Core/Legality/LegalityCheckStrings.cs b/PKHeX.Core/Legality/LegalityCheckStrings.cs
index c3c30326a..d1ba985be 100644
--- a/PKHeX.Core/Legality/LegalityCheckStrings.cs
+++ b/PKHeX.Core/Legality/LegalityCheckStrings.cs
@@ -436,8 +436,8 @@ namespace PKHeX.Core
public static string LTransferMet { get; set; } = "Invalid Met Location, expected Poké Transfer or Crown.";
public static string LTransferMetLocation { get; set; } = "Invalid Transfer Met Location.";
public static string LTransferMove { get; set; } = "Incompatible transfer move.";
- public static string LTransferMoveG4HM { get; set; } = "Defog and whirpool. One of the two moves should have been removed before transfered to Generation 5.";
- public static string LTransferMoveHM { get; set; } = "Generation {0} HM. Should have been removed before transfered to Generation {1}.";
+ public static string LTransferMoveG4HM { get; set; } = "Defog and Whirlpool. One of the two moves should have been removed before transferred to Generation 5.";
+ public static string LTransferMoveHM { get; set; } = "Generation {0} HM. Should have been removed before transferred to Generation {1}.";
public static string LTransferNature { get; set; } = "Invalid Nature for transfer Experience.";
public static string LTransferOriginFInvalid0_1 { get; set; } = "{0} origin cannot exist in the currently loaded ({1}) savegame.";
public static string LTransferPIDECBitFlip { get; set; } = "PID should be equal to EC [with top bit flipped]!";
diff --git a/PKHeX.Core/Legality/Moves/MoveParseSource.cs b/PKHeX.Core/Legality/Moves/MoveParseSource.cs
index 9a366027a..ac4340074 100644
--- a/PKHeX.Core/Legality/Moves/MoveParseSource.cs
+++ b/PKHeX.Core/Legality/Moves/MoveParseSource.cs
@@ -6,7 +6,7 @@ namespace PKHeX.Core
internal sealed class MoveParseSource
{
private static readonly int[] Empty = Array.Empty();
- public IReadOnlyList CurrentMoves { get; set; } = Empty;
+ public IReadOnlyList CurrentMoves { get; init; } = Empty;
public IReadOnlyList SpecialSource { get; set; } = Empty;
public int[] NonTradeBackLevelUpMoves { get; set; } = Empty;
diff --git a/PKHeX.Core/Legality/RNG/MethodFinder.cs b/PKHeX.Core/Legality/RNG/MethodFinder.cs
index 49e33aef8..dbcf88c86 100644
--- a/PKHeX.Core/Legality/RNG/MethodFinder.cs
+++ b/PKHeX.Core/Legality/RNG/MethodFinder.cs
@@ -826,7 +826,7 @@ namespace PKHeX.Core
return true;
// forced shiny eggs, when hatched, can lose their detectable correlation.
return g.IsEgg && !pkm.IsEgg && val == PIDType.None && (g.Method == PIDType.BACD_R_S || g.Method == PIDType.BACD_U_S);
- case EncounterStaticShadow _:
+ case EncounterStaticShadow:
return pkm.Version == (int)GameVersion.CXD && (val == PIDType.CXD || val == PIDType.CXDAnti);
case EncounterStatic3 s:
switch (pkm.Version)
@@ -886,7 +886,7 @@ namespace PKHeX.Core
var ver = (GameVersion)pkm.Version;
var IsDPPt = ver == GameVersion.D || ver == GameVersion.P || ver == GameVersion.Pt;
return pkm.IsShiny && IsDPPt && sl.TypeEncounter == EncounterType.TallGrass && !Locations.IsSafariZoneLocation4(sl.Location);
- case PGT _: // manaphy
+ case PGT: // manaphy
return IsG4ManaphyPIDValid(val, pkm);
case PCD d when d.Gift.PK.PID != 1:
return true; // already matches PCD's fixed PID requirement
diff --git a/PKHeX.Core/Legality/Verifiers/BallVerifier.cs b/PKHeX.Core/Legality/Verifiers/BallVerifier.cs
index d74d26c69..afb4d568c 100644
--- a/PKHeX.Core/Legality/Verifiers/BallVerifier.cs
+++ b/PKHeX.Core/Legality/Verifiers/BallVerifier.cs
@@ -34,7 +34,7 @@ namespace PKHeX.Core
return VerifyBallEquals(data, t.Ball);
case EncounterStatic {Gift: true} s:
return VerifyBallEquals(data, s.Ball);
- case EncounterSlot8GO _: // Already a strict match
+ case EncounterSlot8GO: // Already a strict match
return GetResult(true);
}
@@ -56,8 +56,8 @@ namespace PKHeX.Core
{
EncounterStatic e => VerifyBallStatic(data, e),
EncounterSlot w => VerifyBallWild(data, w),
- EncounterEgg _ => VerifyBallEgg(data),
- EncounterInvalid _ => VerifyBallEquals(data, pkm.Ball), // ignore ball, pass whatever
+ EncounterEgg => VerifyBallEgg(data),
+ EncounterInvalid => VerifyBallEquals(data, pkm.Ball), // ignore ball, pass whatever
_ => VerifyBallEquals(data, (int)Poke)
};
}
diff --git a/PKHeX.Core/Legality/Verifiers/HistoryVerifier.cs b/PKHeX.Core/Legality/Verifiers/HistoryVerifier.cs
index 63ce58cc6..54b2324e0 100644
--- a/PKHeX.Core/Legality/Verifiers/HistoryVerifier.cs
+++ b/PKHeX.Core/Legality/Verifiers/HistoryVerifier.cs
@@ -177,8 +177,8 @@ namespace PKHeX.Core
return true;
return enc switch
{
- EncounterTrade _ => false,
- EncounterSlot8GO _ => false,
+ EncounterTrade => false,
+ EncounterSlot8GO => false,
WC6 wc6 when wc6.OT_Name.Length > 0 => false,
WC7 wc7 when wc7.OT_Name.Length > 0 && wc7.TID != 18075 => false, // Ash Pikachu QR Gift doesn't set Current Handler
WC8 wc8 when wc8.GetHasOT(pkm.Language) => false,
diff --git a/PKHeX.Core/Legality/Verifiers/MarkVerifier.cs b/PKHeX.Core/Legality/Verifiers/MarkVerifier.cs
index c4b38639a..96363365c 100644
--- a/PKHeX.Core/Legality/Verifiers/MarkVerifier.cs
+++ b/PKHeX.Core/Legality/Verifiers/MarkVerifier.cs
@@ -80,13 +80,13 @@ namespace PKHeX.Core
switch (enc)
{
- case WC8 _:
- case EncounterEgg _:
- case EncounterTrade _:
- case EncounterStatic8U _:
- case EncounterStatic8N _:
- case EncounterStatic8ND _:
- case EncounterStatic8NC _:
+ case WC8:
+ case EncounterEgg:
+ case EncounterTrade:
+ case EncounterStatic8U:
+ case EncounterStatic8N:
+ case EncounterStatic8ND:
+ case EncounterStatic8NC:
case EncounterStatic8 s when s.Gift || s.ScriptedNoMarks:
return false;
}
diff --git a/PKHeX.Core/Legality/Verifiers/MiscVerifier.cs b/PKHeX.Core/Legality/Verifiers/MiscVerifier.cs
index 62a0b0b41..f8fe2539b 100644
--- a/PKHeX.Core/Legality/Verifiers/MiscVerifier.cs
+++ b/PKHeX.Core/Legality/Verifiers/MiscVerifier.cs
@@ -34,7 +34,7 @@ namespace PKHeX.Core
case PK4 pk4 when pk4.PokéathlonStat != 0:
data.AddLine(GetInvalid(LEggPokeathlon, Egg));
break;
- case PK3 _ when pkm.Language != 1: // All Eggs are Japanese and flagged specially for localized string
+ case PK3 when pkm.Language != 1: // All Eggs are Japanese and flagged specially for localized string
data.AddLine(GetInvalid(string.Format(LOTLanguage, LanguageID.Japanese, (LanguageID)pkm.Language), Egg));
break;
}
@@ -188,8 +188,8 @@ namespace PKHeX.Core
VerifyFatefulMysteryGift(data, g);
return;
case EncounterStatic {Fateful: true}: // ingame fateful
- case EncounterSlot3PokeSpot _: // ingame pokespot
- case EncounterTrade4Ranch _: // ranch varied PID
+ case EncounterSlot3PokeSpot: // ingame pokespot
+ case EncounterTrade4Ranch: // ranch varied PID
VerifyFatefulIngameActive(data);
return;
}
diff --git a/PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs b/PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs
index 4575ac1c3..24a615941 100644
--- a/PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs
+++ b/PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs
@@ -21,9 +21,9 @@ namespace PKHeX.Core
var pkm = data.pkm;
switch (data.EncounterMatch)
{
- case EncounterTrade _:
+ case EncounterTrade:
case MysteryGift {IsEgg: false}:
- case EncounterStatic5N _:
+ case EncounterStatic5N:
return; // already verified
}
diff --git a/PKHeX.Core/MysteryGifts/MysteryGift.cs b/PKHeX.Core/MysteryGifts/MysteryGift.cs
index d7a6d1da9..fef09de88 100644
--- a/PKHeX.Core/MysteryGifts/MysteryGift.cs
+++ b/PKHeX.Core/MysteryGifts/MysteryGift.cs
@@ -186,7 +186,6 @@ namespace PKHeX.Core
public virtual int BP { get => 0; set { } }
public virtual bool IsBean { get => false; set { } }
public virtual int Bean { get => 0; set { } }
- public virtual int BeanCount { get => 0; set { } }
public virtual string CardHeader => (CardID > 0 ? $"Card #: {CardID:0000}" : "N/A") + $" - {CardTitle.Replace('\u3000',' ').Trim()}";
diff --git a/PKHeX.Core/PKM/PKM.cs b/PKHeX.Core/PKM/PKM.cs
index 50d65c5c1..7222cb737 100644
--- a/PKHeX.Core/PKM/PKM.cs
+++ b/PKHeX.Core/PKM/PKM.cs
@@ -582,8 +582,8 @@ namespace PKHeX.Core
private int GetTradedEggLocation() => Locations.TradedEggLocation(Generation);
public virtual bool IsUntraded => false;
- public virtual bool IsNative => Generation == Format;
- public virtual bool IsOriginValid => Species <= Legal.GetMaxSpeciesOrigin(Format);
+ public bool IsNative => Generation == Format;
+ public bool IsOriginValid => Species <= Legal.GetMaxSpeciesOrigin(Format);
///
/// Checks if the could inhabit a set of games.
diff --git a/PKHeX.Core/PKM/Searching/SearchSettings.cs b/PKHeX.Core/PKM/Searching/SearchSettings.cs
index dd691ba59..b5c6f5b65 100644
--- a/PKHeX.Core/PKM/Searching/SearchSettings.cs
+++ b/PKHeX.Core/PKM/Searching/SearchSettings.cs
@@ -9,29 +9,29 @@ namespace PKHeX.Core.Searching
///
public sealed class SearchSettings
{
- public int Format { private get; set; }
- public int Generation { private get; set; }
- public int Species { get; set; } = -1;
- public int Ability { private get; set; } = -1;
- public int Nature { private get; set; } = -1;
- public int Item { private get; set; } = -1;
- public int Version { private get; set; } = -1;
- public int HiddenPowerType { private get; set; } = -1;
+ public int Format { private get; init; }
+ public int Generation { private get; init; }
+ public int Species { get; init; } = -1;
+ public int Ability { private get; init; } = -1;
+ public int Nature { private get; init; } = -1;
+ public int Item { private get; init; } = -1;
+ public int Version { private get; init; } = -1;
+ public int HiddenPowerType { private get; init; } = -1;
- public SearchComparison SearchFormat { private get; set; }
- public SearchComparison SearchLevel { private get; set; }
+ public SearchComparison SearchFormat { private get; init; }
+ public SearchComparison SearchLevel { private get; init; }
public bool? SearchShiny { private get; set; }
public bool? SearchLegal { private get; set; }
public bool? SearchEgg { get; set; }
public int? ESV { private get; set; }
- public int? Level { private get; set; }
+ public int? Level { private get; init; }
- public int IVType { private get; set; }
- public int EVType { private get; set; }
+ public int IVType { private get; init; }
+ public int EVType { private get; init; }
public CloneDetectionMethod SearchClones { private get; set; }
- public IList BatchInstructions { private get; set; } = Array.Empty();
+ public IList BatchInstructions { private get; init; } = Array.Empty();
public readonly List Moves = new();
diff --git a/PKHeX.Core/Resources/text/de/LegalityCheckStrings_de.txt b/PKHeX.Core/Resources/text/de/LegalityCheckStrings_de.txt
index 5e2c02ef8..eefee3623 100644
--- a/PKHeX.Core/Resources/text/de/LegalityCheckStrings_de.txt
+++ b/PKHeX.Core/Resources/text/de/LegalityCheckStrings_de.txt
@@ -352,8 +352,8 @@ LTransferHTFlagRequired = Current handler cannot be past gen OT for transferred
LTransferMet = Invalid Met Location, expected Poké Transfer or Crown.
LTransferMetLocation = Invalid Transfer Met Location.
LTransferMove = Incompatible transfer move.
-LTransferMoveG4HM = Defog and whirpool. One of the two moves should have been removed before transfered to Generation 5.
-LTransferMoveHM = Generation {0} HM. Should have been removed before transfered to Generation {1}.
+LTransferMoveG4HM = Defog and Whirlpool. One of the two moves should have been removed before transferred to Generation 5.
+LTransferMoveHM = Generation {0} HM. Should have been removed before transferred to Generation {1}.
LTransferNature = Invalid Nature for transfer Experience.
LTransferOriginFInvalid0_1 = {0} origin cannot exist in the currently loaded ({1}) savegame.
LTransferPIDECBitFlip = PID should be equal to EC [with top bit flipped]!
diff --git a/PKHeX.Core/Resources/text/en/LegalityCheckStrings_en.txt b/PKHeX.Core/Resources/text/en/LegalityCheckStrings_en.txt
index be1384c85..975d27b47 100644
--- a/PKHeX.Core/Resources/text/en/LegalityCheckStrings_en.txt
+++ b/PKHeX.Core/Resources/text/en/LegalityCheckStrings_en.txt
@@ -352,8 +352,8 @@ LTransferHTFlagRequired = Current handler cannot be past gen OT for transferred
LTransferMet = Invalid Met Location, expected Poké Transfer or Crown.
LTransferMetLocation = Invalid Transfer Met Location.
LTransferMove = Incompatible transfer move.
-LTransferMoveG4HM = Defog and whirpool. One of the two moves should have been removed before transfered to Generation 5.
-LTransferMoveHM = Generation {0} HM. Should have been removed before transfered to Generation {1}.
+LTransferMoveG4HM = Defog and Whirlpool. One of the two moves should have been removed before transferred to Generation 5.
+LTransferMoveHM = Generation {0} HM. Should have been removed before transferred to Generation {1}.
LTransferNature = Invalid Nature for transfer Experience.
LTransferOriginFInvalid0_1 = {0} origin cannot exist in the currently loaded ({1}) savegame.
LTransferPIDECBitFlip = PID should be equal to EC [with top bit flipped]!
diff --git a/PKHeX.Core/Resources/text/it/LegalityCheckStrings_it.txt b/PKHeX.Core/Resources/text/it/LegalityCheckStrings_it.txt
index 5e2c02ef8..eefee3623 100644
--- a/PKHeX.Core/Resources/text/it/LegalityCheckStrings_it.txt
+++ b/PKHeX.Core/Resources/text/it/LegalityCheckStrings_it.txt
@@ -352,8 +352,8 @@ LTransferHTFlagRequired = Current handler cannot be past gen OT for transferred
LTransferMet = Invalid Met Location, expected Poké Transfer or Crown.
LTransferMetLocation = Invalid Transfer Met Location.
LTransferMove = Incompatible transfer move.
-LTransferMoveG4HM = Defog and whirpool. One of the two moves should have been removed before transfered to Generation 5.
-LTransferMoveHM = Generation {0} HM. Should have been removed before transfered to Generation {1}.
+LTransferMoveG4HM = Defog and Whirlpool. One of the two moves should have been removed before transferred to Generation 5.
+LTransferMoveHM = Generation {0} HM. Should have been removed before transferred to Generation {1}.
LTransferNature = Invalid Nature for transfer Experience.
LTransferOriginFInvalid0_1 = {0} origin cannot exist in the currently loaded ({1}) savegame.
LTransferPIDECBitFlip = PID should be equal to EC [with top bit flipped]!
diff --git a/PKHeX.Core/Resources/text/ja/LegalityCheckStrings_ja.txt b/PKHeX.Core/Resources/text/ja/LegalityCheckStrings_ja.txt
index 80b937149..28da662f9 100644
--- a/PKHeX.Core/Resources/text/ja/LegalityCheckStrings_ja.txt
+++ b/PKHeX.Core/Resources/text/ja/LegalityCheckStrings_ja.txt
@@ -352,8 +352,8 @@ LTransferHTFlagRequired = Current handler cannot be past gen OT for transferred
LTransferMet = Invalid Met Location, expected Poké Transfer or Crown.
LTransferMetLocation = Invalid Transfer Met Location.
LTransferMove = Incompatible transfer move.
-LTransferMoveG4HM = Defog and whirpool. One of the two moves should have been removed before transfered to Generation 5.
-LTransferMoveHM = Generation {0} HM. Should have been removed before transfered to Generation {1}.
+LTransferMoveG4HM = Defog and Whirlpool. One of the two moves should have been removed before transferred to Generation 5.
+LTransferMoveHM = Generation {0} HM. Should have been removed before transferred to Generation {1}.
LTransferNature = Invalid Nature for transfer Experience.
LTransferOriginFInvalid0_1 = {0} origin cannot exist in the currently loaded ({1}) savegame.
LTransferPIDECBitFlip = PID should be equal to EC [with top bit flipped]!
diff --git a/PKHeX.Core/Saves/Blocks/BlockInfo.cs b/PKHeX.Core/Saves/Blocks/BlockInfo.cs
index 569664410..762d79d85 100644
--- a/PKHeX.Core/Saves/Blocks/BlockInfo.cs
+++ b/PKHeX.Core/Saves/Blocks/BlockInfo.cs
@@ -6,9 +6,9 @@ namespace PKHeX.Core
public abstract class BlockInfo
{
// General
- public uint ID { get; set; }
- public int Offset { get; set; }
- public int Length { get; set; }
+ public uint ID { get; init; }
+ public int Offset { get; protected init; }
+ public int Length { get; init; }
public string Summary => $"{ID:00}: {Offset:X5}-{Offset + Length - 1:X5}, {Length:X5}";
diff --git a/PKHeX.Core/Saves/SAV3Colosseum.cs b/PKHeX.Core/Saves/SAV3Colosseum.cs
index b86dd3f2d..839314e6c 100644
--- a/PKHeX.Core/Saves/SAV3Colosseum.cs
+++ b/PKHeX.Core/Saves/SAV3Colosseum.cs
@@ -262,7 +262,7 @@ namespace PKHeX.Core
bool header = newHC == oldHC;
bool body = chk.SequenceEqual(checksum);
static string valid(bool s) => s ? "Valid" : "Invalid";
- return $"Header Checksum {valid(header)}, Body Checksum {valid(body)}alid.";
+ return $"Header Checksum {valid(header)}, Body Checksum {valid(body)}.";
}
}
diff --git a/PKHeX.Core/Saves/SAV5.cs b/PKHeX.Core/Saves/SAV5.cs
index 18ea0cdbf..8d02f316e 100644
--- a/PKHeX.Core/Saves/SAV5.cs
+++ b/PKHeX.Core/Saves/SAV5.cs
@@ -66,8 +66,8 @@ namespace PKHeX.Core
protected int CGearDataOffset;
protected int EntreeForestOffset;
private int AdventureInfo;
- public int GTS { get; protected set; } = int.MinValue;
- public int Fused { get; protected set; } = int.MinValue;
+ public int GTS { get; } = int.MinValue;
+ public int Fused { get; } = int.MinValue;
// Daycare
public override int DaycareSeedSize => Daycare5.DaycareSeedSize;
diff --git a/PKHeX.Core/Saves/Substructures/Gen3/DecorationInventory3.cs b/PKHeX.Core/Saves/Substructures/Gen3/DecorationInventory3.cs
index da6bceb03..e7c0efbf1 100644
--- a/PKHeX.Core/Saves/Substructures/Gen3/DecorationInventory3.cs
+++ b/PKHeX.Core/Saves/Substructures/Gen3/DecorationInventory3.cs
@@ -4,7 +4,7 @@
namespace PKHeX.Core
{
[StructLayout(LayoutKind.Sequential)]
- public struct DecorationInventory3
+ public readonly struct DecorationInventory3
{
public const int SIZE = 150;
diff --git a/PKHeX.Core/Saves/Substructures/PokeDex/Zukan.cs b/PKHeX.Core/Saves/Substructures/PokeDex/Zukan.cs
index 4b93e4889..8915ff63f 100644
--- a/PKHeX.Core/Saves/Substructures/PokeDex/Zukan.cs
+++ b/PKHeX.Core/Saves/Substructures/PokeDex/Zukan.cs
@@ -61,8 +61,8 @@ namespace PKHeX.Core
protected abstract void SetAllDexFlagsLanguage(int bit, int lang, bool value = true);
protected abstract void SetAllDexSeenFlags(int baseBit, int form, int gender, bool isShiny, bool value = true);
- protected virtual bool GetFlag(int ofs, int bitIndex) => SAV.GetFlag(PokeDex + ofs + (bitIndex >> 3), bitIndex);
- protected virtual void SetFlag(int ofs, int bitIndex, bool value = true) => SAV.SetFlag(PokeDex + ofs + (bitIndex >> 3), bitIndex, value);
+ protected bool GetFlag(int ofs, int bitIndex) => SAV.GetFlag(PokeDex + ofs + (bitIndex >> 3), bitIndex);
+ protected void SetFlag(int ofs, int bitIndex, bool value = true) => SAV.SetFlag(PokeDex + ofs + (bitIndex >> 3), bitIndex, value);
public override bool GetCaught(int species) => GetFlag(OFS_CAUGHT, species - 1);
public virtual void SetCaught(int species, bool value = true) => SetFlag(OFS_CAUGHT, species - 1, value);
diff --git a/PKHeX.Core/Saves/Substructures/PokeDex/Zukan6.cs b/PKHeX.Core/Saves/Substructures/PokeDex/Zukan6.cs
index fe15eab61..dbf627fcc 100644
--- a/PKHeX.Core/Saves/Substructures/PokeDex/Zukan6.cs
+++ b/PKHeX.Core/Saves/Substructures/PokeDex/Zukan6.cs
@@ -10,7 +10,7 @@ namespace PKHeX.Core
protected override int BitSeenSize => 0x60;
protected override int DexLangFlagByteCount => 631; // 721 * 7, rounded up
protected override int DexLangIDCount => 7;
- protected int SpindaOffset { get; set; }
+ protected int SpindaOffset { get; init; }
protected Zukan6(SAV6XY sav, int dex, int langflag) : base(sav, dex, langflag)
{
diff --git a/PKHeX.Drawing/ImageUtil.cs b/PKHeX.Drawing/ImageUtil.cs
index e39a162aa..88005778b 100644
--- a/PKHeX.Drawing/ImageUtil.cs
+++ b/PKHeX.Drawing/ImageUtil.cs
@@ -18,7 +18,7 @@ namespace PKHeX.Drawing
public static Bitmap LayerImage(Image baseLayer, Image overLayer, int x, int y)
{
- Bitmap img = new Bitmap(baseLayer);
+ Bitmap img = new(baseLayer);
using Graphics gr = Graphics.FromImage(img);
gr.DrawImage(overLayer, x, y, overLayer.Width, overLayer.Height);
return img;
diff --git a/PKHeX.Drawing/Names/SpriteName.cs b/PKHeX.Drawing/Names/SpriteName.cs
index 5caf446ae..ecb35758c 100644
--- a/PKHeX.Drawing/Names/SpriteName.cs
+++ b/PKHeX.Drawing/Names/SpriteName.cs
@@ -71,7 +71,7 @@ namespace PKHeX.Drawing
///
/// Species that show their default Species sprite regardless of current
///
- private static readonly HashSet SpeciesDefaultFormSprite = new HashSet
+ private static readonly HashSet SpeciesDefaultFormSprite = new()
{
(int)Species.Mothim,
(int)Species.Arceus,
@@ -88,7 +88,7 @@ namespace PKHeX.Drawing
///
/// Species that show a specific Sprite
///
- private static readonly HashSet SpeciesGenderedSprite = new HashSet
+ private static readonly HashSet SpeciesGenderedSprite = new()
{
(int)Species.Pikachu,
(int)Species.Hippopotas,
diff --git a/PKHeX.Drawing/Sprites/SpriteUtil.cs b/PKHeX.Drawing/Sprites/SpriteUtil.cs
index f5983b6cc..612273d3d 100644
--- a/PKHeX.Drawing/Sprites/SpriteUtil.cs
+++ b/PKHeX.Drawing/Sprites/SpriteUtil.cs
@@ -7,8 +7,8 @@ namespace PKHeX.Drawing
{
public static class SpriteUtil
{
- public static readonly SpriteBuilder3040 SB17 = new SpriteBuilder3040();
- public static readonly SpriteBuilder5668 SB8 = new SpriteBuilder5668();
+ public static readonly SpriteBuilder3040 SB17 = new();
+ public static readonly SpriteBuilder5668 SB8 = new();
public static SpriteBuilder Spriter { get; set; } = SB8;
public static Image GetBallSprite(int ball)
diff --git a/PKHeX.WinForms/Controls/PKM Editor/CatchRate.cs b/PKHeX.WinForms/Controls/PKM Editor/CatchRate.cs
index dd1fee2e4..a1f894cc3 100644
--- a/PKHeX.WinForms/Controls/PKM Editor/CatchRate.cs
+++ b/PKHeX.WinForms/Controls/PKM Editor/CatchRate.cs
@@ -6,7 +6,7 @@ namespace PKHeX.WinForms.Controls
{
public partial class CatchRate : UserControl
{
- private PK1 pk1 = new PK1();
+ private PK1 pk1 = new();
public CatchRate() => InitializeComponent();
public void LoadPK1(PK1 pk) => NUD_CatchRate.Value = (pk1 = pk).Catch_Rate;
diff --git a/PKHeX.WinForms/Controls/PKM Editor/DrawConfig.cs b/PKHeX.WinForms/Controls/PKM Editor/DrawConfig.cs
index 1b02fa413..548a93f5b 100644
--- a/PKHeX.WinForms/Controls/PKM Editor/DrawConfig.cs
+++ b/PKHeX.WinForms/Controls/PKM Editor/DrawConfig.cs
@@ -95,7 +95,7 @@ namespace PKHeX.WinForms
public Color GetText(bool highlight) => highlight ? TextHighlighted : TextColor;
public Color GetBackground(bool legal, bool highlight) => highlight ? BackHighlighted : (legal ? BackLegal : BackColor);
- public readonly BrushSet Brushes = new BrushSet();
+ public readonly BrushSet Brushes = new();
public void LoadBrushes()
{
diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs
index d28ebe1a2..cafedef40 100644
--- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs
+++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs
@@ -129,7 +129,7 @@ namespace PKHeX.WinForms.Controls
///
/// List of legal moves for the latest .
///
- private readonly LegalMoveSource LegalMoveSource = new LegalMoveSource();
+ private readonly LegalMoveSource LegalMoveSource = new();
///
/// Gender Symbols for showing Genders
@@ -223,12 +223,12 @@ namespace PKHeX.WinForms.Controls
case 7:
switch (pk)
{
- case PK7 _:
+ case PK7:
GetFieldsfromPKM = PopulateFieldsPK7;
GetPKMfromFields = PreparePK7;
break;
- case PB7 _:
+ case PB7:
GetFieldsfromPKM = PopulateFieldsPB7;
GetPKMfromFields = PreparePB7;
break;
diff --git a/PKHeX.WinForms/Controls/SAV Editor/BitmapAnimator.cs b/PKHeX.WinForms/Controls/SAV Editor/BitmapAnimator.cs
index fa772e8a7..cb74e9297 100644
--- a/PKHeX.WinForms/Controls/SAV Editor/BitmapAnimator.cs
+++ b/PKHeX.WinForms/Controls/SAV Editor/BitmapAnimator.cs
@@ -20,7 +20,7 @@ namespace PKHeX.WinForms.Controls
private Image? ExtraLayer;
private Image?[]? GlowCache;
public Image? OriginalBackground;
- private readonly object Lock = new object();
+ private readonly object Lock = new();
private PictureBox? pb;
private int GlowInterval;
diff --git a/PKHeX.WinForms/Controls/SAV Editor/BoxMenuStrip.cs b/PKHeX.WinForms/Controls/SAV Editor/BoxMenuStrip.cs
index 1318a4586..e5ed3dd06 100644
--- a/PKHeX.WinForms/Controls/SAV Editor/BoxMenuStrip.cs
+++ b/PKHeX.WinForms/Controls/SAV Editor/BoxMenuStrip.cs
@@ -9,7 +9,7 @@ namespace PKHeX.WinForms.Controls
public sealed class BoxMenuStrip : ContextMenuStrip
{
private readonly SAVEditor SAV;
- private readonly List CustomItems = new List();
+ private readonly List CustomItems = new();
private readonly BoxManipulator Manipulator;
public BoxMenuStrip(SAVEditor sav)
@@ -40,7 +40,7 @@ namespace PKHeX.WinForms.Controls
CustomItems.Add(new ItemVisibility(tsi, item));
}
- private static readonly Dictionary ManipTypeImage = new Dictionary
+ private static readonly Dictionary ManipTypeImage = new()
{
[BoxManipType.DeleteAll] = Resources.nocheck,
[BoxManipType.DeleteEggs] = Resources.about,
diff --git a/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs b/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs
index a478290d3..ffc6d982b 100644
--- a/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs
+++ b/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs
@@ -29,7 +29,7 @@ namespace PKHeX.WinForms.Controls
public SaveFile SAV { get; private set; } = new FakeSaveFile();
public int CurrentBox => Box.CurrentBox;
- public SlotChangeManager M { get; set; }
+ public SlotChangeManager M { get; }
public readonly ContextMenuSAV menu;
public readonly BoxMenuStrip SortMenu;
diff --git a/PKHeX.WinForms/Controls/SAV Editor/SlotChangeManager.cs b/PKHeX.WinForms/Controls/SAV Editor/SlotChangeManager.cs
index 6e150024a..1ef4ed8e3 100644
--- a/PKHeX.WinForms/Controls/SAV Editor/SlotChangeManager.cs
+++ b/PKHeX.WinForms/Controls/SAV Editor/SlotChangeManager.cs
@@ -18,12 +18,12 @@ namespace PKHeX.WinForms.Controls
public sealed class SlotChangeManager : IDisposable
{
public readonly SAVEditor SE;
- public readonly SlotTrackerImage LastSlot = new SlotTrackerImage();
- public readonly DragManager Drag = new DragManager();
+ public readonly SlotTrackerImage LastSlot = new();
+ public readonly DragManager Drag = new();
public SaveDataEditor Env { get; set; } = null!;
- public readonly List Boxes = new List();
- public readonly SlotHoverHandler Hover = new SlotHoverHandler();
+ public readonly List Boxes = new();
+ public readonly SlotHoverHandler Hover = new();
public SlotChangeManager(SAVEditor se) => SE = se;
@@ -35,9 +35,8 @@ namespace PKHeX.WinForms.Controls
public void MouseEnter(object? sender, EventArgs e)
{
- if (sender == null)
+ if (sender is not PictureBox pb)
return;
- var pb = (PictureBox)sender;
if (pb.Image == null)
return;
Hover.Start(pb, LastSlot);
diff --git a/PKHeX.WinForms/Controls/Slots/CryPlayer.cs b/PKHeX.WinForms/Controls/Slots/CryPlayer.cs
index d7a284252..571764042 100644
--- a/PKHeX.WinForms/Controls/Slots/CryPlayer.cs
+++ b/PKHeX.WinForms/Controls/Slots/CryPlayer.cs
@@ -8,7 +8,7 @@ namespace PKHeX.WinForms.Controls
{
public sealed class CryPlayer
{
- private readonly SoundPlayer Sounds = new SoundPlayer();
+ private readonly SoundPlayer Sounds = new();
public void PlayCry(PKM pk)
{
diff --git a/PKHeX.WinForms/Controls/Slots/DragManager.cs b/PKHeX.WinForms/Controls/Slots/DragManager.cs
index ea7c81b6a..f695d53a6 100644
--- a/PKHeX.WinForms/Controls/Slots/DragManager.cs
+++ b/PKHeX.WinForms/Controls/Slots/DragManager.cs
@@ -5,7 +5,7 @@ namespace PKHeX.WinForms.Controls
{
public sealed class DragManager
{
- public SlotChangeInfo Info { get; private set; } = new SlotChangeInfo();
+ public SlotChangeInfo Info { get; private set; } = new();
public event DragEventHandler? RequestExternalDragDrop;
public void RequestDD(object sender, DragEventArgs e) => RequestExternalDragDrop?.Invoke(sender, e);
diff --git a/PKHeX.WinForms/Controls/Slots/PokeGrid.cs b/PKHeX.WinForms/Controls/Slots/PokeGrid.cs
index 75212b661..abcae6713 100644
--- a/PKHeX.WinForms/Controls/Slots/PokeGrid.cs
+++ b/PKHeX.WinForms/Controls/Slots/PokeGrid.cs
@@ -13,7 +13,7 @@ namespace PKHeX.WinForms.Controls
InitializeComponent();
}
- public readonly List Entries = new List();
+ public readonly List Entries = new();
public int Slots { get; private set; }
private int sizeW = 40;
@@ -73,7 +73,7 @@ namespace PKHeX.WinForms.Controls
public static PictureBox GetControl(int width, int height)
{
- return new PictureBox
+ return new()
{
AutoSize = false,
SizeMode = PictureBoxSizeMode.CenterImage,
diff --git a/PKHeX.WinForms/Controls/Slots/SlotHoverHandler.cs b/PKHeX.WinForms/Controls/Slots/SlotHoverHandler.cs
index 82ad68124..89c8cee35 100644
--- a/PKHeX.WinForms/Controls/Slots/SlotHoverHandler.cs
+++ b/PKHeX.WinForms/Controls/Slots/SlotHoverHandler.cs
@@ -12,14 +12,14 @@ namespace PKHeX.WinForms.Controls
///
public sealed class SlotHoverHandler : IDisposable
{
- public DrawConfig Draw { private get; set; } = new DrawConfig();
+ public DrawConfig Draw { private get; set; } = new();
public bool GlowHover { private get; set; } = true;
- public static readonly CryPlayer CryPlayer = new CryPlayer();
- public static readonly SummaryPreviewer Preview = new SummaryPreviewer();
+ public static readonly CryPlayer CryPlayer = new();
+ public static readonly SummaryPreviewer Preview = new();
private static Bitmap Hover => SpriteUtil.Spriter.Hover;
- private readonly BitmapAnimator HoverWorker = new BitmapAnimator();
+ private readonly BitmapAnimator HoverWorker = new();
private PictureBox? Slot;
private SlotTrackerImage? LastSlot;
diff --git a/PKHeX.WinForms/Controls/Slots/SlotList.cs b/PKHeX.WinForms/Controls/Slots/SlotList.cs
index f3073d915..96994b64e 100644
--- a/PKHeX.WinForms/Controls/Slots/SlotList.cs
+++ b/PKHeX.WinForms/Controls/Slots/SlotList.cs
@@ -10,8 +10,8 @@ namespace PKHeX.WinForms.Controls
{
private static readonly string[] names = Enum.GetNames(typeof(StorageSlotType));
private readonly LabelType[] Labels = new LabelType[names.Length];
- private readonly List slots = new List();
- private List SlotOffsets = new List();
+ private readonly List slots = new();
+ private List SlotOffsets = new();
public int SlotCount { get; private set; }
public SaveFile SAV { get; set; } = null!;
public bool FlagIllegal { get; set; }
@@ -121,7 +121,7 @@ namespace PKHeX.WinForms.Controls
private static PictureBox GetPictureBox(int index, SpriteBuilder s)
{
- return new PictureBox
+ return new()
{
BorderStyle = BorderStyle.FixedSingle,
Width = s.Width + 2,
diff --git a/PKHeX.WinForms/Controls/Slots/SummaryPreviewer.cs b/PKHeX.WinForms/Controls/Slots/SummaryPreviewer.cs
index b74a941d2..c953fb743 100644
--- a/PKHeX.WinForms/Controls/Slots/SummaryPreviewer.cs
+++ b/PKHeX.WinForms/Controls/Slots/SummaryPreviewer.cs
@@ -6,7 +6,7 @@ namespace PKHeX.WinForms.Controls
{
public sealed class SummaryPreviewer
{
- private readonly ToolTip ShowSet = new ToolTip { InitialDelay = 200, IsBalloon = false };
+ private readonly ToolTip ShowSet = new() { InitialDelay = 200, IsBalloon = false };
public void Show(Control pb, PKM pk)
{
diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs
index e0a808369..af36a5c1c 100644
--- a/PKHeX.WinForms/MainWindow/Main.cs
+++ b/PKHeX.WinForms/MainWindow/Main.cs
@@ -86,7 +86,7 @@ namespace PKHeX.WinForms
private readonly string[] main_langlist = Enum.GetNames(typeof(ProgramLanguage));
- private static readonly List Plugins = new List();
+ private static readonly List Plugins = new();
#endregion
#region Path Variables
@@ -280,7 +280,7 @@ namespace PKHeX.WinForms
BAKprompt = Settings.BAKPrompt = true;
}
- public static DrawConfig Draw { get; private set; } = new DrawConfig();
+ public static DrawConfig Draw { get; private set; } = new();
private void FormInitializeSecond()
{
diff --git a/PKHeX.WinForms/Subforms/KChart.cs b/PKHeX.WinForms/Subforms/KChart.cs
index 060d0f010..6104ff021 100644
--- a/PKHeX.WinForms/Subforms/KChart.cs
+++ b/PKHeX.WinForms/Subforms/KChart.cs
@@ -89,7 +89,7 @@ namespace PKHeX.WinForms
{
return personalInfo switch
{
- PersonalInfoSM _ => s > 721 || Legal.PastGenAlolanNatives.Contains(s),
+ PersonalInfoSM => s > 721 || Legal.PastGenAlolanNatives.Contains(s),
PersonalInfoSWSH ss => ss.IsInDex,
_ => true,
};
diff --git a/PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.cs b/PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.cs
index 78e5df944..eb650e180 100644
--- a/PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.cs
+++ b/PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.cs
@@ -230,7 +230,7 @@ namespace PKHeX.WinForms
}
// Mass Editing
- private Core.BatchEditor editor = new Core.BatchEditor();
+ private Core.BatchEditor editor = new();
private void ProcessSAV(IList data, IReadOnlyList Filters, IReadOnlyList Instructions)
{
diff --git a/PKHeX.WinForms/Subforms/PKM Editors/SuperTrainingEditor.cs b/PKHeX.WinForms/Subforms/PKM Editors/SuperTrainingEditor.cs
index abc070b21..ed98956a5 100644
--- a/PKHeX.WinForms/Subforms/PKM Editors/SuperTrainingEditor.cs
+++ b/PKHeX.WinForms/Subforms/PKM Editors/SuperTrainingEditor.cs
@@ -49,8 +49,8 @@ namespace PKHeX.WinForms
}
}
- private readonly List reglist = new List();
- private readonly List distlist = new List();
+ private readonly List reglist = new();
+ private readonly List distlist = new();
private readonly ISuperTrain pkm;
private const string PrefixCHK = "CHK_";
diff --git a/PKHeX.WinForms/Subforms/PKM Editors/Text.cs b/PKHeX.WinForms/Subforms/PKM Editors/Text.cs
index f18789dc6..0fb684968 100644
--- a/PKHeX.WinForms/Subforms/PKM Editors/Text.cs
+++ b/PKHeX.WinForms/Subforms/PKM Editors/Text.cs
@@ -46,7 +46,7 @@ namespace PKHeX.WinForms
CenterToParent();
}
- private readonly List Bytes = new List();
+ private readonly List Bytes = new();
public string FinalString;
public byte[] FinalBytes { get; private set; } = Array.Empty();
private readonly byte[] Raw;
@@ -177,9 +177,9 @@ namespace PKHeX.WinForms
private string GetString() => SAV.GetString(Raw, 0, Raw.Length);
// Helpers
- private static Label GetLabel(string str) => new Label {Text = str, AutoSize = true};
+ private static Label GetLabel(string str) => new() {Text = str, AutoSize = true};
- private static NumericUpDown GetNUD(int min, int max, bool hex) => new NumericUpDown
+ private static NumericUpDown GetNUD(int min, int max, bool hex) => new()
{
Maximum = max,
Minimum = min,
diff --git a/PKHeX.WinForms/Subforms/ReportGrid.cs b/PKHeX.WinForms/Subforms/ReportGrid.cs
index dfd1a8e52..bd886acd6 100644
--- a/PKHeX.WinForms/Subforms/ReportGrid.cs
+++ b/PKHeX.WinForms/Subforms/ReportGrid.cs
@@ -42,7 +42,7 @@ namespace PKHeX.WinForms
WinFormsUtil.Alert(MsgReportColumnRestoreSuccess);
};
- ContextMenuStrip mnu = new ContextMenuStrip();
+ ContextMenuStrip mnu = new();
mnu.Items.Add(mnuHide);
mnu.Items.Add(mnuRestore);
diff --git a/PKHeX.WinForms/Subforms/SAV_Database.cs b/PKHeX.WinForms/Subforms/SAV_Database.cs
index ab296eac7..4d7fd0c2e 100644
--- a/PKHeX.WinForms/Subforms/SAV_Database.cs
+++ b/PKHeX.WinForms/Subforms/SAV_Database.cs
@@ -102,8 +102,8 @@ namespace PKHeX.WinForms
private readonly PictureBox[] PKXBOXES;
private readonly string DatabasePath = Main.DatabasePath;
- private List Results = new List();
- private List RawDB = new List();
+ private List Results = new();
+ private List RawDB = new();
private int slotSelected = -1; // = null;
private Image? slotColor;
private const int RES_MAX = 66;
@@ -112,7 +112,7 @@ namespace PKHeX.WinForms
private readonly string Viewed;
private const int MAXFORMAT = PKX.Generation;
private readonly string EXTERNAL_SAV = new DirectoryInfo(Main.BackupPath).Name + Path.DirectorySeparatorChar;
- private readonly SummaryPreviewer ShowSet = new SummaryPreviewer();
+ private readonly SummaryPreviewer ShowSet = new();
// Important Events
private void ClickView(object sender, EventArgs e)
@@ -312,7 +312,7 @@ namespace PKHeX.WinForms
if (this.OpenWindowExists())
return;
- ReportGrid reportGrid = new ReportGrid();
+ ReportGrid reportGrid = new();
reportGrid.Show();
reportGrid.PopulateData(Results.ToArray());
}
diff --git a/PKHeX.WinForms/Subforms/SAV_Encounters.cs b/PKHeX.WinForms/Subforms/SAV_Encounters.cs
index e88530eb2..cc45b821a 100644
--- a/PKHeX.WinForms/Subforms/SAV_Encounters.cs
+++ b/PKHeX.WinForms/Subforms/SAV_Encounters.cs
@@ -95,7 +95,7 @@ namespace PKHeX.WinForms
}
private readonly PictureBox[] PKXBOXES;
- private List Results = new List();
+ private List Results = new();
private int slotSelected = -1; // = null;
private Image? slotColor;
private const int RES_MAX = 66;
diff --git a/PKHeX.WinForms/Subforms/SAV_FolderList.cs b/PKHeX.WinForms/Subforms/SAV_FolderList.cs
index d0b6a4ed6..c54e8bea1 100644
--- a/PKHeX.WinForms/Subforms/SAV_FolderList.cs
+++ b/PKHeX.WinForms/Subforms/SAV_FolderList.cs
@@ -18,7 +18,7 @@ namespace PKHeX.WinForms
private readonly List Paths;
private readonly SortableBindingList Recent;
private readonly SortableBindingList Backup;
- private readonly List