Skip to content

Commit

Permalink
Fix 7th gen pikachu altform check
Browse files Browse the repository at this point in the history
  • Loading branch information
kwsch committed Jan 18, 2018
1 parent 69896a3 commit 387030e
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions PKHeX.Core/Legality/Checks.cs
Expand Up @@ -1939,14 +1939,26 @@ private void VerifyForm()

switch (pkm.Species)
{
case 25: // Pikachu
if (Info.Generation == 6 && pkm.AltForm != 0 ^ Type == typeof(EncounterStatic))
case 25 when Info.Generation == 6: // Pikachu Cosplay
if (pkm.AltForm != 0 ^ Type == typeof(EncounterStatic))
{
string msg = Type == typeof(EncounterStatic) ? V305 : V306;
AddLine(Severity.Invalid, msg, CheckIdentifier.Form);
return;
}
if (Info.Generation == 7 && pkm.AltForm != 0 ^ Type == typeof(MysteryGift))
break;
case 25 when Info.Generation == 7: // Pikachu Cap
bool IsValidPikachuCap()
{
switch (EncounterMatch)
{
default: return pkm.AltForm == 0;
case WC7 wc7: return wc7.Form == pkm.AltForm;
case EncounterStatic s: return s.Form == pkm.AltForm;
}
}

if (!IsValidPikachuCap())
{
bool gift = EncounterMatch is WC7 g && g.Form != pkm.AltForm;
var msg = gift ? V307 : V317;
Expand Down

0 comments on commit 387030e

Please sign in to comment.