From a4565d71f65c19a2df1aa1c4681ff00162c41e5c Mon Sep 17 00:00:00 2001 From: Kurt Date: Tue, 9 May 2017 21:11:13 -0700 Subject: [PATCH] Handle gen4 egg nickname edge case Egg is not saved as "EGG", it is "Egg". Nice job gf. Instead of ignoring the nickname flag, detect if it should be used or not. Gen4 never uses it. Gen7 doesn't use it when it's a gift, but uses it for daycare eggs (...). Closes #1100 --- PKHeX/Legality/Checks.cs | 20 ++++++++++++++++--- PKHeX/Legality/LegalityCheckStrings.cs | 3 ++- PKHeX/PKM/PKX.cs | 2 +- .../text/en/LegalityCheckStrings_en.txt | 3 ++- .../text/ko/LegalityCheckStrings_ko.txt | 1 + .../text/zh/LegalityCheckStrings_zh.txt | 1 + 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/PKHeX/Legality/Checks.cs b/PKHeX/Legality/Checks.cs index 89e1ac174..6324c045a 100644 --- a/PKHeX/Legality/Checks.cs +++ b/PKHeX/Legality/Checks.cs @@ -312,9 +312,23 @@ private void verifyNickname() } private void verifyNicknameEgg() { - if (!pkm.IsNicknamed && (pkm.Format != 7)) - AddLine(Severity.Invalid, V12, CheckIdentifier.Egg); - else if (PKX.getSpeciesNameGeneration(0, pkm.Language, pkm.GenNumber) != pkm.Nickname) + switch (pkm.Format) + { + case 4: + if (pkm.IsNicknamed) // gen4 doesn't use the nickname flag for eggs + AddLine(Severity.Invalid, V224, CheckIdentifier.Egg); + break; + case 7: + if (EncounterMatch is EncounterStatic ^ !pkm.IsNicknamed) // gen7 doesn't use for ingame gifts + AddLine(Severity.Invalid, pkm.IsNicknamed ? V224 : V12, CheckIdentifier.Egg); + break; + default: + if (!pkm.IsNicknamed) + AddLine(Severity.Invalid, V12, CheckIdentifier.Egg); + break; + } + + if (PKX.getSpeciesNameGeneration(0, pkm.Language, pkm.GenNumber) != pkm.Nickname) AddLine(Severity.Invalid, V13, CheckIdentifier.Egg); else AddLine(Severity.Valid, V14, CheckIdentifier.Egg); diff --git a/PKHeX/Legality/LegalityCheckStrings.cs b/PKHeX/Legality/LegalityCheckStrings.cs index 1e3dbe49f..52fa64f68 100644 --- a/PKHeX/Legality/LegalityCheckStrings.cs +++ b/PKHeX/Legality/LegalityCheckStrings.cs @@ -114,7 +114,8 @@ public static class LegalityCheckStrings public static string V3 {get; set;} = "Species index invalid for Nickname comparison."; // Invalid public static string V20 {get; set;} = "Nickname does not match species name."; // Invalid public static string V13 {get; set;} = "Egg name does not match language Egg name."; // Invalid - public static string V12 {get; set;} = "Eggs must be nicknamed."; // Invalid + public static string V12 {get; set;} = "Egg must be nicknamed."; // Invalid + public static string V224 {get; set;} = "Egg must be not nicknamed."; // Invalid public static string V7 {get; set;} = "Ingame Trade invalid version?"; // Invalid public static string V8 {get; set;} = "Ingame Trade invalid index?"; // Invalid public static string V10 {get; set;} = "Ingame Trade OT has been altered."; // Invalid diff --git a/PKHeX/PKM/PKX.cs b/PKHeX/PKM/PKX.cs index 20402fdda..1fd3063d6 100644 --- a/PKHeX/PKM/PKX.cs +++ b/PKHeX/PKM/PKX.cs @@ -211,7 +211,7 @@ public static string getSpeciesNameGeneration(int species, int lang, int generat { string nick = getSpeciesName(species, lang); - if (generation < 5) // All caps GenIV and previous + if (generation < 5 && (generation != 4 || species != 0)) // All caps GenIV and previous, except GenIV eggs. nick = nick.ToUpper(); if (generation < 3) nick = nick.Replace(" ", ""); diff --git a/PKHeX/Resources/text/en/LegalityCheckStrings_en.txt b/PKHeX/Resources/text/en/LegalityCheckStrings_en.txt index 5f57a86ac..ea0faf8af 100644 --- a/PKHeX/Resources/text/en/LegalityCheckStrings_en.txt +++ b/PKHeX/Resources/text/en/LegalityCheckStrings_en.txt @@ -75,7 +75,8 @@ V222 = Cannot be given this Nickname. V3 = Species index invalid for Nickname comparison. V20 = Nickname does not match species name. V13 = Egg name does not match language Egg name. -V12 = Eggs must be nicknamed. +V12 = Egg must be nicknamed. +V224 = Egg must be not nicknamed. V7 = Ingame Trade invalid version? V8 = Ingame Trade invalid index? V10 = Ingame Trade OT has been altered. diff --git a/PKHeX/Resources/text/ko/LegalityCheckStrings_ko.txt b/PKHeX/Resources/text/ko/LegalityCheckStrings_ko.txt index 92f65f636..51c767771 100644 --- a/PKHeX/Resources/text/ko/LegalityCheckStrings_ko.txt +++ b/PKHeX/Resources/text/ko/LegalityCheckStrings_ko.txt @@ -77,6 +77,7 @@ V3 = 이름 비교에 사용할 포켓몬 종류 인덱스가 잘못되었습니 V20 = 이름이 포켓몬 종류와 일치하지 않습니다. V13 = 알 이름이 언어별 알 이름과 일치하지 않습니다. V12 = 알은 반드시 이름 플래그가 켜져 있어야 합니다. +V224 = Egg must be not nicknamed. V7 = 게임 내 교환의 버전이 잘못되었을 수 있습니다. V8 = 게임 내 교환의 인덱스가 잘못되었을 수 있습니다. V10 = 게임 내 교환의 어버이가 달라졌습니다. diff --git a/PKHeX/Resources/text/zh/LegalityCheckStrings_zh.txt b/PKHeX/Resources/text/zh/LegalityCheckStrings_zh.txt index 51f88f03b..6ed2c6566 100644 --- a/PKHeX/Resources/text/zh/LegalityCheckStrings_zh.txt +++ b/PKHeX/Resources/text/zh/LegalityCheckStrings_zh.txt @@ -77,6 +77,7 @@ V3 = 宝可梦种类无法用于昵称对比 V20 = 昵称与种类名不一致。 V13 = 蛋名称与语言不一致。 V12 = 蛋必须有昵称。 +V224 = Egg must be not nicknamed. V7 = 游戏内连接交换版本不合法? V8 = 游戏内连接交换序号不合法? V10 = 游戏内连接交换的初训家被修改。