From 7d3551761470e15c6a1bbcc5c340f4d6b1ae3413 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 10 Jul 2022 17:34:46 -0700 Subject: [PATCH] Revise AV check string to show which stat invalid --- .../Formatting/LegalityCheckStrings.cs | 5 ++- .../Verifiers/AwakenedValueVerifier.cs | 32 +++++++++---------- PKHeX.Core/PKM/Interfaces/IAwakened.cs | 17 +++++++++- .../checks/LegalityCheckStrings_de.txt | 3 +- .../checks/LegalityCheckStrings_en.txt | 3 +- .../checks/LegalityCheckStrings_es.txt | 3 +- .../checks/LegalityCheckStrings_fr.txt | 3 +- .../checks/LegalityCheckStrings_it.txt | 3 +- .../checks/LegalityCheckStrings_ja.txt | 3 +- .../checks/LegalityCheckStrings_ko.txt | 3 +- .../checks/LegalityCheckStrings_zh.txt | 3 +- 11 files changed, 41 insertions(+), 37 deletions(-) diff --git a/PKHeX.Core/Legality/Formatting/LegalityCheckStrings.cs b/PKHeX.Core/Legality/Formatting/LegalityCheckStrings.cs index eb12f389c..6815ba215 100644 --- a/PKHeX.Core/Legality/Formatting/LegalityCheckStrings.cs +++ b/PKHeX.Core/Legality/Formatting/LegalityCheckStrings.cs @@ -1,4 +1,4 @@ -// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global +// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global namespace PKHeX.Core; @@ -79,8 +79,7 @@ public static class LegalityCheckStrings public static string LAbilityUnexpected { get; set; } = "Ability is not valid for species/form."; public static string LAwakenedCap { get; set; } = "Individual AV cannot be greater than {0}."; - public static string LAwakenedShouldBeValue { get; set; } = "Individual AV should be greater than {0}."; - public static string LAwakenedEXPIncreased { get; set; } = "All AVs are zero, but leveled above Met Level."; + public static string LAwakenedShouldBeValue { get; set; } = "Individual AV ({1}) should be greater than {0}."; public static string LBallAbility { get; set; } = "Can't obtain Hidden Ability with Ball."; public static string LBallEggCherish { get; set; } = "Can't have Cherish Ball for regular Egg."; diff --git a/PKHeX.Core/Legality/Verifiers/AwakenedValueVerifier.cs b/PKHeX.Core/Legality/Verifiers/AwakenedValueVerifier.cs index 8d6ea45f2..e9acd7971 100644 --- a/PKHeX.Core/Legality/Verifiers/AwakenedValueVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/AwakenedValueVerifier.cs @@ -20,23 +20,21 @@ public sealed class AwakenedValueVerifier : Verifier Span required = stackalloc byte[6]; AwakeningUtil.GetExpectedMinimumAVs(required, pb7); - ReadOnlySpan current = stackalloc byte[6] - { - pb7.GetAV(0), - pb7.GetAV(1), - pb7.GetAV(2), - pb7.GetAV(4), - pb7.GetAV(5), - pb7.GetAV(3), // Speed last! - }; + Span current = stackalloc byte[6]; + AwakeningUtil.AwakeningGetVisual(pb7, current); - for (int i = 0; i < required.Length; i++) - { - if (current[i] >= required[i]) - continue; - - data.AddLine(GetInvalid(string.Format(LegalityCheckStrings.LAwakenedShouldBeValue, required[i]))); - break; - } + // For each index of current, the value should be >= the required value. + if (current[0] < required[0]) + data.AddLine(GetInvalid(string.Format(LegalityCheckStrings.LAwakenedShouldBeValue, required[0], nameof(IAwakened.AV_HP)))); + if (current[1] < required[1]) + data.AddLine(GetInvalid(string.Format(LegalityCheckStrings.LAwakenedShouldBeValue, required[1], nameof(IAwakened.AV_ATK)))); + if (current[2] < required[2]) + data.AddLine(GetInvalid(string.Format(LegalityCheckStrings.LAwakenedShouldBeValue, required[2], nameof(IAwakened.AV_DEF)))); + if (current[3] < required[3]) + data.AddLine(GetInvalid(string.Format(LegalityCheckStrings.LAwakenedShouldBeValue, required[3], nameof(IAwakened.AV_SPA)))); + if (current[4] < required[4]) + data.AddLine(GetInvalid(string.Format(LegalityCheckStrings.LAwakenedShouldBeValue, required[4], nameof(IAwakened.AV_SPD)))); + if (current[5] < required[5]) + data.AddLine(GetInvalid(string.Format(LegalityCheckStrings.LAwakenedShouldBeValue, required[5], nameof(IAwakened.AV_SPE)))); } } diff --git a/PKHeX.Core/PKM/Interfaces/IAwakened.cs b/PKHeX.Core/PKM/Interfaces/IAwakened.cs index 74cc0233d..f07fbfad0 100644 --- a/PKHeX.Core/PKM/Interfaces/IAwakened.cs +++ b/PKHeX.Core/PKM/Interfaces/IAwakened.cs @@ -68,7 +68,22 @@ public static class AwakeningUtil /// /// Data to set values for /// - public static void AwakeningSetVisual(IAwakened pk, Span value) + public static void AwakeningGetVisual(IAwakened pk, Span value) + { + value[0] = pk.AV_HP; + value[1] = pk.AV_ATK; + value[2] = pk.AV_DEF; + value[3] = pk.AV_SPA; + value[4] = pk.AV_SPD; + value[5] = pk.AV_SPE; + } + + /// + /// Sets the awakening values according to their displayed order. + /// + /// Data to set values for + /// + public static void AwakeningSetVisual(IAwakened pk, ReadOnlySpan value) { pk.AV_HP = value[0]; pk.AV_ATK = value[1]; diff --git a/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_de.txt b/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_de.txt index c33358346..4e1896153 100644 --- a/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_de.txt +++ b/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_de.txt @@ -35,8 +35,7 @@ LAbilityMismatchSOS = Hidden Ability on non-SOS wild encounter. LAbilityPatchUsed = Ability available with Ability Patch. LAbilityUnexpected = Ability is not valid for species/form. LAwakenedCap = Individual AV cannot be greater than {0}. -LAwakenedEXPIncreased = All AVs are zero, but leveled above Met Level. -LAwakenedShouldBeValue = Individual AV should be greater than {0}. +LAwakenedShouldBeValue = Individual AV ({1}) should be greater than {0}. LBallAbility = Can't obtain Hidden Ability with Ball. LBallEggCherish = Can't have Cherish Ball for regular Egg. LBallEggMaster = Can't have Master Ball for regular Egg. diff --git a/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_en.txt b/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_en.txt index af1a4d164..fc182b42c 100644 --- a/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_en.txt +++ b/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_en.txt @@ -35,8 +35,7 @@ LAbilityMismatchSOS = Hidden Ability on non-SOS wild encounter. LAbilityPatchUsed = Ability available with Ability Patch. LAbilityUnexpected = Ability is not valid for species/form. LAwakenedCap = Individual AV cannot be greater than {0}. -LAwakenedEXPIncreased = All AVs are zero, but leveled above Met Level. -LAwakenedShouldBeValue = Individual AV should be greater than {0}. +LAwakenedShouldBeValue = Individual ({1}) AV should be greater than {0}. LBallAbility = Can't obtain Hidden Ability with Ball. LBallEggCherish = Can't have Cherish Ball for regular Egg. LBallEggMaster = Can't have Master Ball for regular Egg. diff --git a/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_es.txt b/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_es.txt index 0d87fe954..37b85b221 100644 --- a/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_es.txt +++ b/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_es.txt @@ -35,8 +35,7 @@ LAbilityMismatchSOS = Habilidad Oculta en un Encuentro salvaje que no es por Lla LAbilityPatchUsed = Habilidad disponible con parche de habilidad. LAbilityUnexpected = La Habilidad no es válida para esta Especie/Forma. LAwakenedCap = Los AV individuales no pueden ser mayor que: {0}. -LAwakenedEXPIncreased = Todos los AVs son cero, pero está nivelado por encima del Nivel de Encuentro. -LAwakenedShouldBeValue = Los AVs individuales deberían ser mayor que: {0}. +LAwakenedShouldBeValue = Los AVs individuales deberían ser mayor que: {0} ({1}). LBallAbility = No se puede tener Habilidad Oculta con está Ball LBallEggCherish = No se puede tener una Gloria Ball en un Huevo común. LBallEggMaster = No se puede tener una Master Ball en un Huevo común. diff --git a/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_fr.txt b/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_fr.txt index e7a8160a8..47c3b50f0 100644 --- a/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_fr.txt +++ b/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_fr.txt @@ -35,8 +35,7 @@ LAbilityMismatchSOS = Talent caché, Pokémon rencontré dans la nature (mais pa LAbilityPatchUsed = Talent disponible avec le patch de Talent. LAbilityUnexpected = Talent incompatible avec espèce / forme. LAwakenedCap = La valeur AV individuelle ne peut pas être supérieure à {0}. -LAwakenedEXPIncreased = Tous les AV sont nuls, mais nivelés au-dessus du niveau Met. -LAwakenedShouldBeValue = La valeur AV individuelle doit être supérieure à {0}. +LAwakenedShouldBeValue = La valeur AV individuelle ({1}) doit être supérieure à {0}. LBallAbility = Impossible d'avoir le talent caché avec cette Ball. LBallEggCherish = Un Œuf ne peut pas être contenu dans une Mémoire Ball. LBallEggMaster = Un Œuf ne peut pas être contenu dans une Master Ball. diff --git a/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_it.txt b/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_it.txt index c1156bd47..5c929a887 100644 --- a/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_it.txt +++ b/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_it.txt @@ -35,8 +35,7 @@ LAbilityMismatchSOS = Abilità Nascosta su un Pokémon non proveniente da una ch LAbilityPatchUsed = Abilità disponibile con il Cerotto Abilità. LAbilityUnexpected = Abilità non valida per la Specie/Forma. LAwakenedCap = AV individuali non possono essere superiori a {0}. -LAwakenedEXPIncreased = Tutti gli AV sono zero, ma il livello è superiore al livello di Incontro. -LAwakenedShouldBeValue = AV individuali dovrebbero essere {0}. +LAwakenedShouldBeValue = AV individuali ({1}) dovrebbero essere {0}. LBallAbility = Impossibile ottenere l'Abilità con la Ball. LBallEggCherish = Le uova non possono essere in Pregio Ball. LBallEggMaster = Le uova non possono essere in Master Ball. diff --git a/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_ja.txt b/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_ja.txt index dc78697ae..c4dc6ae5d 100644 --- a/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_ja.txt +++ b/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_ja.txt @@ -35,8 +35,7 @@ LAbilityMismatchSOS = Hidden Ability on non-SOS wild encounter. LAbilityPatchUsed = Ability available with Ability Patch. LAbilityUnexpected = Ability is not valid for species/form. LAwakenedCap = Individual AV cannot be greater than {0}. -LAwakenedEXPIncreased = All AVs are zero, but leveled above Met Level. -LAwakenedShouldBeValue = Individual AV should be greater than {0}. +LAwakenedShouldBeValue = Individual AV ({1}) should be greater than {0}. LBallAbility = 隠れ特性と捕獲ボールが一致しません LBallEggCherish = プレシャルボールは遺伝できません LBallEggMaster = マスターボールは遺伝できません diff --git a/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_ko.txt b/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_ko.txt index e4749ea78..a1d574ad5 100644 --- a/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_ko.txt +++ b/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_ko.txt @@ -35,8 +35,7 @@ LAbilityMismatchSOS = 난입배틀이 아닌 야생 인카운터에서 숨겨진 LAbilityPatchUsed = Ability modified with Ability Patch. LAbilityUnexpected = 포켓몬 종류/폼에서 사용할 수 없는 특성입니다. LAwakenedCap = 각 AV는 {0}보다 클 수 없습니다. -LAwakenedEXPIncreased = 현재 레벨이 만난 레벨 이상이지만 모든 AV가 0입니다. -LAwakenedShouldBeValue = 각 AV는 {0}보다 커야 합니다. +LAwakenedShouldBeValue = 각 AV는 {0}보다 커야 합니다 ({1}). LBallAbility = 숨겨진 특성을 잡을 수 없는 볼입니다. LBallEggCherish = 일반 알은 프레셔스볼에 들어있을 수 없습니다. LBallEggMaster = 일반 알은 마스터볼에 들어있을 수 없습니다. diff --git a/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_zh.txt b/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_zh.txt index 2d68efe02..4e5e5b5b1 100644 --- a/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_zh.txt +++ b/PKHeX.Core/Resources/legality/checks/LegalityCheckStrings_zh.txt @@ -35,8 +35,7 @@ LAbilityMismatchSOS = 非帮手宝可梦拥有隐藏特性。 LAbilityPatchUsed = 特性已被特性膏药修改 LAbilityUnexpected = 特性对于该种类/形态不合法。 LAwakenedCap = 单个觉醒值不能大于 {0}. -LAwakenedEXPIncreased = 所有觉醒值为0,但等级高于相遇等级. -LAwakenedShouldBeValue = 单个觉醒值应该大于 {0}. +LAwakenedShouldBeValue = 单个觉醒值应该大于 {0} ({1}). LBallAbility = 不能以该球捕获隐藏特性。 LBallEggCherish = 一般的蛋不能为贵重球。 LBallEggMaster = 一般的蛋不能为大师球。