From a368b81519bff7ddbb9fa4bbaf841adde02d34db Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 18 Nov 2019 22:48:03 -0800 Subject: [PATCH] Minor clean --- .../Legality/Encounters/Data/Encounters8.cs | 3 +-- PKHeX.Core/Legality/Tables/Tables.cs | 2 +- PKHeX.Core/Legality/Verifiers/BallVerifier.cs | 2 +- PKHeX.Core/Legality/Verifiers/FormVerifier.cs | 26 ++++++++++++------- PKHeX.Core/MysteryGifts/WB7.cs | 2 +- PKHeX.Core/MysteryGifts/WC3.cs | 2 +- PKHeX.Core/MysteryGifts/WC8.cs | 4 +-- 7 files changed, 24 insertions(+), 17 deletions(-) diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters8.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters8.cs index 0d9236675..57f68fb77 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Encounters8.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Encounters8.cs @@ -58,13 +58,12 @@ static Encounters8() new EncounterStatic { Species = 889, Level = 70, Location = 66, Moves = new[] {163,242,442,334}, Shiny = Never, Ability = 1, FlawlessIVCount = 3, Version = SH }, // Zamazenta new EncounterStatic { Species = 890, Level = 60, Location = 66, Moves = new[] {440,406,053,744}, Shiny = Never, Ability = 1, FlawlessIVCount = 3 }, // Eternatus-1 (reverts to form 0) - // Motostoke Stadium Static Encounters new EncounterStatic { Species = 037, Level = 24, Location = 24, Version = SW }, // Vulpix at Motostoke Stadium new EncounterStatic { Species = 058, Level = 24, Location = 24, Version = SH }, // Growlithe at Motostoke Stadium new EncounterStatic { Species = 607, Level = 25, Location = 24, }, // Litwick at Motostoke Stadium new EncounterStatic { Species = 850, Level = 25, Location = 24, FlawlessIVCount = 3 }, // Sizzlipede at Motostoke Stadium - + new EncounterStatic { Species = 618, Level = 25, Location = 054, Moves = new[] {389,319,279,341}, Form = 01, Ability = 1 }, // Stunfisk in Galar Mine No. 2 new EncounterStatic8 { Species = 618, Level = 48, Location = -1, Moves = new[] {779,330,340,334}, Form = 01 }, // Stunfisk new EncounterStatic8 { Species = 527, Level = 16, Location = -1, Moves = new[] {000,000,000,000} }, // Woobat diff --git a/PKHeX.Core/Legality/Tables/Tables.cs b/PKHeX.Core/Legality/Tables/Tables.cs index 7957aea03..bad6f44b7 100644 --- a/PKHeX.Core/Legality/Tables/Tables.cs +++ b/PKHeX.Core/Legality/Tables/Tables.cs @@ -168,7 +168,7 @@ public static partial class Legal 808, // Meltan 809, // Melmetal - + (int)Species.Dracozolt, (int)Species.Arctozolt, (int)Species.Dracovish, diff --git a/PKHeX.Core/Legality/Verifiers/BallVerifier.cs b/PKHeX.Core/Legality/Verifiers/BallVerifier.cs index 0540be575..cc97d3b9d 100644 --- a/PKHeX.Core/Legality/Verifiers/BallVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/BallVerifier.cs @@ -335,7 +335,7 @@ private CheckResult VerifyBallEggGen8(LegalityAnalysis data) return NONE; } - public bool IsGalarCapture(int species) + public static bool IsGalarCapture(int species) { if (810 <= species && species <= 818) // starter return false; diff --git a/PKHeX.Core/Legality/Verifiers/FormVerifier.cs b/PKHeX.Core/Legality/Verifiers/FormVerifier.cs index 61c50e54c..9d3a923eb 100644 --- a/PKHeX.Core/Legality/Verifiers/FormVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/FormVerifier.cs @@ -176,8 +176,14 @@ bool IsValidPikachuCap() if (pkm.AltForm != 0 && BattleOnly.Contains(pkm.Species)) { - if (pkm.Species == (int)Species.Darmanitan && pkm.AltForm == 2) { } // this one is OK, Galarian non-Zen - else return GetInvalid(LFormBattle); + if (pkm.Species == (int) Species.Darmanitan && pkm.AltForm == 2 && pkm.Format >= 8) + { + // this one is OK, Galarian non-Zen + } + else + { + return GetInvalid(LFormBattle); + } } return VALID; @@ -210,17 +216,19 @@ private static int GetGenesectFormFromHeldItem(int item) return 0; } - private static readonly HashSet BattleOnly; - private static readonly HashSet SafariFloette = new HashSet { 0, 1, 3 }; // 0/1/3 - RBY + private static readonly HashSet BattleOnly = GetBattleFormSet(); - static FormVerifier() + private static HashSet GetBattleFormSet() { - BattleOnly = new HashSet(); - BattleOnly.UnionWith(Legal.BattleForms); - BattleOnly.UnionWith(Legal.BattleMegas); - BattleOnly.UnionWith(Legal.BattlePrimals); + var hs = new HashSet(); + hs.UnionWith(Legal.BattleForms); + hs.UnionWith(Legal.BattleMegas); + hs.UnionWith(Legal.BattlePrimals); + return hs; } + private static readonly HashSet SafariFloette = new HashSet { 0, 1, 3 }; // 0/1/3 - RBY + private void VerifyFormFriendSafari(LegalityAnalysis data) { var pkm = data.pkm; diff --git a/PKHeX.Core/MysteryGifts/WB7.cs b/PKHeX.Core/MysteryGifts/WB7.cs index 92487f9d8..d689acb20 100644 --- a/PKHeX.Core/MysteryGifts/WB7.cs +++ b/PKHeX.Core/MysteryGifts/WB7.cs @@ -255,7 +255,7 @@ public override int[] IVs public bool GetIsNicknamed(int language) => Data[GetNicknameOffset(language)] != 0; - private int GetLanguageIndex(int language) + private static int GetLanguageIndex(int language) { var lang = (LanguageID) language; if (lang < LanguageID.Japanese || lang == LanguageID.UNUSED_6) diff --git a/PKHeX.Core/MysteryGifts/WC3.cs b/PKHeX.Core/MysteryGifts/WC3.cs index e1579829d..3b9c49411 100644 --- a/PKHeX.Core/MysteryGifts/WC3.cs +++ b/PKHeX.Core/MysteryGifts/WC3.cs @@ -77,7 +77,7 @@ public override PKM ConvertToPKM(ITrainerInfo SAV, EncounterCriteria criteria) Met_Level = Met_Level, Met_Location = Location, Ball = 4, - + // Ribbons RibbonCountry = RibbonCountry, RibbonNational = RibbonNational, diff --git a/PKHeX.Core/MysteryGifts/WC8.cs b/PKHeX.Core/MysteryGifts/WC8.cs index 4641cf2dc..3f19dcea6 100644 --- a/PKHeX.Core/MysteryGifts/WC8.cs +++ b/PKHeX.Core/MysteryGifts/WC8.cs @@ -286,13 +286,13 @@ public override int[] RelearnMoves public string GetOT(int language) => Util.TrimFromZero(Encoding.Unicode.GetString(Data, GetOTOffset(language), 0x1A)); public void SetOT(int language, string value) => Encoding.Unicode.GetBytes(value.PadRight(0x1A / 2, '\0')).CopyTo(Data, GetOTOffset(language)); - private int GetNicknameOffset(int language) + private static int GetNicknameOffset(int language) { int index = GetLanguageIndex(language); return 0x30 + (index * 0x1C); } - private int GetOTOffset(int language) + private static int GetOTOffset(int language) { int index = GetLanguageIndex(language); return 0x12C + (index * 0x1C);