private bool VerifyAbilityPCD(LegalityAnalysis data, PCD pcd, bool?abilityUnchanged, int[] abilities) { var pkm = data.pkm; if (pcd.Species == pkm.Species && pkm.Ability == pcd.Gift.PK.Ability) // Edge case (PID ability gift mismatch) { data.AddLine(GetValid(V115)); } else if (pkm.Format >= 6 && abilities[0] == abilities[1] && pkm.AbilityNumber == 1) { data.AddLine(GetValid(V115)); // gen3-5 transfer with same ability -> 1st ability that matches } else if (pkm.Format >= 6 && abilities[0] != abilities[1] && pkm.AbilityNumber < 4) // Ability Capsule can change between 1/2 { data.AddLine(GetValid(V109)); } else { if (!(abilityUnchanged ?? false)) { return(false); } data.AddLine(GetInvalid(V223)); } return(true); }
private CheckResult VerifyAbilityPCD(LegalityAnalysis data, IReadOnlyList <int> abilities, PCD pcd) { var pkm = data.pkm; if (pkm.Format >= 6) { if (abilities[0] == abilities[1]) { // Gen3-5 transfer with same ability -> 1st ability that matches if (pkm.AbilityNumber == 1) { return(GetValid(V115)); } return(CheckMatch(pkm, abilities, 4, AbilityState.MustMatch)); // evolved, must match } if (pkm.AbilityNumber < 4) // Ability Capsule can change between 1/2 { return(GetValid(V109)); } } if (pcd.Species != pkm.Species) { return(CheckMatch(pkm, abilities, 4, AbilityState.MustMatch)); // evolved, must match } // Edge case (PID ability gift mismatch) -- must match gift ability. return(pkm.Ability == pcd.Gift.PK.Ability ? VALID : INVALID); }