More egg related check changes

Properly check for actual held item
move unhittable check (verifyMisc isnt called when parsing pk1/pk2;
verifyMiscG1 is)
add egg PP check, add common method to be shared between gen1 checks and
GBA+
#1257
This commit is contained in:
Kurt
2017-06-21 09:18:33 -07:00
parent 36b75179f3
commit 9efd49b0bc
5 changed files with 27 additions and 11 deletions

View File

@@ -47,7 +47,7 @@ private void VerifyItem()
AddLine(Severity.Invalid, V204, CheckIdentifier.Form);
if (pkm.Format == 3 && pkm.HeldItem == 175)
VerifyEReaderBerry();
if (pkm.IsEgg)
if (pkm.IsEgg && pkm.HeldItem != 0)
AddLine(Severity.Invalid, V419, CheckIdentifier.Egg);
}
private void VerifyEReaderBerry()
@@ -2138,6 +2138,12 @@ private void VerifyForm()
}
private void VerifyMiscG1()
{
if (pkm.IsEgg)
{
VerifyMiscEggCommon();
if (pkm.PKRS_Cured || pkm.PKRS_Infected)
AddLine(Severity.Invalid, V368, CheckIdentifier.Egg);
}
if (pkm.Format > 1)
return;
@@ -2206,12 +2212,10 @@ private void VerifyMisc()
if (pkm.IsEgg)
{
if (new[] {pkm.Move1_PPUps, pkm.Move2_PPUps, pkm.Move3_PPUps, pkm.Move4_PPUps}.Any(ppup => ppup > 0))
AddLine(Severity.Invalid, V319, CheckIdentifier.Egg);
VerifyMiscEggCommon();
if (pkm.CNTs.Any(stat => stat > 0))
AddLine(Severity.Invalid, V320, CheckIdentifier.Egg);
if (pkm.Format == 2 && (pkm.PKRS_Cured || pkm.PKRS_Infected))
AddLine(Severity.Invalid, V368, CheckIdentifier.Egg);
if (pkm is PK4 pk4)
{
if (pk4.ShinyLeaf != 0)
@@ -2219,12 +2223,6 @@ private void VerifyMisc()
if (pk4.PokéathlonStat != 0)
AddLine(Severity.Invalid, V415, CheckIdentifier.Egg);
}
var HatchCycles = (EncounterMatch as EncounterStatic)?.EggCycles;
if (HatchCycles == 0 || HatchCycles == null)
HatchCycles = pkm.PersonalInfo.HatchCycles;
if (pkm.CurrentFriendship > HatchCycles)
AddLine(Severity.Invalid, V374, CheckIdentifier.Egg);
}
if (!Encounter.Valid)
@@ -2251,6 +2249,20 @@ private void VerifyMisc()
return;
}
}
private void VerifyMiscEggCommon()
{
if (new[] {pkm.Move1_PPUps, pkm.Move2_PPUps, pkm.Move3_PPUps, pkm.Move4_PPUps}.Any(ppup => ppup > 0))
AddLine(Severity.Invalid, V319, CheckIdentifier.Egg);
if (pkm.Move1_PP != pkm.GetMovePP(pkm.Move1, 0) || pkm.Move2_PP != pkm.GetMovePP(pkm.Move2, 0)
|| pkm.Move3_PP != pkm.GetMovePP(pkm.Move3, 0) || pkm.Move4_PP != pkm.GetMovePP(pkm.Move4, 0))
AddLine(Severity.Invalid, V420, CheckIdentifier.Egg);
var HatchCycles = (EncounterMatch as EncounterStatic)?.EggCycles;
if (HatchCycles == 0 || HatchCycles == null)
HatchCycles = pkm.PersonalInfo.HatchCycles;
if (pkm.CurrentFriendship > HatchCycles)
AddLine(Severity.Invalid, V374, CheckIdentifier.Egg);
}
private void VerifyFatefulMysteryGift(MysteryGift g)
{
if (g is PGF p && p.IsShiny)

View File

@@ -401,6 +401,7 @@ public static class LegalityCheckStrings
public static string V417 {get; set;} = "Suspicious Original Trainer details.";
public static string V418 {get; set;} = "Individual EV without changing EXP cannot be greater than {0}.";
public static string V419 {get; set;} = "Eggs cannot hold items.";
public static string V420 {get; set;} = "Eggs cannot have modified move PP counts.";
public static string V600 { get; set; } = "Invalid Ribbons: {0}";
public static string V601 { get; set; } = "Missing Ribbons: {0}";

View File

@@ -339,6 +339,7 @@ V416 = Mystery Gift cannot be received by this version.
V417 = Suspicious Original Trainer details.
V418 = Individual EV without changing EXP cannot be greater than {0}.
V419 = Eggs cannot hold items.
V420 = Eggs cannot have modified PP counts.
V602 = All ribbons accounted for.
V600 = Missing Ribbons: {0}
V601 = Invalid Ribbons: {0}

View File

@@ -339,6 +339,7 @@ V416 = Mystery Gift cannot be received by this version.
V417 = Suspicious Original Trainer details.
V418 = Individual EV without changing EXP cannot be greater than {0}.
V419 = Eggs cannot hold items.
V419 = Eggs cannot have modified PP counts.
V602 = 모든 리본이 채워졌습니다.
V600 = 없는 리본: {0}
V601 = 사용할 수 없는 리본: {0}

View File

@@ -339,6 +339,7 @@ V416 = Mystery Gift cannot be received by this version.
V417 = Suspicious Original Trainer details.
V418 = Individual EV without changing EXP cannot be greater than {0}.
V419 = Eggs cannot hold items.
V420 = Eggs cannot have modified PP counts.
V602 = 所有奖章合法。
V600 = 缺失奖章: {0}
V601 = 不合法奖章: {0}