diff --git a/PKHeX.Core/Editing/CommonEdits.cs b/PKHeX.Core/Editing/CommonEdits.cs index 1d0d9f096..6b6602070 100644 --- a/PKHeX.Core/Editing/CommonEdits.cs +++ b/PKHeX.Core/Editing/CommonEdits.cs @@ -647,5 +647,20 @@ public static void SetRandomMemory6(this PKM pk) pk.OT_Intensity = 6; pk.OT_Feeling = Memories.GetRandomFeeling(pk.OT_Memory); } + + /// + /// Sets the to its default value. + /// + /// Pokémon to modify. + /// Precomputed optional + public static void SetDefaultNickname(this PKM pk, LegalityAnalysis la = null) + { + if (la == null) + la = new LegalityAnalysis(pk); + if (la.Parsed && la.EncounterOriginal is EncounterTrade t && t.HasNickname) + pk.SetNickname(t.GetNickname(pk.Language)); + else + pk.SetNickname(); + } } } diff --git a/PKHeX.Core/Legality/Analysis.cs b/PKHeX.Core/Legality/Analysis.cs index 9c8951eeb..7c85cb143 100644 --- a/PKHeX.Core/Legality/Analysis.cs +++ b/PKHeX.Core/Legality/Analysis.cs @@ -18,6 +18,7 @@ public partial class LegalityAnalysis private IEncounterable EncounterOriginalGB; private IEncounterable EncounterMatch => Info.EncounterMatch; + public IEncounterable EncounterOriginal => EncounterOriginalGB ?? EncounterMatch; private CheckResult Encounter, History; @@ -56,7 +57,7 @@ private string EncounterName { get { - var enc = EncounterOriginalGB ?? EncounterMatch; + var enc = EncounterOriginal; return $"{enc.GetEncounterTypeName()} ({SpeciesStrings[enc.Species]})"; } } @@ -64,7 +65,7 @@ private string EncounterLocation { get { - var enc = (EncounterOriginalGB ?? EncounterMatch) as ILocation; + var enc = EncounterOriginal as ILocation; return enc?.GetEncounterLocation(Info.Generation, pkm.Version); } } diff --git a/PKHeX.Core/Legality/Checks.cs b/PKHeX.Core/Legality/Checks.cs index a20f175e3..d1eb7daf2 100644 --- a/PKHeX.Core/Legality/Checks.cs +++ b/PKHeX.Core/Legality/Checks.cs @@ -1991,7 +1991,7 @@ private void VerifyHTMemory() AddLine(Severity.Invalid, string.Format(V160, V206), CheckIdentifier.Memory); return; case 14: - if (Legal.GetCanBeCaptured(pkm.HT_TextVar, 6, pkm.IsUntraded ? (GameVersion)pkm.Version : GameVersion.Any)) + if (Legal.GetCanBeCaptured(pkm.HT_TextVar, 6)) AddLine(Severity.Valid, string.Format(V164, V206), CheckIdentifier.Memory); else AddLine(Severity.Invalid, string.Format(V165, V206), CheckIdentifier.Memory); diff --git a/PKHeX.Core/Legality/Encounters/EncounterTrade.cs b/PKHeX.Core/Legality/Encounters/EncounterTrade.cs index d5d45696f..5afd10e6f 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterTrade.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterTrade.cs @@ -51,6 +51,7 @@ public class EncounterTrade : IEncounterable, IMoveset, IGeneration, ILocation, public string[] TrainerNames { get; internal set; } public string GetNickname(int language) => Nicknames?.Length > language ? Nicknames[language] : null; public string GetOT(int language) => TrainerNames?.Length > language ? TrainerNames[language] : null; + public bool HasNickname => Nicknames != null; public static readonly int[] DefaultMetLocation = { diff --git a/PKHeX.WinForms/Controls/SAV Editor/BoxMenuStrip.cs b/PKHeX.WinForms/Controls/SAV Editor/BoxMenuStrip.cs index b9d86216b..f5658f0c3 100644 --- a/PKHeX.WinForms/Controls/SAV Editor/BoxMenuStrip.cs +++ b/PKHeX.WinForms/Controls/SAV Editor/BoxMenuStrip.cs @@ -53,6 +53,7 @@ public BoxMenuStrip(SAVEditor SAV) AddItem(Level.Modify, GetItem("ResetMoves", "Reset Moves", () => Modify(z => z.SetMoves(z.GetMoveSet())), Resources.date)); AddItem(Level.Modify, GetItem("RandomMoves", "Randomize Moves", () => Modify(z => z.SetMoves(z.GetMoveSet(true))), Resources.wand)); AddItem(Level.Modify, GetItem("HyperTrain", "Hyper Train", () => Modify(z => z.SetSuggestedHyperTrainingData()), Resources.vallohi), s => s.Generation >= 7); + AddItem(Level.Modify, GetItem("RemoveNicknames", "Remove Nicknames", () => Modify(z => z.SetDefaultNickname()), Resources.alphaAZ)); AddItem(Level.Modify, GetItem("RemoveItem", "Delete Held Item", () => Modify(z => z.HeldItem = 0), Resources.gift), s => s.Generation >= 2); }