Prevent nickname change for fateful encounter trades

Handle empty nickname trades for gen6+ assuming there's a nickname
This commit is contained in:
Kurt 2020-10-30 20:31:12 -07:00
parent d7042fb19e
commit 975c4f8a4a

View file

@ -349,7 +349,7 @@ namespace PKHeX.Core
private static CheckResult CheckTradeOTOnly(LegalityAnalysis data, IReadOnlyList<string> validOT) private static CheckResult CheckTradeOTOnly(LegalityAnalysis data, IReadOnlyList<string> validOT)
{ {
var pkm = data.pkm; var pkm = data.pkm;
if (pkm.IsNicknamed && pkm.Format < 8) if (pkm.IsNicknamed && (pkm.Format < 8 || pkm.FatefulEncounter))
return GetInvalid(LEncTradeChangedNickname, CheckIdentifier.Nickname); return GetInvalid(LEncTradeChangedNickname, CheckIdentifier.Nickname);
int lang = pkm.Language; int lang = pkm.Language;
if (validOT.Count <= lang) if (validOT.Count <= lang)
@ -363,7 +363,10 @@ namespace PKHeX.Core
{ {
var ot = t.GetOT(language); var ot = t.GetOT(language);
var nick = t.GetNickname(language); var nick = t.GetNickname(language);
VerifyTradeOTNick(data, t, nick, ot); if (string.IsNullOrEmpty(nick))
VerifyTradeOTOnly(data, t);
else
VerifyTradeOTNick(data, t, nick, ot);
} }
private static void VerifyTradeOTNick(LegalityAnalysis data, EncounterTrade t, string nick, string OT) private static void VerifyTradeOTNick(LegalityAnalysis data, EncounterTrade t, string nick, string OT)