Add EV/AV verification for pb7

This commit is contained in:
Kurt 2018-11-16 14:19:24 -08:00
parent f5c5145cbf
commit dae4a0a0ae
2 changed files with 27 additions and 0 deletions

View file

@ -77,6 +77,11 @@ namespace PKHeX.Core
public static string LAbilityMismatchSOS { get; set; } = "Hidden Ability on non-SOS wild encounter.";
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 LAwakenedShouldBeZero { get; set; } = "Cannot receive AVs.";
public static string LAwakenedEXPIncreased { get; set; } = "All AVs are zero, but leveled above Met Level.";
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.";
public static string LBallEggMaster { get; set; } = "Can't have Master Ball for regular Egg.";
@ -159,6 +164,7 @@ namespace PKHeX.Core
public static string LEffortAllEqual { get; set; } = "EVs are all equal.";
public static string LEffortCap100 { get; set; } = "Individual EV for a level 100 encounter in Generation 4 cannot be greater than 100.";
public static string LEffortEgg { get; set; } = "Eggs cannot receive EVs.";
public static string LEffortShouldBeZero { get; set; } = "Cannot receive EVs.";
public static string LEffortEXPIncreased { get; set; } = "All EVs are zero, but leveled above Met Level.";
public static string LEffortUntrainedCap { get; set; } = "Individual EV without changing EXP cannot be greater than {0}.";

View file

@ -13,6 +13,11 @@ namespace PKHeX.Core
public override void Verify(LegalityAnalysis data)
{
var pkm = data.pkm;
if (pkm is IAwakened a)
{
VerifyAwakenedValues(data, a);
return;
}
var EncounterMatch = data.EncounterMatch;
var evs = pkm.EVs;
int sum = pkm.EVTotal;
@ -47,5 +52,21 @@ namespace PKHeX.Core
else if (evs[0] != 0 && evs.All(ev => evs[0] == ev))
data.AddLine(Get(LEffortAllEqual, Severity.Fishy));
}
private void VerifyAwakenedValues(LegalityAnalysis data, IAwakened awakened)
{
var pkm = data.pkm;
int sum = pkm.EVTotal;
if (sum != 0)
data.AddLine(GetInvalid(LEffortShouldBeZero));
var EncounterMatch = data.EncounterMatch;
if (!awakened.AwakeningAllValid())
data.AddLine(GetInvalid(LAwakenedCap));
if (EncounterMatch is EncounterSlot s && s.Type == SlotType.GoPark && Enumerable.Range(0, 6).Select(awakened.GetAV).Any(z => z < 2))
data.AddLine(GetInvalid(LAwakenedShouldBeValue)); // go park transfers have 2 AVs for all stats.
else if (awakened.AwakeningSum() == 0 && !EncounterMatch.IsWithinRange(pkm))
data.AddLine(Get(LAwakenedEXPIncreased, Severity.Fishy));
}
}
}