diff --git a/PKHeX.Core/Legality/Checks.cs b/PKHeX.Core/Legality/Checks.cs index 450ef5473..41b78c99a 100644 --- a/PKHeX.Core/Legality/Checks.cs +++ b/PKHeX.Core/Legality/Checks.cs @@ -154,18 +154,30 @@ private void VerifyTransferEC() AddLine(Severity.Invalid, xorPID ? V215 : V216, CheckIdentifier.EC); } #region verifyLanguage - private bool verifyLanguage() + private bool VerifyLanguage() { int maxLanguageID = Legal.GetMaxLanguageID(Info.Generation); + + // Language ID 6 is unused; flag if an impossible language is used if (pkm.Language == 6 || pkm.Language > maxLanguageID) { AddLine(Severity.Invalid, string.Format(V5, "<=" + maxLanguageID, pkm.Language), CheckIdentifier.Language); return false; } - if(pkm.Format == 4 && pkm.Gen4 && (pkm.Language == 8) != (Legal.SavegameLanguage == 8)) + + // Korean Gen4 games can not trade with other Gen4 languages, but can use Pal Park with any Gen3 game/language. + if (pkm.Format == 4 && pkm.Gen4 && pkm.Language == 8 != (Legal.SavegameLanguage == 8)) { - // Korean gen 4 games can not trade with non-korean gen 4 games, but can use palpark with any gen3 game - AddLine(Severity.Invalid, pkm.Language == 8 ? V610 : V611, CheckIdentifier.Language); + var currentpkm = pkm.Language == 8 ? V611 : V612; + var currentsav = pkm.Language == 8 ? V612 : V611; + AddLine(Severity.Invalid, string.Format(V610, currentpkm, currentsav), CheckIdentifier.Language); + return false; + } + + // Korean Crystal does not exist + if (pkm.Version == (int)GameVersion.C && pkm.Korean) + { + AddLine(Severity.Invalid, string.Format(V5, "!=" + pkm.Language, pkm.Language), CheckIdentifier.Language); return false; } @@ -200,7 +212,7 @@ private void VerifyNickname() if (!Encounter.Valid) return; - if (!verifyLanguage()) + if (!VerifyLanguage()) return; if (Type == typeof(EncounterTrade)) diff --git a/PKHeX.Core/Legality/Core.cs b/PKHeX.Core/Legality/Core.cs index c4d57de64..0700cb641 100644 --- a/PKHeX.Core/Legality/Core.cs +++ b/PKHeX.Core/Legality/Core.cs @@ -258,7 +258,7 @@ internal static List[] GetExclusiveMoves(int species1, int species2, int Ge moves2.RemoveAll(x => !hashMoves.Contains(x) || common.Contains(x)); return new[] { moves1, moves2 }; } - private static IEnumerable GetLvlMoves(int species, int form, int Generation, int minlvl, int lvl, bool korean, GameVersion Version = GameVersion.Any) + private static IEnumerable GetLvlMoves(int species, int form, int Generation, int minlvl, int lvl, bool korean = true, GameVersion Version = GameVersion.Any) { var r = new List(); var ver = Version; @@ -587,7 +587,7 @@ private static IEnumerable GetValidPostEvolutionMoves(PKM pkm, int Species, for (int i = 0; i <= index; i++) { var evo = evoChain[i]; - var moves = GetMoves(pkm, evo.Species, 1, 1, evo.Level, pkm.AltForm, moveTutor: true, Version: Version, LVL: true, specialTutors: true, Machine: true, MoveReminder: true, RemoveTransferHM: false, Generation: Generation, Korean: pkm.Korean); + var moves = GetMoves(pkm, evo.Species, 1, 1, evo.Level, pkm.AltForm, moveTutor: true, Version: Version, LVL: true, specialTutors: true, Machine: true, MoveReminder: true, RemoveTransferHM: false, Generation: Generation); // Moves from Species or any species after in the evolution phase evomoves.AddRange(moves); } @@ -601,7 +601,7 @@ internal static IEnumerable GetExclusivePreEvolutionMoves(PKM pkm, int Spec for (int i = 0; i < evoChain.Length; i++) { var evo = evoChain[i]; - var moves = GetMoves(pkm, evo.Species, 1, 1, evo.Level, pkm.AltForm, moveTutor: true, Version: Version, LVL: true, specialTutors: true, Machine: true, MoveReminder: true, RemoveTransferHM: false, Generation: Generation, Korean: pkm.Korean); + var moves = GetMoves(pkm, evo.Species, 1, 1, evo.Level, pkm.AltForm, moveTutor: true, Version: Version, LVL: true, specialTutors: true, Machine: true, MoveReminder: true, RemoveTransferHM: false, Generation: Generation); var list = i >= index ? preevomoves : evomoves; list.AddRange(moves); } @@ -609,9 +609,9 @@ internal static IEnumerable GetExclusivePreEvolutionMoves(PKM pkm, int Spec } // Encounter - internal static IEnumerable GetGen2Versions(LegalInfo Info, bool Korean) + internal static IEnumerable GetGen2Versions(LegalInfo Info) { - if (AllowGen2Crystal(Korean) && Info.Game == GameVersion.C) + if (AllowGen2Crystal(Info.Korean) && Info.Game == GameVersion.C) yield return GameVersion.C; // Any encounter marked with version GSC is for pokemon with the same moves in GS and C @@ -1655,7 +1655,7 @@ private static IEnumerable GetValidMoves(PKM pkm, GameVersion Version, DexL // In gen 3 deoxys has different forms depending on the current game, in personal info there is no alter form info formcount = 4; for (int i = 0; i < formcount; i++) - r.AddRange(GetMoves(pkm, species, minLvLG1, minLvLG2, vs.First().Level, i, moveTutor, Version, LVL, Tutor, Machine, MoveReminder, RemoveTransferHM, Generation, pkm.Korean)); + r.AddRange(GetMoves(pkm, species, minLvLG1, minLvLG2, vs.First().Level, i, moveTutor, Version, LVL, Tutor, Machine, MoveReminder, RemoveTransferHM, Generation)); if (Relearn) r.AddRange(pkm.RelearnMoves); return r.Distinct(); } @@ -1678,7 +1678,7 @@ private static IEnumerable GetValidMoves(PKM pkm, GameVersion Version, DexL if (evo.MinLevel > 1) minlvlevo2 = Math.Min(pkm.CurrentLevel, evo.MinLevel); } - r.AddRange(GetMoves(pkm, evo.Species, minlvlevo1, minlvlevo2, evo.Level, pkm.AltForm, moveTutor, Version, LVL, Tutor, Machine, MoveReminder, RemoveTransferHM, Generation, pkm.Korean)); + r.AddRange(GetMoves(pkm, evo.Species, minlvlevo1, minlvlevo2, evo.Level, pkm.AltForm, moveTutor, Version, LVL, Tutor, Machine, MoveReminder, RemoveTransferHM, Generation)); } if (pkm.Format <= 3) @@ -1712,7 +1712,7 @@ private static IEnumerable GetValidMoves(PKM pkm, GameVersion Version, DexL r.AddRange(pkm.RelearnMoves); return r.Distinct(); } - private static IEnumerable GetMoves(PKM pkm, int species, int minlvlG1, int minlvlG2, int lvl, int form, bool moveTutor, GameVersion Version, bool LVL, bool specialTutors, bool Machine, bool MoveReminder, bool RemoveTransferHM, int Generation,bool Korean) + private static IEnumerable GetMoves(PKM pkm, int species, int minlvlG1, int minlvlG2, int lvl, int form, bool moveTutor, GameVersion Version, bool LVL, bool specialTutors, bool Machine, bool MoveReminder, bool RemoveTransferHM, int Generation) { List r = new List(); diff --git a/PKHeX.Core/Legality/Encounters/LegalInfo.cs b/PKHeX.Core/Legality/Encounters/LegalInfo.cs index 526ea53e9..72cbddbc1 100644 --- a/PKHeX.Core/Legality/Encounters/LegalInfo.cs +++ b/PKHeX.Core/Legality/Encounters/LegalInfo.cs @@ -51,9 +51,12 @@ public IEncounterable EncounterMatch /// This boolean is true until all valid encounters are tested, at which time it is false. public bool PIDIVMatches { get; set; } = true; + public readonly bool Korean; + public LegalInfo(PKM pk) { pkm = pk; + Korean = pk.Korean; // Store repeatedly accessed values Game = (GameVersion)pkm.Version; diff --git a/PKHeX.Core/Legality/Encounters/VerifyCurrentMoves.cs b/PKHeX.Core/Legality/Encounters/VerifyCurrentMoves.cs index b972b7700..c5580c36d 100644 --- a/PKHeX.Core/Legality/Encounters/VerifyCurrentMoves.cs +++ b/PKHeX.Core/Legality/Encounters/VerifyCurrentMoves.cs @@ -151,7 +151,7 @@ private static CheckMoveResult[] ParseMovesGenGB(PKM pkm, int[] Moves, LegalInfo return ParseMovesSpecialMoveset(pkm, Moves, info); var InitialMoves = new int[0]; int[] SpecialMoves = GetSpecialMoves(info.EncounterMatch); - IEnumerable games = (info.EncounterMatch as IGeneration)?.Generation == 1 ? Legal.GetGen1Versions(info) : Legal.GetGen2Versions(info, pkm.Korean); + IEnumerable games = (info.EncounterMatch as IGeneration)?.Generation == 1 ? Legal.GetGen1Versions(info) : Legal.GetGen2Versions(info); foreach (GameVersion ver in games) { var VerInitialMoves = Legal.GetInitialMovesGBEncounter(G1Encounter.Species, G1Encounter.LevelMin, ver).ToArray(); diff --git a/PKHeX.Core/Legality/LegalityCheckStrings.cs b/PKHeX.Core/Legality/LegalityCheckStrings.cs index 8fff3cef3..a15404f94 100644 --- a/PKHeX.Core/Legality/LegalityCheckStrings.cs +++ b/PKHeX.Core/Legality/LegalityCheckStrings.cs @@ -414,8 +414,9 @@ public static class LegalityCheckStrings public static string V607 { get; set; } = "Kanto Route 14 fishing encounter. Unreachable Water tiles."; public static string V608 { get; set; } = "National Park fishing encounter. Unreachable Water tiles."; public static string V609 { get; set; } = "Generation 2 Safari Zone fishing encounter. Unreachable zone."; - public static string V610 { get; set; } = "Korean gen4 pokemon in non-korean savegame."; // Invalid - public static string V611 { get; set; } = "Non-korean gen4 pokemon in korean savegame."; // Invalid + public static string V610 { get; set; } = "{0} origin cannot exist in the currently loaded ({1}) savegame."; // Invalid + public static string V611 { get; set; } = "Korean"; // Invalid + public static string V612 { get; set; } = "Non-Korean"; // Invalid #endregion } diff --git a/PKHeX.Core/Resources/text/en/LegalityCheckStrings_en.txt b/PKHeX.Core/Resources/text/en/LegalityCheckStrings_en.txt index ebaa16e3d..145fc8b22 100644 --- a/PKHeX.Core/Resources/text/en/LegalityCheckStrings_en.txt +++ b/PKHeX.Core/Resources/text/en/LegalityCheckStrings_en.txt @@ -351,5 +351,6 @@ V606 = Could not find a tree for Crystal headbutt encounter that matches OTID. V607 = Kanto Route 14 fishing encounter. Unreachable Water tiles. V608 = National Park fishing encounter. Unreachable Water tiles. V609 = Generation 2 Safari Zone fishing encounter. Unreachable zone. -V610 = Korean gen4 pokemon in non-korean savegame. -V611 = Non-korean gen4 pokemon in korean savegame. \ No newline at end of file +V610 = {0} origin cannot exist in the currently loaded ({1}) savegame. +V611 = Korean +V612 = Non-Korean \ No newline at end of file diff --git a/PKHeX.Core/Resources/text/ko/LegalityCheckStrings_ko.txt b/PKHeX.Core/Resources/text/ko/LegalityCheckStrings_ko.txt index d08243a8f..da1b6a24a 100644 --- a/PKHeX.Core/Resources/text/ko/LegalityCheckStrings_ko.txt +++ b/PKHeX.Core/Resources/text/ko/LegalityCheckStrings_ko.txt @@ -351,5 +351,6 @@ V606 = 크리스탈 버전 어버이 ID와 일치하는 박치기 인카운터 V607 = 관동 14번 도로의 낚시 인카운터입니다. 물 타일에 접근할 수 없는 지역입니다. V608 = 자연공원의 낚시 인카운터입니다. 물 타일에 접근할 수 없는 지역입니다. V609 = 2세대 사파리존의 낚시 인카운터입니다. 접근할 수 없는 지역입니다. -V610 = Korean gen4 pokemon in non-korean savegame. -V611 = Non-korean gen4 pokemon in korean savegame. +V610 = {0} origin cannot exist in the currently loaded ({1}) savegame. +V611 = Korean +V612 = Non-Korean \ No newline at end of file diff --git a/PKHeX.Core/Resources/text/zh/LegalityCheckStrings_zh.txt b/PKHeX.Core/Resources/text/zh/LegalityCheckStrings_zh.txt index 9ab8c6a16..8631a95d1 100644 --- a/PKHeX.Core/Resources/text/zh/LegalityCheckStrings_zh.txt +++ b/PKHeX.Core/Resources/text/zh/LegalityCheckStrings_zh.txt @@ -351,5 +351,6 @@ V606 = 无法在水晶版找到头锤遇敌的树符合初训家ID。 V607 = 关都14号道路钓鱼遇敌。无法到达的水域。 V608 = 自然公园钓鱼遇敌。无法到达的水域。 V609 = 第二世代狩猎区钓鱼遇敌。无法到达的区域。 -V610 = Korean gen4 pokemon in non-korean savegame. -V611 = Non-korean gen4 pokemon in korean savegame. \ No newline at end of file +V610 = {0} origin cannot exist in the currently loaded ({1}) savegame. +V611 = Korean +V612 = Non-Korean \ No newline at end of file