Revise AV check string to show which stat invalid

This commit is contained in:
Kurt 2022-07-10 17:34:46 -07:00
parent 79913a2474
commit 7d35517614
11 changed files with 41 additions and 37 deletions

View file

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

View file

@ -20,23 +20,21 @@ public sealed class AwakenedValueVerifier : Verifier
Span<byte> required = stackalloc byte[6];
AwakeningUtil.GetExpectedMinimumAVs(required, pb7);
ReadOnlySpan<byte> 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<byte> 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))));
}
}

View file

@ -68,7 +68,22 @@ public static class AwakeningUtil
/// </summary>
/// <param name="pk">Data to set values for</param>
/// <param name="value"></param>
public static void AwakeningSetVisual(IAwakened pk, Span<byte> value)
public static void AwakeningGetVisual(IAwakened pk, Span<byte> 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;
}
/// <summary>
/// Sets the awakening values according to their displayed order.
/// </summary>
/// <param name="pk">Data to set values for</param>
/// <param name="value"></param>
public static void AwakeningSetVisual(IAwakened pk, ReadOnlySpan<byte> value)
{
pk.AV_HP = value[0];
pk.AV_ATK = value[1];

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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 = マスターボールは遺伝できません

View file

@ -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 = 일반 알은 마스터볼에 들어있을 수 없습니다.

View file

@ -35,8 +35,7 @@ LAbilityMismatchSOS = 非帮手宝可梦拥有隐藏特性。
LAbilityPatchUsed = 特性已被特性膏药修改
LAbilityUnexpected = 特性对于该种类/形态不合法。
LAwakenedCap = 单个觉醒值不能大于 {0}.
LAwakenedEXPIncreased = 所有觉醒值为0但等级高于相遇等级.
LAwakenedShouldBeValue = 单个觉醒值应该大于 {0}.
LAwakenedShouldBeValue = 单个觉醒值应该大于 {0} ({1}).
LBallAbility = 不能以该球捕获隐藏特性。
LBallEggCherish = 一般的蛋不能为贵重球。
LBallEggMaster = 一般的蛋不能为大师球。