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
This commit is contained in:
Kurt 2017-05-09 21:11:13 -07:00
parent 9eae35ba34
commit a4565d71f6
6 changed files with 24 additions and 6 deletions

View File

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

View File

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

View File

@ -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(" ", "");

View File

@ -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.

View File

@ -77,6 +77,7 @@ V3 = 이름 비교에 사용할 포켓몬 종류 인덱스가 잘못되었습니
V20 = 이름이 포켓몬 종류와 일치하지 않습니다.
V13 = 알 이름이 언어별 알 이름과 일치하지 않습니다.
V12 = 알은 반드시 이름 플래그가 켜져 있어야 합니다.
V224 = Egg must be not nicknamed.
V7 = 게임 내 교환의 버전이 잘못되었을 수 있습니다.
V8 = 게임 내 교환의 인덱스가 잘못되었을 수 있습니다.
V10 = 게임 내 교환의 어버이가 달라졌습니다.

View File

@ -77,6 +77,7 @@ V3 = 宝可梦种类无法用于昵称对比
V20 = 昵称与种类名不一致。
V13 = 蛋名称与语言不一致。
V12 = 蛋必须有昵称。
V224 = Egg must be not nicknamed.
V7 = 游戏内连接交换版本不合法?
V8 = 游戏内连接交换序号不合法?
V10 = 游戏内连接交换的初训家被修改。