Add nickname reset modify

nickname reset clears except for encountertrades (some have fixed
nicknames).

remove untraded check for HT memory verification, has to be traded if it
has a HT memory.
This commit is contained in:
Kurt 2018-05-31 19:49:47 -07:00
parent e82dcdb124
commit f237476ccc
5 changed files with 21 additions and 3 deletions

View File

@ -647,5 +647,20 @@ public static void SetRandomMemory6(this PKM pk)
pk.OT_Intensity = 6;
pk.OT_Feeling = Memories.GetRandomFeeling(pk.OT_Memory);
}
/// <summary>
/// Sets the <see cref="PKM.Nickname"/> to its default value.
/// </summary>
/// <param name="pk">Pokémon to modify.</param>
/// <param name="la">Precomputed optional</param>
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();
}
}
}

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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 =
{

View File

@ -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);
}