From 4b1e91677e6481d129b44ecd0f8193d85a8a2e2b Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 24 Jun 2017 17:24:32 -0700 Subject: [PATCH] Fix misc legality issues Closes #1273 not noted anywhere was encounterstatic pikachu on gen6 (pokewalker->6) would get flagged. --- PKHeX.Core/Legality/Checks.cs | 6 +++--- PKHeX.Core/PKM/PK6.cs | 2 +- PKHeX.Core/PKM/PK7.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/PKHeX.Core/Legality/Checks.cs b/PKHeX.Core/Legality/Checks.cs index 33184c8ab..79819f283 100644 --- a/PKHeX.Core/Legality/Checks.cs +++ b/PKHeX.Core/Legality/Checks.cs @@ -345,7 +345,7 @@ private void VerifyEVs() if (evs.Any(ev => ev > 100)) // EVs can only be increased by vitamins to a max of 100. AddLine(Severity.Invalid, V367, CheckIdentifier.EVs); } - else if (pkm.Format < 6) + else if (pkm.Format < 5) { var maxEV = pkm.Format <= 2 ? 25600 : 100; // Vitamin Max // Cannot EV train above 100 without increasing EXP @@ -2008,13 +2008,13 @@ private void VerifyForm() switch (pkm.Species) { case 25: // Pikachu - if (pkm.Format == 6 && pkm.AltForm != 0 ^ Type == typeof(EncounterStatic)) + if (pkm.GenNumber == 6 && pkm.AltForm != 0 ^ Type == typeof(EncounterStatic)) { string msg = Type == typeof(EncounterStatic) ? V305 : V306; AddLine(Severity.Invalid, msg, CheckIdentifier.Form); return; } - if (pkm.Format == 7 && pkm.AltForm != 0 ^ Type == typeof(MysteryGift)) + if (pkm.GenNumber == 7 && pkm.AltForm != 0 ^ Type == typeof(MysteryGift)) { if (EncounterMatch is WC7 gift && gift.Form != pkm.AltForm) { diff --git a/PKHeX.Core/PKM/PK6.cs b/PKHeX.Core/PKM/PK6.cs index 96c51dda1..958e9b69d 100644 --- a/PKHeX.Core/PKM/PK6.cs +++ b/PKHeX.Core/PKM/PK6.cs @@ -355,7 +355,7 @@ public int OppositeFriendship } public override int SuperTrainingMedalCount(int maxCount = 30) { - uint value = BitConverter.ToUInt16(Data, 0x2C); + uint value = BitConverter.ToUInt32(Data, 0x2C); int TrainCount = 0; value >>= 2; for (int i = 0; i < maxCount; i++) diff --git a/PKHeX.Core/PKM/PK7.cs b/PKHeX.Core/PKM/PK7.cs index 0ed2f70ea..d5c6e06bb 100644 --- a/PKHeX.Core/PKM/PK7.cs +++ b/PKHeX.Core/PKM/PK7.cs @@ -369,7 +369,7 @@ public int OppositeFriendship } public override int SuperTrainingMedalCount(int maxCount = 30) { - uint value = BitConverter.ToUInt16(Data, 0x2C); + uint value = BitConverter.ToUInt32(Data, 0x2C); int TrainCount = 0; value >>= 2; for (int i = 0; i < maxCount; i++)