Minor clean

Handle remainder of c#9 sugar
Fix some spelling mistakes
This commit is contained in:
Kurt 2020-12-21 23:37:07 -08:00
parent 514b60b447
commit 997e0751f3
80 changed files with 199 additions and 184 deletions

View file

@ -10,7 +10,7 @@ namespace PKHeX.Core
public int Offset { get; } public int Offset { get; }
public bool CanWriteTo(SaveFile sav) => false; public bool CanWriteTo(SaveFile sav) => false;
public WriteBlockedMessage CanWriteTo(SaveFile sav, PKM pkm) => WriteBlockedMessage.InvalidDestination; 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 private readonly byte[] Data; // buffer to r/w

View file

@ -44,7 +44,7 @@ namespace PKHeX.Core
// Some games cannot acquire every Species that exists. Some can only acquire a subset. // Some games cannot acquire every Species that exists. Some can only acquire a subset.
return sav switch 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), .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) _ => source.SpeciesDataSource.Where(s => s.Value <= sav.MaxSpeciesID)
}; };
@ -58,7 +58,7 @@ namespace PKHeX.Core
var legal = source.LegalMoveDataSource; var legal = source.LegalMoveDataSource;
return sav switch 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) _ => legal.Where(m => m.Value <= sav.MaxMoveID)
}; };
} }

View file

@ -182,12 +182,12 @@ namespace PKHeX.Core
// E-Reader was only available to Japanese games. // E-Reader was only available to Japanese games.
case EncounterStaticShadow {EReader: true}: case EncounterStaticShadow {EReader: true}:
// Old Sea Map was only distributed to Japanese games. // 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 = "ゲーフリ"; pk.OT_Name = "ゲーフリ";
return (int)LanguageID.Japanese; return (int)LanguageID.Japanese;
// Deoxys for Emerald was not available for Japanese games. // 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"; pk.OT_Name = "GF";
return (int)LanguageID.English; return (int)LanguageID.English;

View file

@ -10,15 +10,15 @@ namespace PKHeX.Core
/// <inheritdoc cref="EncounterStatic1"/> /// <inheritdoc cref="EncounterStatic1"/>
public sealed class EncounterStatic1E : EncounterStatic1, IFixedGBLanguage public sealed class EncounterStatic1E : EncounterStatic1, IFixedGBLanguage
{ {
public EncounterGBLanguage Language { get; set; } = EncounterGBLanguage.Japanese; public EncounterGBLanguage Language { get; init; } = EncounterGBLanguage.Japanese;
/// <summary> Trainer name for the event. </summary> /// <summary> Trainer name for the event. </summary>
public string OT_Name { get; set; } = string.Empty; public string OT_Name { get; init; } = string.Empty;
public IReadOnlyList<string> OT_Names { get; set; } = Array.Empty<string>(); public IReadOnlyList<string> OT_Names { get; init; } = Array.Empty<string>();
/// <summary> Trainer ID for the event. </summary> /// <summary> Trainer ID for the event. </summary>
public int TID { get; set; } = -1; public int TID { get; init; } = -1;
public EncounterStatic1E(int species, int level, GameVersion ver) : base(species, level, ver) public EncounterStatic1E(int species, int level, GameVersion ver) : base(species, level, ver)
{ {

View file

@ -10,17 +10,17 @@ namespace PKHeX.Core
/// <inheritdoc cref="EncounterStatic2"/> /// <inheritdoc cref="EncounterStatic2"/>
public sealed class EncounterStatic2E : EncounterStatic2, IFixedGBLanguage public sealed class EncounterStatic2E : EncounterStatic2, IFixedGBLanguage
{ {
public EncounterGBLanguage Language { get; set; } = EncounterGBLanguage.Japanese; public EncounterGBLanguage Language { get; init; } = EncounterGBLanguage.Japanese;
/// <summary> Trainer name for the event. </summary> /// <summary> Trainer name for the event. </summary>
public string OT_Name { get; set; } = string.Empty; public string OT_Name { get; init; } = string.Empty;
public IReadOnlyList<string> OT_Names { get; set; } = Array.Empty<string>(); public IReadOnlyList<string> OT_Names { get; init; } = Array.Empty<string>();
/// <summary> Trainer ID for the event. </summary> /// <summary> Trainer ID for the event. </summary>
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) public EncounterStatic2E(int species, int level, GameVersion ver) : base(species, level, ver)
{ {

View file

@ -10,7 +10,7 @@ namespace PKHeX.Core
public sealed class EncounterStatic3 : EncounterStatic public sealed class EncounterStatic3 : EncounterStatic
{ {
public override int Generation => 3; public override int Generation => 3;
public bool Roaming { get; set; } public bool Roaming { get; init; }
public EncounterStatic3(int species, int level, GameVersion game) public EncounterStatic3(int species, int level, GameVersion game)
{ {

View file

@ -9,7 +9,7 @@ namespace PKHeX.Core
public class EncounterStatic5 : EncounterStatic public class EncounterStatic5 : EncounterStatic
{ {
public sealed override int Generation => 5; public sealed override int Generation => 5;
public bool Roaming { get; set; } public bool Roaming { get; init; }
public sealed override bool IsMatchDeferred(PKM pkm) public sealed override bool IsMatchDeferred(PKM pkm)
{ {

View file

@ -10,7 +10,7 @@ namespace PKHeX.Core
{ {
public override int Generation => 6; public override int Generation => 6;
internal IReadOnlyList<int> Contest { set => this.SetContestStats(value); } internal IReadOnlyList<int> Contest { init => this.SetContestStats(value); }
public int CNT_Cool { get; set; } public int CNT_Cool { get; set; }
public int CNT_Beauty { get; set; } public int CNT_Beauty { get; set; }
public int CNT_Cute { get; set; } public int CNT_Cute { get; set; }

View file

@ -10,7 +10,7 @@ namespace PKHeX.Core
public sealed class EncounterStatic7 : EncounterStatic, IRelearn public sealed class EncounterStatic7 : EncounterStatic, IRelearn
{ {
public override int Generation => 7; public override int Generation => 7;
public IReadOnlyList<int> Relearn { get; set; } = Array.Empty<int>(); public IReadOnlyList<int> Relearn { get; init; } = Array.Empty<int>();
protected override bool IsMatchLocation(PKM pkm) protected override bool IsMatchLocation(PKM pkm)
{ {

View file

@ -10,7 +10,7 @@ namespace PKHeX.Core
public class EncounterStatic8 : EncounterStatic, IDynamaxLevel, IGigantamax, IRelearn public class EncounterStatic8 : EncounterStatic, IDynamaxLevel, IGigantamax, IRelearn
{ {
public sealed override int Generation => 8; public sealed override int Generation => 8;
public bool ScriptedNoMarks { get; set; } public bool ScriptedNoMarks { get; init; }
public bool CanGigantamax { get; set; } public bool CanGigantamax { get; set; }
public byte DynamaxLevel { get; set; } public byte DynamaxLevel { get; set; }

View file

@ -28,8 +28,8 @@ namespace PKHeX.Core
public Shiny Shiny { get; init; } = Shiny.Never; public Shiny Shiny { get; init; } = Shiny.Never;
public int Ball { get; init; } = 4; public int Ball { get; init; } = 4;
public int TID { get; internal set; } public int TID { get; init; }
public int SID { get; internal set; } public int SID { get; init; }
public int OTGender { get; init; } = -1; public int OTGender { get; init; } = -1;
public GameVersion Version { get; set; } = GameVersion.Any; public GameVersion Version { get; set; } = GameVersion.Any;
@ -42,7 +42,7 @@ namespace PKHeX.Core
public int TID7 public int TID7
{ {
set init
{ {
TID = (ushort) value; TID = (ushort) value;
SID = value >> 16; SID = value >> 16;

View file

@ -11,7 +11,7 @@ namespace PKHeX.Core
/// </summary> /// </summary>
public readonly uint PID; public readonly uint PID;
internal IReadOnlyList<int> Contest { set => this.SetContestStats(value); } internal IReadOnlyList<int> Contest { init => this.SetContestStats(value); }
public int CNT_Cool { get; set; } public int CNT_Cool { get; set; }
public int CNT_Beauty { get; set; } public int CNT_Beauty { get; set; }
public int CNT_Cute { get; set; } public int CNT_Cute { get; set; }

View file

@ -17,7 +17,7 @@ namespace PKHeX.Core
Shiny = Shiny.FixedValue; Shiny = Shiny.FixedValue;
} }
internal IReadOnlyList<int> Contest { set => this.SetContestStats(value); } internal IReadOnlyList<int> Contest { init => this.SetContestStats(value); }
public int CNT_Cool { get; set; } public int CNT_Cool { get; set; }
public int CNT_Beauty { get; set; } public int CNT_Beauty { get; set; }
public int CNT_Cute { get; set; } public int CNT_Cute { get; set; }

View file

@ -3,23 +3,23 @@
/// <summary> /// <summary>
/// Object that can be fed to a <see cref="IEncounterable"/> converter to ensure that the resulting <see cref="PKM"/> meets rough specifications. /// Object that can be fed to a <see cref="IEncounterable"/> converter to ensure that the resulting <see cref="PKM"/> meets rough specifications.
/// </summary> /// </summary>
public sealed class EncounterCriteria public sealed record EncounterCriteria
{ {
public static readonly EncounterCriteria Unrestricted = new(); public static readonly EncounterCriteria Unrestricted = new();
public int Ability { get; set; } = -1; public int Ability { get; init; } = -1;
public int Gender { get; set; } = -1; public int Gender { get; init; } = -1;
public Nature Nature { get; set; } = Nature.Random; public Nature Nature { get; init; } = Nature.Random;
public Shiny Shiny { get; set; } = Shiny.Random; public Shiny Shiny { get; init; } = Shiny.Random;
public int IV_HP { get; set; } = RandomIV; public int IV_HP { get; init; } = RandomIV;
public int IV_ATK { get; set; } = RandomIV; public int IV_ATK { get; init; } = RandomIV;
public int IV_DEF { get; set; } = RandomIV; public int IV_DEF { get; init; } = RandomIV;
public int IV_SPA { get; set; } = RandomIV; public int IV_SPA { get; init; } = RandomIV;
public int IV_SPD { get; set; } = RandomIV; public int IV_SPD { get; init; } = RandomIV;
public int IV_SPE { get; set; } = 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; private const int RandomIV = -1;

View file

@ -149,10 +149,10 @@ namespace PKHeX.Core
return Encounter switch return Encounter switch
{ {
EncounterTrade1 t1 when t1.IsMatchDeferred(pkm) => GBEncounterPriority.Least, EncounterTrade1 t1 when t1.IsMatchDeferred(pkm) => GBEncounterPriority.Least,
EncounterTrade1 _ => GBEncounterPriority.TradeEncounterG1, EncounterTrade1 => GBEncounterPriority.TradeEncounterG1,
EncounterTrade2 _ => GBEncounterPriority.TradeEncounterG2, EncounterTrade2 => GBEncounterPriority.TradeEncounterG2,
EncounterStatic _ => GBEncounterPriority.StaticEncounter, EncounterStatic => GBEncounterPriority.StaticEncounter,
EncounterSlot _ => GBEncounterPriority.WildEncounter, EncounterSlot => GBEncounterPriority.WildEncounter,
_ => GBEncounterPriority.EggEncounter _ => GBEncounterPriority.EggEncounter
}; };
} }

View file

@ -45,7 +45,7 @@ namespace PKHeX.Core
return EncounterMatch switch return EncounterMatch switch
{ {
EncounterSlot1 _ => new CheckResult(Severity.Valid, LEncCondition, CheckIdentifier.Encounter), EncounterSlot1 => new CheckResult(Severity.Valid, LEncCondition, CheckIdentifier.Encounter),
EncounterSlot2 s2 => VerifyWildEncounterGen2(pkm, s2), EncounterSlot2 s2 => VerifyWildEncounterGen2(pkm, s2),
EncounterStatic s => VerifyEncounterStatic(pkm, s), EncounterStatic s => VerifyEncounterStatic(pkm, s),
EncounterTrade t => VerifyEncounterTrade(pkm, t), EncounterTrade t => VerifyEncounterTrade(pkm, t),

View file

@ -436,8 +436,8 @@ namespace PKHeX.Core
public static string LTransferMet { get; set; } = "Invalid Met Location, expected Poké Transfer or Crown."; 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 LTransferMetLocation { get; set; } = "Invalid Transfer Met Location.";
public static string LTransferMove { get; set; } = "Incompatible transfer move."; 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 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 transfered to Generation {1}."; 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 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 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]!"; public static string LTransferPIDECBitFlip { get; set; } = "PID should be equal to EC [with top bit flipped]!";

View file

@ -6,7 +6,7 @@ namespace PKHeX.Core
internal sealed class MoveParseSource internal sealed class MoveParseSource
{ {
private static readonly int[] Empty = Array.Empty<int>(); private static readonly int[] Empty = Array.Empty<int>();
public IReadOnlyList<int> CurrentMoves { get; set; } = Empty; public IReadOnlyList<int> CurrentMoves { get; init; } = Empty;
public IReadOnlyList<int> SpecialSource { get; set; } = Empty; public IReadOnlyList<int> SpecialSource { get; set; } = Empty;
public int[] NonTradeBackLevelUpMoves { get; set; } = Empty; public int[] NonTradeBackLevelUpMoves { get; set; } = Empty;

View file

@ -826,7 +826,7 @@ namespace PKHeX.Core
return true; return true;
// forced shiny eggs, when hatched, can lose their detectable correlation. // 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); 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); return pkm.Version == (int)GameVersion.CXD && (val == PIDType.CXD || val == PIDType.CXDAnti);
case EncounterStatic3 s: case EncounterStatic3 s:
switch (pkm.Version) switch (pkm.Version)
@ -886,7 +886,7 @@ namespace PKHeX.Core
var ver = (GameVersion)pkm.Version; var ver = (GameVersion)pkm.Version;
var IsDPPt = ver == GameVersion.D || ver == GameVersion.P || ver == GameVersion.Pt; var IsDPPt = ver == GameVersion.D || ver == GameVersion.P || ver == GameVersion.Pt;
return pkm.IsShiny && IsDPPt && sl.TypeEncounter == EncounterType.TallGrass && !Locations.IsSafariZoneLocation4(sl.Location); return pkm.IsShiny && IsDPPt && sl.TypeEncounter == EncounterType.TallGrass && !Locations.IsSafariZoneLocation4(sl.Location);
case PGT _: // manaphy case PGT: // manaphy
return IsG4ManaphyPIDValid(val, pkm); return IsG4ManaphyPIDValid(val, pkm);
case PCD d when d.Gift.PK.PID != 1: case PCD d when d.Gift.PK.PID != 1:
return true; // already matches PCD's fixed PID requirement return true; // already matches PCD's fixed PID requirement

View file

@ -34,7 +34,7 @@ namespace PKHeX.Core
return VerifyBallEquals(data, t.Ball); return VerifyBallEquals(data, t.Ball);
case EncounterStatic {Gift: true} s: case EncounterStatic {Gift: true} s:
return VerifyBallEquals(data, s.Ball); return VerifyBallEquals(data, s.Ball);
case EncounterSlot8GO _: // Already a strict match case EncounterSlot8GO: // Already a strict match
return GetResult(true); return GetResult(true);
} }
@ -56,8 +56,8 @@ namespace PKHeX.Core
{ {
EncounterStatic e => VerifyBallStatic(data, e), EncounterStatic e => VerifyBallStatic(data, e),
EncounterSlot w => VerifyBallWild(data, w), EncounterSlot w => VerifyBallWild(data, w),
EncounterEgg _ => VerifyBallEgg(data), EncounterEgg => VerifyBallEgg(data),
EncounterInvalid _ => VerifyBallEquals(data, pkm.Ball), // ignore ball, pass whatever EncounterInvalid => VerifyBallEquals(data, pkm.Ball), // ignore ball, pass whatever
_ => VerifyBallEquals(data, (int)Poke) _ => VerifyBallEquals(data, (int)Poke)
}; };
} }

View file

@ -177,8 +177,8 @@ namespace PKHeX.Core
return true; return true;
return enc switch return enc switch
{ {
EncounterTrade _ => false, EncounterTrade => false,
EncounterSlot8GO _ => false, EncounterSlot8GO => false,
WC6 wc6 when wc6.OT_Name.Length > 0 => 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 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, WC8 wc8 when wc8.GetHasOT(pkm.Language) => false,

View file

@ -80,13 +80,13 @@ namespace PKHeX.Core
switch (enc) switch (enc)
{ {
case WC8 _: case WC8:
case EncounterEgg _: case EncounterEgg:
case EncounterTrade _: case EncounterTrade:
case EncounterStatic8U _: case EncounterStatic8U:
case EncounterStatic8N _: case EncounterStatic8N:
case EncounterStatic8ND _: case EncounterStatic8ND:
case EncounterStatic8NC _: case EncounterStatic8NC:
case EncounterStatic8 s when s.Gift || s.ScriptedNoMarks: case EncounterStatic8 s when s.Gift || s.ScriptedNoMarks:
return false; return false;
} }

View file

@ -34,7 +34,7 @@ namespace PKHeX.Core
case PK4 pk4 when pk4.PokéathlonStat != 0: case PK4 pk4 when pk4.PokéathlonStat != 0:
data.AddLine(GetInvalid(LEggPokeathlon, Egg)); data.AddLine(GetInvalid(LEggPokeathlon, Egg));
break; 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)); data.AddLine(GetInvalid(string.Format(LOTLanguage, LanguageID.Japanese, (LanguageID)pkm.Language), Egg));
break; break;
} }
@ -188,8 +188,8 @@ namespace PKHeX.Core
VerifyFatefulMysteryGift(data, g); VerifyFatefulMysteryGift(data, g);
return; return;
case EncounterStatic {Fateful: true}: // ingame fateful case EncounterStatic {Fateful: true}: // ingame fateful
case EncounterSlot3PokeSpot _: // ingame pokespot case EncounterSlot3PokeSpot: // ingame pokespot
case EncounterTrade4Ranch _: // ranch varied PID case EncounterTrade4Ranch: // ranch varied PID
VerifyFatefulIngameActive(data); VerifyFatefulIngameActive(data);
return; return;
} }

View file

@ -21,9 +21,9 @@ namespace PKHeX.Core
var pkm = data.pkm; var pkm = data.pkm;
switch (data.EncounterMatch) switch (data.EncounterMatch)
{ {
case EncounterTrade _: case EncounterTrade:
case MysteryGift {IsEgg: false}: case MysteryGift {IsEgg: false}:
case EncounterStatic5N _: case EncounterStatic5N:
return; // already verified return; // already verified
} }

View file

@ -186,7 +186,6 @@ namespace PKHeX.Core
public virtual int BP { get => 0; set { } } public virtual int BP { get => 0; set { } }
public virtual bool IsBean { get => false; set { } } public virtual bool IsBean { get => false; set { } }
public virtual int Bean { get => 0; 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()}"; public virtual string CardHeader => (CardID > 0 ? $"Card #: {CardID:0000}" : "N/A") + $" - {CardTitle.Replace('\u3000',' ').Trim()}";

View file

@ -582,8 +582,8 @@ namespace PKHeX.Core
private int GetTradedEggLocation() => Locations.TradedEggLocation(Generation); private int GetTradedEggLocation() => Locations.TradedEggLocation(Generation);
public virtual bool IsUntraded => false; public virtual bool IsUntraded => false;
public virtual bool IsNative => Generation == Format; public bool IsNative => Generation == Format;
public virtual bool IsOriginValid => Species <= Legal.GetMaxSpeciesOrigin(Format); public bool IsOriginValid => Species <= Legal.GetMaxSpeciesOrigin(Format);
/// <summary> /// <summary>
/// Checks if the <see cref="PKM"/> could inhabit a set of games. /// Checks if the <see cref="PKM"/> could inhabit a set of games.

View file

@ -9,29 +9,29 @@ namespace PKHeX.Core.Searching
/// </summary> /// </summary>
public sealed class SearchSettings public sealed class SearchSettings
{ {
public int Format { private get; set; } public int Format { private get; init; }
public int Generation { private get; set; } public int Generation { private get; init; }
public int Species { get; set; } = -1; public int Species { get; init; } = -1;
public int Ability { private get; set; } = -1; public int Ability { private get; init; } = -1;
public int Nature { private get; set; } = -1; public int Nature { private get; init; } = -1;
public int Item { private get; set; } = -1; public int Item { private get; init; } = -1;
public int Version { private get; set; } = -1; public int Version { private get; init; } = -1;
public int HiddenPowerType { private get; set; } = -1; public int HiddenPowerType { private get; init; } = -1;
public SearchComparison SearchFormat { private get; set; } public SearchComparison SearchFormat { private get; init; }
public SearchComparison SearchLevel { private get; set; } public SearchComparison SearchLevel { private get; init; }
public bool? SearchShiny { private get; set; } public bool? SearchShiny { private get; set; }
public bool? SearchLegal { private get; set; } public bool? SearchLegal { private get; set; }
public bool? SearchEgg { get; set; } public bool? SearchEgg { get; set; }
public int? ESV { private 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 IVType { private get; init; }
public int EVType { private get; set; } public int EVType { private get; init; }
public CloneDetectionMethod SearchClones { private get; set; } public CloneDetectionMethod SearchClones { private get; set; }
public IList<string> BatchInstructions { private get; set; } = Array.Empty<string>(); public IList<string> BatchInstructions { private get; init; } = Array.Empty<string>();
public readonly List<int> Moves = new(); public readonly List<int> Moves = new();

View file

@ -352,8 +352,8 @@ LTransferHTFlagRequired = Current handler cannot be past gen OT for transferred
LTransferMet = Invalid Met Location, expected Poké Transfer or Crown. LTransferMet = Invalid Met Location, expected Poké Transfer or Crown.
LTransferMetLocation = Invalid Transfer Met Location. LTransferMetLocation = Invalid Transfer Met Location.
LTransferMove = Incompatible transfer move. LTransferMove = Incompatible transfer move.
LTransferMoveG4HM = Defog and whirpool. One of the two moves should have been removed before transfered to Generation 5. 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 transfered to Generation {1}. LTransferMoveHM = Generation {0} HM. Should have been removed before transferred to Generation {1}.
LTransferNature = Invalid Nature for transfer Experience. LTransferNature = Invalid Nature for transfer Experience.
LTransferOriginFInvalid0_1 = {0} origin cannot exist in the currently loaded ({1}) savegame. LTransferOriginFInvalid0_1 = {0} origin cannot exist in the currently loaded ({1}) savegame.
LTransferPIDECBitFlip = PID should be equal to EC [with top bit flipped]! LTransferPIDECBitFlip = PID should be equal to EC [with top bit flipped]!

View file

@ -352,8 +352,8 @@ LTransferHTFlagRequired = Current handler cannot be past gen OT for transferred
LTransferMet = Invalid Met Location, expected Poké Transfer or Crown. LTransferMet = Invalid Met Location, expected Poké Transfer or Crown.
LTransferMetLocation = Invalid Transfer Met Location. LTransferMetLocation = Invalid Transfer Met Location.
LTransferMove = Incompatible transfer move. LTransferMove = Incompatible transfer move.
LTransferMoveG4HM = Defog and whirpool. One of the two moves should have been removed before transfered to Generation 5. 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 transfered to Generation {1}. LTransferMoveHM = Generation {0} HM. Should have been removed before transferred to Generation {1}.
LTransferNature = Invalid Nature for transfer Experience. LTransferNature = Invalid Nature for transfer Experience.
LTransferOriginFInvalid0_1 = {0} origin cannot exist in the currently loaded ({1}) savegame. LTransferOriginFInvalid0_1 = {0} origin cannot exist in the currently loaded ({1}) savegame.
LTransferPIDECBitFlip = PID should be equal to EC [with top bit flipped]! LTransferPIDECBitFlip = PID should be equal to EC [with top bit flipped]!

View file

@ -352,8 +352,8 @@ LTransferHTFlagRequired = Current handler cannot be past gen OT for transferred
LTransferMet = Invalid Met Location, expected Poké Transfer or Crown. LTransferMet = Invalid Met Location, expected Poké Transfer or Crown.
LTransferMetLocation = Invalid Transfer Met Location. LTransferMetLocation = Invalid Transfer Met Location.
LTransferMove = Incompatible transfer move. LTransferMove = Incompatible transfer move.
LTransferMoveG4HM = Defog and whirpool. One of the two moves should have been removed before transfered to Generation 5. 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 transfered to Generation {1}. LTransferMoveHM = Generation {0} HM. Should have been removed before transferred to Generation {1}.
LTransferNature = Invalid Nature for transfer Experience. LTransferNature = Invalid Nature for transfer Experience.
LTransferOriginFInvalid0_1 = {0} origin cannot exist in the currently loaded ({1}) savegame. LTransferOriginFInvalid0_1 = {0} origin cannot exist in the currently loaded ({1}) savegame.
LTransferPIDECBitFlip = PID should be equal to EC [with top bit flipped]! LTransferPIDECBitFlip = PID should be equal to EC [with top bit flipped]!

View file

@ -352,8 +352,8 @@ LTransferHTFlagRequired = Current handler cannot be past gen OT for transferred
LTransferMet = Invalid Met Location, expected Poké Transfer or Crown. LTransferMet = Invalid Met Location, expected Poké Transfer or Crown.
LTransferMetLocation = Invalid Transfer Met Location. LTransferMetLocation = Invalid Transfer Met Location.
LTransferMove = Incompatible transfer move. LTransferMove = Incompatible transfer move.
LTransferMoveG4HM = Defog and whirpool. One of the two moves should have been removed before transfered to Generation 5. 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 transfered to Generation {1}. LTransferMoveHM = Generation {0} HM. Should have been removed before transferred to Generation {1}.
LTransferNature = Invalid Nature for transfer Experience. LTransferNature = Invalid Nature for transfer Experience.
LTransferOriginFInvalid0_1 = {0} origin cannot exist in the currently loaded ({1}) savegame. LTransferOriginFInvalid0_1 = {0} origin cannot exist in the currently loaded ({1}) savegame.
LTransferPIDECBitFlip = PID should be equal to EC [with top bit flipped]! LTransferPIDECBitFlip = PID should be equal to EC [with top bit flipped]!

View file

@ -6,9 +6,9 @@ namespace PKHeX.Core
public abstract class BlockInfo public abstract class BlockInfo
{ {
// General // General
public uint ID { get; set; } public uint ID { get; init; }
public int Offset { get; set; } public int Offset { get; protected init; }
public int Length { get; set; } public int Length { get; init; }
public string Summary => $"{ID:00}: {Offset:X5}-{Offset + Length - 1:X5}, {Length:X5}"; public string Summary => $"{ID:00}: {Offset:X5}-{Offset + Length - 1:X5}, {Length:X5}";

View file

@ -262,7 +262,7 @@ namespace PKHeX.Core
bool header = newHC == oldHC; bool header = newHC == oldHC;
bool body = chk.SequenceEqual(checksum); bool body = chk.SequenceEqual(checksum);
static string valid(bool s) => s ? "Valid" : "Invalid"; 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)}.";
} }
} }

View file

@ -66,8 +66,8 @@ namespace PKHeX.Core
protected int CGearDataOffset; protected int CGearDataOffset;
protected int EntreeForestOffset; protected int EntreeForestOffset;
private int AdventureInfo; private int AdventureInfo;
public int GTS { get; protected set; } = int.MinValue; public int GTS { get; } = int.MinValue;
public int Fused { get; protected set; } = int.MinValue; public int Fused { get; } = int.MinValue;
// Daycare // Daycare
public override int DaycareSeedSize => Daycare5.DaycareSeedSize; public override int DaycareSeedSize => Daycare5.DaycareSeedSize;

View file

@ -4,7 +4,7 @@
namespace PKHeX.Core namespace PKHeX.Core
{ {
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct DecorationInventory3 public readonly struct DecorationInventory3
{ {
public const int SIZE = 150; public const int SIZE = 150;

View file

@ -61,8 +61,8 @@ namespace PKHeX.Core
protected abstract void SetAllDexFlagsLanguage(int bit, int lang, bool value = true); 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 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 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 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 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); public virtual void SetCaught(int species, bool value = true) => SetFlag(OFS_CAUGHT, species - 1, value);

View file

@ -10,7 +10,7 @@ namespace PKHeX.Core
protected override int BitSeenSize => 0x60; protected override int BitSeenSize => 0x60;
protected override int DexLangFlagByteCount => 631; // 721 * 7, rounded up protected override int DexLangFlagByteCount => 631; // 721 * 7, rounded up
protected override int DexLangIDCount => 7; 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) protected Zukan6(SAV6XY sav, int dex, int langflag) : base(sav, dex, langflag)
{ {

View file

@ -18,7 +18,7 @@ namespace PKHeX.Drawing
public static Bitmap LayerImage(Image baseLayer, Image overLayer, int x, int y) 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); using Graphics gr = Graphics.FromImage(img);
gr.DrawImage(overLayer, x, y, overLayer.Width, overLayer.Height); gr.DrawImage(overLayer, x, y, overLayer.Width, overLayer.Height);
return img; return img;

View file

@ -71,7 +71,7 @@ namespace PKHeX.Drawing
/// <summary> /// <summary>
/// Species that show their default Species sprite regardless of current <see cref="PKM.Form"/> /// Species that show their default Species sprite regardless of current <see cref="PKM.Form"/>
/// </summary> /// </summary>
private static readonly HashSet<int> SpeciesDefaultFormSprite = new HashSet<int> private static readonly HashSet<int> SpeciesDefaultFormSprite = new()
{ {
(int)Species.Mothim, (int)Species.Mothim,
(int)Species.Arceus, (int)Species.Arceus,
@ -88,7 +88,7 @@ namespace PKHeX.Drawing
/// <summary> /// <summary>
/// Species that show a <see cref="PKM.Gender"/> specific Sprite /// Species that show a <see cref="PKM.Gender"/> specific Sprite
/// </summary> /// </summary>
private static readonly HashSet<int> SpeciesGenderedSprite = new HashSet<int> private static readonly HashSet<int> SpeciesGenderedSprite = new()
{ {
(int)Species.Pikachu, (int)Species.Pikachu,
(int)Species.Hippopotas, (int)Species.Hippopotas,

View file

@ -7,8 +7,8 @@ namespace PKHeX.Drawing
{ {
public static class SpriteUtil public static class SpriteUtil
{ {
public static readonly SpriteBuilder3040 SB17 = new SpriteBuilder3040(); public static readonly SpriteBuilder3040 SB17 = new();
public static readonly SpriteBuilder5668 SB8 = new SpriteBuilder5668(); public static readonly SpriteBuilder5668 SB8 = new();
public static SpriteBuilder Spriter { get; set; } = SB8; public static SpriteBuilder Spriter { get; set; } = SB8;
public static Image GetBallSprite(int ball) public static Image GetBallSprite(int ball)

View file

@ -6,7 +6,7 @@ namespace PKHeX.WinForms.Controls
{ {
public partial class CatchRate : UserControl public partial class CatchRate : UserControl
{ {
private PK1 pk1 = new PK1(); private PK1 pk1 = new();
public CatchRate() => InitializeComponent(); public CatchRate() => InitializeComponent();
public void LoadPK1(PK1 pk) => NUD_CatchRate.Value = (pk1 = pk).Catch_Rate; public void LoadPK1(PK1 pk) => NUD_CatchRate.Value = (pk1 = pk).Catch_Rate;

View file

@ -95,7 +95,7 @@ namespace PKHeX.WinForms
public Color GetText(bool highlight) => highlight ? TextHighlighted : TextColor; public Color GetText(bool highlight) => highlight ? TextHighlighted : TextColor;
public Color GetBackground(bool legal, bool highlight) => highlight ? BackHighlighted : (legal ? BackLegal : BackColor); 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() public void LoadBrushes()
{ {

View file

@ -129,7 +129,7 @@ namespace PKHeX.WinForms.Controls
/// <summary> /// <summary>
/// List of legal moves for the latest <see cref="Legality"/>. /// List of legal moves for the latest <see cref="Legality"/>.
/// </summary> /// </summary>
private readonly LegalMoveSource LegalMoveSource = new LegalMoveSource(); private readonly LegalMoveSource LegalMoveSource = new();
/// <summary> /// <summary>
/// Gender Symbols for showing Genders /// Gender Symbols for showing Genders
@ -223,12 +223,12 @@ namespace PKHeX.WinForms.Controls
case 7: case 7:
switch (pk) switch (pk)
{ {
case PK7 _: case PK7:
GetFieldsfromPKM = PopulateFieldsPK7; GetFieldsfromPKM = PopulateFieldsPK7;
GetPKMfromFields = PreparePK7; GetPKMfromFields = PreparePK7;
break; break;
case PB7 _: case PB7:
GetFieldsfromPKM = PopulateFieldsPB7; GetFieldsfromPKM = PopulateFieldsPB7;
GetPKMfromFields = PreparePB7; GetPKMfromFields = PreparePB7;
break; break;

View file

@ -20,7 +20,7 @@ namespace PKHeX.WinForms.Controls
private Image? ExtraLayer; private Image? ExtraLayer;
private Image?[]? GlowCache; private Image?[]? GlowCache;
public Image? OriginalBackground; public Image? OriginalBackground;
private readonly object Lock = new object(); private readonly object Lock = new();
private PictureBox? pb; private PictureBox? pb;
private int GlowInterval; private int GlowInterval;

View file

@ -9,7 +9,7 @@ namespace PKHeX.WinForms.Controls
public sealed class BoxMenuStrip : ContextMenuStrip public sealed class BoxMenuStrip : ContextMenuStrip
{ {
private readonly SAVEditor SAV; private readonly SAVEditor SAV;
private readonly List<ItemVisibility> CustomItems = new List<ItemVisibility>(); private readonly List<ItemVisibility> CustomItems = new();
private readonly BoxManipulator Manipulator; private readonly BoxManipulator Manipulator;
public BoxMenuStrip(SAVEditor sav) public BoxMenuStrip(SAVEditor sav)
@ -40,7 +40,7 @@ namespace PKHeX.WinForms.Controls
CustomItems.Add(new ItemVisibility(tsi, item)); CustomItems.Add(new ItemVisibility(tsi, item));
} }
private static readonly Dictionary<BoxManipType, Image> ManipTypeImage = new Dictionary<BoxManipType, Image> private static readonly Dictionary<BoxManipType, Image> ManipTypeImage = new()
{ {
[BoxManipType.DeleteAll] = Resources.nocheck, [BoxManipType.DeleteAll] = Resources.nocheck,
[BoxManipType.DeleteEggs] = Resources.about, [BoxManipType.DeleteEggs] = Resources.about,

View file

@ -29,7 +29,7 @@ namespace PKHeX.WinForms.Controls
public SaveFile SAV { get; private set; } = new FakeSaveFile(); public SaveFile SAV { get; private set; } = new FakeSaveFile();
public int CurrentBox => Box.CurrentBox; public int CurrentBox => Box.CurrentBox;
public SlotChangeManager M { get; set; } public SlotChangeManager M { get; }
public readonly ContextMenuSAV menu; public readonly ContextMenuSAV menu;
public readonly BoxMenuStrip SortMenu; public readonly BoxMenuStrip SortMenu;

View file

@ -18,12 +18,12 @@ namespace PKHeX.WinForms.Controls
public sealed class SlotChangeManager : IDisposable public sealed class SlotChangeManager : IDisposable
{ {
public readonly SAVEditor SE; public readonly SAVEditor SE;
public readonly SlotTrackerImage LastSlot = new SlotTrackerImage(); public readonly SlotTrackerImage LastSlot = new();
public readonly DragManager Drag = new DragManager(); public readonly DragManager Drag = new();
public SaveDataEditor<PictureBox> Env { get; set; } = null!; public SaveDataEditor<PictureBox> Env { get; set; } = null!;
public readonly List<BoxEditor> Boxes = new List<BoxEditor>(); public readonly List<BoxEditor> Boxes = new();
public readonly SlotHoverHandler Hover = new SlotHoverHandler(); public readonly SlotHoverHandler Hover = new();
public SlotChangeManager(SAVEditor se) => SE = se; public SlotChangeManager(SAVEditor se) => SE = se;
@ -35,9 +35,8 @@ namespace PKHeX.WinForms.Controls
public void MouseEnter(object? sender, EventArgs e) public void MouseEnter(object? sender, EventArgs e)
{ {
if (sender == null) if (sender is not PictureBox pb)
return; return;
var pb = (PictureBox)sender;
if (pb.Image == null) if (pb.Image == null)
return; return;
Hover.Start(pb, LastSlot); Hover.Start(pb, LastSlot);

View file

@ -8,7 +8,7 @@ namespace PKHeX.WinForms.Controls
{ {
public sealed class CryPlayer public sealed class CryPlayer
{ {
private readonly SoundPlayer Sounds = new SoundPlayer(); private readonly SoundPlayer Sounds = new();
public void PlayCry(PKM pk) public void PlayCry(PKM pk)
{ {

View file

@ -5,7 +5,7 @@ namespace PKHeX.WinForms.Controls
{ {
public sealed class DragManager public sealed class DragManager
{ {
public SlotChangeInfo<Cursor, PictureBox> Info { get; private set; } = new SlotChangeInfo<Cursor, PictureBox>(); public SlotChangeInfo<Cursor, PictureBox> Info { get; private set; } = new();
public event DragEventHandler? RequestExternalDragDrop; public event DragEventHandler? RequestExternalDragDrop;
public void RequestDD(object sender, DragEventArgs e) => RequestExternalDragDrop?.Invoke(sender, e); public void RequestDD(object sender, DragEventArgs e) => RequestExternalDragDrop?.Invoke(sender, e);

View file

@ -13,7 +13,7 @@ namespace PKHeX.WinForms.Controls
InitializeComponent(); InitializeComponent();
} }
public readonly List<PictureBox> Entries = new List<PictureBox>(); public readonly List<PictureBox> Entries = new();
public int Slots { get; private set; } public int Slots { get; private set; }
private int sizeW = 40; private int sizeW = 40;
@ -73,7 +73,7 @@ namespace PKHeX.WinForms.Controls
public static PictureBox GetControl(int width, int height) public static PictureBox GetControl(int width, int height)
{ {
return new PictureBox return new()
{ {
AutoSize = false, AutoSize = false,
SizeMode = PictureBoxSizeMode.CenterImage, SizeMode = PictureBoxSizeMode.CenterImage,

View file

@ -12,14 +12,14 @@ namespace PKHeX.WinForms.Controls
/// </summary> /// </summary>
public sealed class SlotHoverHandler : IDisposable 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 bool GlowHover { private get; set; } = true;
public static readonly CryPlayer CryPlayer = new CryPlayer(); public static readonly CryPlayer CryPlayer = new();
public static readonly SummaryPreviewer Preview = new SummaryPreviewer(); public static readonly SummaryPreviewer Preview = new();
private static Bitmap Hover => SpriteUtil.Spriter.Hover; private static Bitmap Hover => SpriteUtil.Spriter.Hover;
private readonly BitmapAnimator HoverWorker = new BitmapAnimator(); private readonly BitmapAnimator HoverWorker = new();
private PictureBox? Slot; private PictureBox? Slot;
private SlotTrackerImage? LastSlot; private SlotTrackerImage? LastSlot;

View file

@ -10,8 +10,8 @@ namespace PKHeX.WinForms.Controls
{ {
private static readonly string[] names = Enum.GetNames(typeof(StorageSlotType)); private static readonly string[] names = Enum.GetNames(typeof(StorageSlotType));
private readonly LabelType[] Labels = new LabelType[names.Length]; private readonly LabelType[] Labels = new LabelType[names.Length];
private readonly List<PictureBox> slots = new List<PictureBox>(); private readonly List<PictureBox> slots = new();
private List<SlotInfoMisc> SlotOffsets = new List<SlotInfoMisc>(); private List<SlotInfoMisc> SlotOffsets = new();
public int SlotCount { get; private set; } public int SlotCount { get; private set; }
public SaveFile SAV { get; set; } = null!; public SaveFile SAV { get; set; } = null!;
public bool FlagIllegal { get; set; } public bool FlagIllegal { get; set; }
@ -121,7 +121,7 @@ namespace PKHeX.WinForms.Controls
private static PictureBox GetPictureBox(int index, SpriteBuilder s) private static PictureBox GetPictureBox(int index, SpriteBuilder s)
{ {
return new PictureBox return new()
{ {
BorderStyle = BorderStyle.FixedSingle, BorderStyle = BorderStyle.FixedSingle,
Width = s.Width + 2, Width = s.Width + 2,

View file

@ -6,7 +6,7 @@ namespace PKHeX.WinForms.Controls
{ {
public sealed class SummaryPreviewer 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) public void Show(Control pb, PKM pk)
{ {

View file

@ -86,7 +86,7 @@ namespace PKHeX.WinForms
private readonly string[] main_langlist = Enum.GetNames(typeof(ProgramLanguage)); private readonly string[] main_langlist = Enum.GetNames(typeof(ProgramLanguage));
private static readonly List<IPlugin> Plugins = new List<IPlugin>(); private static readonly List<IPlugin> Plugins = new();
#endregion #endregion
#region Path Variables #region Path Variables
@ -280,7 +280,7 @@ namespace PKHeX.WinForms
BAKprompt = Settings.BAKPrompt = true; BAKprompt = Settings.BAKPrompt = true;
} }
public static DrawConfig Draw { get; private set; } = new DrawConfig(); public static DrawConfig Draw { get; private set; } = new();
private void FormInitializeSecond() private void FormInitializeSecond()
{ {

View file

@ -89,7 +89,7 @@ namespace PKHeX.WinForms
{ {
return personalInfo switch return personalInfo switch
{ {
PersonalInfoSM _ => s > 721 || Legal.PastGenAlolanNatives.Contains(s), PersonalInfoSM => s > 721 || Legal.PastGenAlolanNatives.Contains(s),
PersonalInfoSWSH ss => ss.IsInDex, PersonalInfoSWSH ss => ss.IsInDex,
_ => true, _ => true,
}; };

View file

@ -230,7 +230,7 @@ namespace PKHeX.WinForms
} }
// Mass Editing // Mass Editing
private Core.BatchEditor editor = new Core.BatchEditor(); private Core.BatchEditor editor = new();
private void ProcessSAV(IList<PKM> data, IReadOnlyList<StringInstruction> Filters, IReadOnlyList<StringInstruction> Instructions) private void ProcessSAV(IList<PKM> data, IReadOnlyList<StringInstruction> Filters, IReadOnlyList<StringInstruction> Instructions)
{ {

View file

@ -49,8 +49,8 @@ namespace PKHeX.WinForms
} }
} }
private readonly List<RegimenInfo> reglist = new List<RegimenInfo>(); private readonly List<RegimenInfo> reglist = new();
private readonly List<RegimenInfo> distlist = new List<RegimenInfo>(); private readonly List<RegimenInfo> distlist = new();
private readonly ISuperTrain pkm; private readonly ISuperTrain pkm;
private const string PrefixCHK = "CHK_"; private const string PrefixCHK = "CHK_";

View file

@ -46,7 +46,7 @@ namespace PKHeX.WinForms
CenterToParent(); CenterToParent();
} }
private readonly List<NumericUpDown> Bytes = new List<NumericUpDown>(); private readonly List<NumericUpDown> Bytes = new();
public string FinalString; public string FinalString;
public byte[] FinalBytes { get; private set; } = Array.Empty<byte>(); public byte[] FinalBytes { get; private set; } = Array.Empty<byte>();
private readonly byte[] Raw; private readonly byte[] Raw;
@ -177,9 +177,9 @@ namespace PKHeX.WinForms
private string GetString() => SAV.GetString(Raw, 0, Raw.Length); private string GetString() => SAV.GetString(Raw, 0, Raw.Length);
// Helpers // 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, Maximum = max,
Minimum = min, Minimum = min,

View file

@ -42,7 +42,7 @@ namespace PKHeX.WinForms
WinFormsUtil.Alert(MsgReportColumnRestoreSuccess); WinFormsUtil.Alert(MsgReportColumnRestoreSuccess);
}; };
ContextMenuStrip mnu = new ContextMenuStrip(); ContextMenuStrip mnu = new();
mnu.Items.Add(mnuHide); mnu.Items.Add(mnuHide);
mnu.Items.Add(mnuRestore); mnu.Items.Add(mnuRestore);

View file

@ -102,8 +102,8 @@ namespace PKHeX.WinForms
private readonly PictureBox[] PKXBOXES; private readonly PictureBox[] PKXBOXES;
private readonly string DatabasePath = Main.DatabasePath; private readonly string DatabasePath = Main.DatabasePath;
private List<PKM> Results = new List<PKM>(); private List<PKM> Results = new();
private List<PKM> RawDB = new List<PKM>(); private List<PKM> RawDB = new();
private int slotSelected = -1; // = null; private int slotSelected = -1; // = null;
private Image? slotColor; private Image? slotColor;
private const int RES_MAX = 66; private const int RES_MAX = 66;
@ -112,7 +112,7 @@ namespace PKHeX.WinForms
private readonly string Viewed; private readonly string Viewed;
private const int MAXFORMAT = PKX.Generation; private const int MAXFORMAT = PKX.Generation;
private readonly string EXTERNAL_SAV = new DirectoryInfo(Main.BackupPath).Name + Path.DirectorySeparatorChar; 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 // Important Events
private void ClickView(object sender, EventArgs e) private void ClickView(object sender, EventArgs e)
@ -312,7 +312,7 @@ namespace PKHeX.WinForms
if (this.OpenWindowExists<ReportGrid>()) if (this.OpenWindowExists<ReportGrid>())
return; return;
ReportGrid reportGrid = new ReportGrid(); ReportGrid reportGrid = new();
reportGrid.Show(); reportGrid.Show();
reportGrid.PopulateData(Results.ToArray()); reportGrid.PopulateData(Results.ToArray());
} }

View file

@ -95,7 +95,7 @@ namespace PKHeX.WinForms
} }
private readonly PictureBox[] PKXBOXES; private readonly PictureBox[] PKXBOXES;
private List<IEncounterable> Results = new List<IEncounterable>(); private List<IEncounterable> Results = new();
private int slotSelected = -1; // = null; private int slotSelected = -1; // = null;
private Image? slotColor; private Image? slotColor;
private const int RES_MAX = 66; private const int RES_MAX = 66;

View file

@ -18,7 +18,7 @@ namespace PKHeX.WinForms
private readonly List<INamedFolderPath> Paths; private readonly List<INamedFolderPath> Paths;
private readonly SortableBindingList<SavePreview> Recent; private readonly SortableBindingList<SavePreview> Recent;
private readonly SortableBindingList<SavePreview> Backup; private readonly SortableBindingList<SavePreview> Backup;
private readonly List<Label> TempTranslationLabels = new List<Label>(); private readonly List<Label> TempTranslationLabels = new();
public SAV_FolderList(Action<SaveFile> openSaveFile) public SAV_FolderList(Action<SaveFile> openSaveFile)
{ {
@ -129,7 +129,7 @@ namespace PKHeX.WinForms
private static Button GetCustomButton(string name) private static Button GetCustomButton(string name)
{ {
return new Button return new()
{ {
Size = new Size { Height = ButtonHeight, Width = ButtonWidth }, Size = new Size { Height = ButtonHeight, Width = ButtonWidth },
Text = name, Text = name,
@ -229,7 +229,7 @@ namespace PKHeX.WinForms
}; };
mnuBrowseAt.Click += (sender, e) => ClickOpenFolder(dgv); mnuBrowseAt.Click += (sender, e) => ClickOpenFolder(dgv);
ContextMenuStrip mnu = new ContextMenuStrip(); ContextMenuStrip mnu = new();
mnu.Items.Add(mnuOpen); mnu.Items.Add(mnuOpen);
mnu.Items.Add(mnuBrowseAt); mnu.Items.Add(mnuBrowseAt);
return mnu; return mnu;

View file

@ -78,8 +78,8 @@ namespace PKHeX.WinForms
private readonly PictureBox[] PKXBOXES; private readonly PictureBox[] PKXBOXES;
private readonly string DatabasePath = Main.MGDatabasePath; private readonly string DatabasePath = Main.MGDatabasePath;
private List<MysteryGift> Results = new List<MysteryGift>(); private List<MysteryGift> Results = new();
private List<MysteryGift> RawDB = new List<MysteryGift>(); private List<MysteryGift> RawDB = new();
private int slotSelected = -1; // = null; private int slotSelected = -1; // = null;
private Image? slotColor; private Image? slotColor;
private const int RES_MAX = 66; private const int RES_MAX = 66;

View file

@ -33,7 +33,7 @@ namespace PKHeX.WinForms
dgvApricorn.ReadOnly = true; dgvApricorn.ReadOnly = true;
dgvApricorn.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dgvApricorn.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
} }
DataGridViewComboBoxColumn dgvCount = new DataGridViewComboBoxColumn DataGridViewComboBoxColumn dgvCount = new()
{ {
DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing, DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing,
DisplayIndex = 0, DisplayIndex = 0,

View file

@ -18,8 +18,8 @@ namespace PKHeX.WinForms
Table = SAV switch Table = SAV switch
{ {
SAV4DP _ => HoneyTree.TableDP, SAV4DP => HoneyTree.TableDP,
SAV4Pt _ => HoneyTree.TablePt, SAV4Pt => HoneyTree.TablePt,
_ => throw new Exception() _ => throw new Exception()
}; };

View file

@ -116,12 +116,12 @@ namespace PKHeX.WinForms
IReadOnlyList<ComboItem> metLocationList; IReadOnlyList<ComboItem> metLocationList;
switch (SAV) switch (SAV)
{ {
case SAV4Sinnoh _: case SAV4Sinnoh:
metLocationList = GameInfo.GetLocationList(GameVersion.Pt, 4, false); metLocationList = GameInfo.GetLocationList(GameVersion.Pt, 4, false);
FlyDestD = new[] { 1, 2, 6, 8, 3, 9, 10, 4, 12, 11, 5, 7, 14, 13, 54, 15, 81, 82, 83, 55, }; FlyDestD = new[] { 1, 2, 6, 8, 3, 9, 10, 4, 12, 11, 5, 7, 14, 13, 54, 15, 81, 82, 83, 55, };
FlyDestC = new[] { 0, 1, 7, 9, 2, 10, 11, 3, 13, 12, 4, 8, 15, 14, 16, 68, 17, 5, 6, 67, }; FlyDestC = new[] { 0, 1, 7, 9, 2, 10, 11, 3, 13, 12, 4, 8, 15, 14, 16, 68, 17, 5, 6, 67, };
break; break;
case SAV4HGSS _: case SAV4HGSS:
metLocationList = GameInfo.GetLocationList(GameVersion.HG, 4, false); metLocationList = GameInfo.GetLocationList(GameVersion.HG, 4, false);
FlyDestD = new[] { 126, 127, 128, 129, 131, 133, 132, 130, 134, 135, 136, 227, 229, 137, 221, 147, 138, 139, 140, 141, 143, 142, 144, 148, 145, 146, 225, }; FlyDestD = new[] { 126, 127, 128, 129, 131, 133, 132, 130, 134, 135, 136, 227, 229, 137, 221, 147, 138, 139, 140, 141, 143, 142, 144, 148, 145, 146, 225, };
FlyDestC = new[] { 11, 12, 13, 14, 16, 18, 17, 15, 19, 20, 21, 30, 27, 22, 33, 9, 0, 1, 2, 3, 5, 4, 6, 10, 7, 8, 35, }; FlyDestC = new[] { 11, 12, 13, 14, 16, 18, 17, 15, 19, 20, 21, 30, 27, 22, 33, 9, 0, 1, 2, 3, 5, 4, 6, 10, 7, 8, 35, };
@ -268,7 +268,7 @@ namespace PKHeX.WinForms
} }
} }
Bitmap dabmp = new Bitmap(96, 80); Bitmap dabmp = new(96, 80);
BitmapData dabdata = dabmp.LockBits(new Rectangle(0, 0, dabmp.Width, dabmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb); BitmapData dabdata = dabmp.LockBits(new Rectangle(0, 0, dabmp.Width, dabmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
System.Runtime.InteropServices.Marshal.Copy(dupbyte, 0, dabdata.Scan0, dupbyte.Length); System.Runtime.InteropServices.Marshal.Copy(dupbyte, 0, dabdata.Scan0, dupbyte.Length);
dabmp.UnlockBits(dabdata); dabmp.UnlockBits(dabdata);

View file

@ -178,7 +178,7 @@ namespace PKHeX.WinForms
private static List<ComboItem> GetStates() private static List<ComboItem> GetStates()
{ {
return new List<ComboItem> return new()
{ {
new ComboItem("Not roamed", 0), new ComboItem("Not roamed", 0),
new ComboItem("Roaming", 1), new ComboItem("Roaming", 1),

View file

@ -38,7 +38,7 @@ namespace PKHeX.WinForms
dgvIndex.ReadOnly = true; dgvIndex.ReadOnly = true;
dgvIndex.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dgvIndex.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
} }
DataGridViewComboBoxColumn dgvPuff = new DataGridViewComboBoxColumn DataGridViewComboBoxColumn dgvPuff = new()
{ {
DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing
}; };

View file

@ -65,7 +65,7 @@ namespace PKHeX.WinForms
dgvIndex.ReadOnly = true; dgvIndex.ReadOnly = true;
dgvIndex.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dgvIndex.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
} }
DataGridViewComboBoxColumn dgvBag = new DataGridViewComboBoxColumn DataGridViewComboBoxColumn dgvBag = new()
{ {
DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing
}; };

View file

@ -46,7 +46,7 @@ namespace PKHeX.WinForms
private bool MapUpdated; private bool MapUpdated;
private static readonly string[] AllStyles = Enum.GetNames(typeof(PlayerBattleStyle7)); private static readonly string[] AllStyles = Enum.GetNames(typeof(PlayerBattleStyle7));
private readonly List<string> BattleStyles = new List<string>(AllStyles); private readonly List<string> BattleStyles = new(AllStyles);
private int[] FlyDestFlagOfs = null!, MapUnmaskFlagOfs = null!; private int[] FlyDestFlagOfs = null!, MapUnmaskFlagOfs = null!;
private int SkipFlag => SAV is SAV7USUM ? 4160 : 3200; // FlagMax - 768 private int SkipFlag => SAV is SAV7USUM ? 4160 : 3200; // FlagMax - 768

View file

@ -136,8 +136,8 @@ namespace PKHeX.WinForms
} }
// Get list // Get list
List<int> num = new List<int>(); List<int> num = new();
List<string> desc = new List<string>(); List<string> desc = new();
foreach (string[] split in list.Select(s => s.Split('\t')).Where(split => split.Length == 2)) foreach (string[] split in list.Select(s => s.Split('\t')).Where(split => split.Length == 2))
{ {
@ -206,9 +206,9 @@ namespace PKHeX.WinForms
} }
// Get list // Get list
List<int> num = new List<int>(); List<int> num = new();
List<string> desc = new List<string>(); List<string> desc = new();
List<string> enums = new List<string>(); List<string> enums = new();
foreach (string[] split in list.Select(s => s.Split('\t')).Where(split => split.Length == 2 || split.Length == 3)) foreach (string[] split in list.Select(s => s.Split('\t')).Where(split => split.Length == 2 || split.Length == 3))
{ {

View file

@ -14,7 +14,7 @@ namespace PKHeX.WinForms
private readonly SaveFile SAV; private readonly SaveFile SAV;
private readonly IPKMView View; private readonly IPKMView View;
private readonly IReadOnlyList<SlotGroup> Groups; private readonly IReadOnlyList<SlotGroup> Groups;
private readonly SummaryPreviewer Preview = new SummaryPreviewer(); private readonly SummaryPreviewer Preview = new();
public int CurrentGroup { get; set; } = -1; public int CurrentGroup { get; set; } = -1;

View file

@ -44,7 +44,7 @@ namespace PKHeX.WinForms
private int ColumnFreeSpace; private int ColumnFreeSpace;
private int ColumnNEW; private int ColumnNEW;
private readonly Dictionary<InventoryType, DataGridView> ControlGrids = new Dictionary<InventoryType, DataGridView>(); private readonly Dictionary<InventoryType, DataGridView> ControlGrids = new();
private DataGridView GetGrid(InventoryType type) => ControlGrids[type]; private DataGridView GetGrid(InventoryType type) => ControlGrids[type];
private DataGridView GetGrid(int pouch) => ControlGrids[Pouches[pouch].Type]; private DataGridView GetGrid(int pouch) => ControlGrids[Pouches[pouch].Type];
@ -100,7 +100,7 @@ namespace PKHeX.WinForms
private static DataGridView GetBaseDataGrid(InventoryPouch pouch) private static DataGridView GetBaseDataGrid(InventoryPouch pouch)
{ {
return new DataGridView return new()
{ {
Dock = DockStyle.Fill, Dock = DockStyle.Fill,
Text = pouch.Type.ToString(), Text = pouch.Type.ToString(),
@ -124,7 +124,7 @@ namespace PKHeX.WinForms
private static DataGridViewComboBoxColumn GetItemColumn(int c, string name = "Item") private static DataGridViewComboBoxColumn GetItemColumn(int c, string name = "Item")
{ {
return new DataGridViewComboBoxColumn return new()
{ {
HeaderText = name, HeaderText = name,
DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing, DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing,

View file

@ -520,7 +520,7 @@ namespace PKHeX.WinForms
// UI Generation // UI Generation
private List<PictureBox> PopulateViewGiftsG4() private List<PictureBox> PopulateViewGiftsG4()
{ {
List<PictureBox> pb = new List<PictureBox>(); List<PictureBox> pb = new();
// Row 1 // Row 1
var f1 = GetFlowLayoutPanel(); var f1 = GetFlowLayoutPanel();
@ -585,7 +585,7 @@ namespace PKHeX.WinForms
private static FlowLayoutPanel GetFlowLayoutPanel() private static FlowLayoutPanel GetFlowLayoutPanel()
{ {
return new FlowLayoutPanel return new()
{ {
Width = 305, Width = 305,
Height = 34, Height = 34,
@ -596,7 +596,7 @@ namespace PKHeX.WinForms
private static Label GetLabel(string text) private static Label GetLabel(string text)
{ {
return new Label return new()
{ {
Size = new Size(40, 34), Size = new Size(40, 34),
AutoSize = false, AutoSize = false,
@ -609,7 +609,7 @@ namespace PKHeX.WinForms
private static PictureBox GetPictureBox() private static PictureBox GetPictureBox()
{ {
return new PictureBox return new()
{ {
Size = new Size(42, 32), Size = new Size(42, 32),
SizeMode = PictureBoxSizeMode.CenterImage, SizeMode = PictureBoxSizeMode.CenterImage,

View file

@ -77,7 +77,7 @@ namespace PKHeX.WinForms
ReflectUtil.SetValue(SettingsObject, s.Name, GetValue(s)); ReflectUtil.SetValue(SettingsObject, s.Name, GetValue(s));
} }
private static CheckBox GetCheckBox(string name, bool state) => new CheckBox private static CheckBox GetCheckBox(string name, bool state) => new()
{ {
Name = name, Checked = state, Text = name, Name = name, Checked = state, Text = name,
AutoSize = true, AutoSize = true,

View file

@ -10,8 +10,8 @@ namespace PKHeX.WinForms
{ {
public static class FontUtil public static class FontUtil
{ {
private static readonly PrivateFontCollection CustomFonts = new PrivateFontCollection(); private static readonly PrivateFontCollection CustomFonts = new();
private static readonly Dictionary<float, Font> GeneratedFonts = new Dictionary<float, Font>(); private static readonly Dictionary<float, Font> GeneratedFonts = new();
static FontUtil() static FontUtil()
{ {
@ -22,7 +22,8 @@ namespace PKHeX.WinForms
File.WriteAllBytes(g6path, Resources.pgldings_normalregular); File.WriteAllBytes(g6path, Resources.pgldings_normalregular);
CustomFonts.AddFontFile(g6path); CustomFonts.AddFontFile(g6path);
} }
catch (FileNotFoundException ex){ catch (FileNotFoundException ex)
{
Debug.WriteLine($"Unable to read font file: {ex.Message}"); Debug.WriteLine($"Unable to read font file: {ex.Message}");
} }
#pragma warning disable CA1031 // Do not catch general exception types #pragma warning disable CA1031 // Do not catch general exception types

View file

@ -10,7 +10,7 @@ namespace PKHeX.WinForms
{ {
public static class WinFormsTranslator public static class WinFormsTranslator
{ {
private static readonly Dictionary<string, TranslationContext> Context = new Dictionary<string, TranslationContext>(); private static readonly Dictionary<string, TranslationContext> Context = new();
internal static void TranslateInterface(this Control form, string lang) => TranslateForm(form, GetContext(lang)); internal static void TranslateInterface(this Control form, string lang) => TranslateForm(form, GetContext(lang));
private static string GetTranslationFileNameInternal(string lang) => $"lang_{lang}"; private static string GetTranslationFileNameInternal(string lang) => $"lang_{lang}";
@ -216,7 +216,7 @@ namespace PKHeX.WinForms
public bool AddNew { private get; set; } public bool AddNew { private get; set; }
public bool RemoveUsedKeys { private get; set; } public bool RemoveUsedKeys { private get; set; }
public const char Separator = '='; public const char Separator = '=';
private readonly Dictionary<string, string> Translation = new Dictionary<string, string>(); private readonly Dictionary<string, string> Translation = new();
public TranslationContext(IEnumerable<string> content, char separator = Separator) public TranslationContext(IEnumerable<string> content, char separator = Separator)
{ {

View file

@ -233,7 +233,7 @@ namespace PKHeX.WinForms
CustomSaveExtensions.AddRange(newExtensions); CustomSaveExtensions.AddRange(newExtensions);
} }
private static readonly List<string> CustomSaveExtensions = new List<string> private static readonly List<string> CustomSaveExtensions = new()
{ {
// THESE ARE SAVE FILE EXTENSION TYPES. SAVE STATE (RAM SNAPSHOT) EXTENSIONS DO NOT GO HERE. // THESE ARE SAVE FILE EXTENSION TYPES. SAVE STATE (RAM SNAPSHOT) EXTENSIONS DO NOT GO HERE.
"sav", // standard "sav", // standard
@ -385,9 +385,9 @@ namespace PKHeX.WinForms
{ {
switch (x) switch (x)
{ {
case UnauthorizedAccessException _: case UnauthorizedAccessException:
case FileNotFoundException _: case FileNotFoundException:
case IOException _: case IOException:
Error(MsgFileWriteFail + Environment.NewLine + x.Message, MsgFileWriteProtectedAdvice); Error(MsgFileWriteFail + Environment.NewLine + x.Message, MsgFileWriteProtectedAdvice);
break; break;
default: default:

View file

@ -107,6 +107,10 @@ namespace PKHeX.Tests.PKM
Met_Year = 12 Met_Year = 12
}; };
pk.Met_Day.Should().Be(12);
pk.Met_Month.Should().Be(12);
pk.Met_Year.Should().Be(12);
pk.MetDate = null; pk.MetDate = null;
pk.Met_Day.Should().Be(0); pk.Met_Day.Should().Be(0);
@ -124,6 +128,10 @@ namespace PKHeX.Tests.PKM
Met_Year = 12 Met_Year = 12
}; };
pk.Met_Day.Should().Be(12);
pk.Met_Month.Should().Be(12);
pk.Met_Year.Should().Be(12);
pk.MetDate = new DateTime(2005, 5, 5); pk.MetDate = new DateTime(2005, 5, 5);
pk.Met_Day.Should().Be(5); pk.Met_Day.Should().Be(5);
@ -183,6 +191,10 @@ namespace PKHeX.Tests.PKM
Egg_Year = 12 Egg_Year = 12
}; };
pk.Egg_Day.Should().Be(12);
pk.Egg_Month.Should().Be(12);
pk.Egg_Year.Should().Be(12);
pk.EggMetDate = null; pk.EggMetDate = null;
pk.Egg_Day.Should().Be(0); pk.Egg_Day.Should().Be(0);
@ -200,6 +212,10 @@ namespace PKHeX.Tests.PKM
Egg_Year = 12 Egg_Year = 12
}; };
pk.Egg_Day.Should().Be(12);
pk.Egg_Month.Should().Be(12);
pk.Egg_Year.Should().Be(12);
pk.EggMetDate = new DateTime(2005, 5, 5); pk.EggMetDate = new DateTime(2005, 5, 5);
pk.Egg_Day.Should().Be(5); pk.Egg_Day.Should().Be(5);

View file

@ -57,7 +57,7 @@ namespace PKHeX.Tests.Simulator
}; };
for (var nature = Nature.Hardy; nature <= Nature.Quirky; nature++) for (var nature = Nature.Hardy; nature <= Nature.Quirky; nature++)
{ {
criteria.Nature = nature; criteria = criteria with {Nature = nature};
var pkm = ez.ConvertToPKM(tr, criteria); var pkm = ez.ConvertToPKM(tr, criteria);
pkm.Nature.Should().Be((int)nature, "not nature locked"); pkm.Nature.Should().Be((int)nature, "not nature locked");
pkm.IsShiny.Should().BeTrue("encounter is shiny locked"); pkm.IsShiny.Should().BeTrue("encounter is shiny locked");