Add more pb7 legality checks

can give nicknames to chinese mons now! Encoding looks the same
@wwwwwwzx :)
This commit is contained in:
Kurt
2018-11-16 17:42:50 -08:00
parent 83f2d3f48f
commit 013bc70ed9
3 changed files with 21 additions and 2 deletions

View File

@@ -409,6 +409,10 @@ public static class LegalityCheckStrings
public static string LRibbonFInvalid_0 { get; set; } = "Invalid Ribbons: {0}";
public static string LRibbonFMissing_0 { get; set; } = "Missing Ribbons: {0}";
public static string LStatIncorrectHeight { get; set; } = "Calculated Height does not match stored value.";
public static string LStatIncorrectWeight { get; set; } = "Calculated Weight does not match stored value.";
public static string LStatIncorrectCP { get; set; } = "Calculated CP does not match stored value.";
public static string LSuperComplete { get; set; } = "Super Training complete flag mismatch.";
public static string LSuperDistro { get; set; } = "Distribution Super Training missions are not released.";
public static string LSuperEgg { get; set; } = "Can't Super Train an Egg.";

View File

@@ -1,4 +1,5 @@
using System.Linq;
using System;
using System.Linq;
using static PKHeX.Core.LegalityCheckStrings;
namespace PKHeX.Core
@@ -36,6 +37,8 @@ public override void Verify(LegalityAnalysis data)
if (pkm is PK7 pk7 && pk7.ResortEventStatus >= 20)
data.AddLine(GetInvalid(LTransferBad));
if (pkm is PB7 pb7)
VerifyBelugaStats(data, pb7);
VerifyMiscFatefulEncounter(data);
}
@@ -271,5 +274,17 @@ public void VerifyVersionEvolution(LegalityAnalysis data)
break;
}
}
private static void VerifyBelugaStats(LegalityAnalysis data, PB7 pb7)
{
if (Math.Abs(pb7.HeightAbsolute - pb7.CalcHeightAbsolute) > 0.001 && !IsStarter(pb7))
data.AddLine(GetInvalid(LStatIncorrectHeight, CheckIdentifier.Encounter));
if (Math.Abs(pb7.WeightAbsolute - pb7.CalcWeightAbsolute) > 0.001)
data.AddLine(GetInvalid(LStatIncorrectWeight, CheckIdentifier.Encounter));
if (pb7.Stat_CP != pb7.CalcCP)
data.AddLine(GetInvalid(LStatIncorrectCP, CheckIdentifier.Encounter));
}
private static bool IsStarter(PKM pb7) => (pb7.Species == 25 && pb7.AltForm == 8) || (pb7.Species == 133 && pb7.AltForm == 1);
}
}

View File

@@ -75,7 +75,7 @@ private bool VerifyUnNicknamedEncounter(LegalityAnalysis data, PKM pkm, string n
data.AddLine(Get(msg, Severity.Fishy));
return true;
}
if (StringConverter.HasEastAsianScriptCharacters(nickname)) // East Asian Scripts
if (StringConverter.HasEastAsianScriptCharacters(nickname) && !(pkm is PB7)) // East Asian Scripts
{
data.AddLine(GetInvalid(LNickInvalidChar));
return true;