Skip to content

Commit

Permalink
Add WC6/WC7 ability checks
Browse files Browse the repository at this point in the history
Ability type not possible to generate ability -> flag it. Thanks Sonic
Blader!
  • Loading branch information
kwsch committed Mar 6, 2017
1 parent c1ab069 commit a4e04fc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions PKHeX/Legality/Checks.cs
Expand Up @@ -916,6 +916,15 @@ private void verifyAbility()
}
if (pkm.GenNumber == 6)
{
if (EncounterIsMysteryGift)
{
var wc = EncounterMatch as WC6;
var type = wc?.AbilityType;
if (type < 3 && pkm.AbilityNumber != 1 << type) // set number
AddLine(Severity.Invalid, "Ability does not match Mystery Gift.", CheckIdentifier.Ability);
else if (type == 3 && pkm.AbilityNumber == 4) // 1/2 only
AddLine(Severity.Invalid, "Ability does not match Mystery Gift.", CheckIdentifier.Ability);
}
if (EncounterType == typeof(EncounterSlot[]) && pkm.AbilityNumber == 4)
{
var slots = (EncounterSlot[])EncounterMatch;
Expand All @@ -932,6 +941,15 @@ private void verifyAbility()
}
if (pkm.GenNumber == 7)
{
if (EncounterIsMysteryGift)
{
var wc = EncounterMatch as WC7;
var type = wc?.AbilityType;
if (type < 3 && pkm.AbilityNumber != 1 << type) // set number
AddLine(Severity.Invalid, "Ability does not match Mystery Gift.", CheckIdentifier.Ability);
else if (type == 3 && pkm.AbilityNumber == 4) // 1/2 only
AddLine(Severity.Invalid, "Ability does not match Mystery Gift.", CheckIdentifier.Ability);
}
if (EncounterType == typeof(EncounterSlot[]) && pkm.AbilityNumber == 4)
{
var slots = (EncounterSlot[])EncounterMatch;
Expand Down

0 comments on commit a4e04fc

Please sign in to comment.