private static bool IsValidGenderMismatch(PKM pkm) { switch (pkm.Species) { case 292 when pkm.Format == 4: // Shedinja evolution gender glitch, should match original Gender return pkm.Gender == PKX.GetGenderFromPIDAndRatio(pkm.EncryptionConstant, 0x7F); // 50M-50F case 183 when pkm.Format >= 6: case 184 when pkm.Format >= 6: // evolved from azurill after transferring to keep gender return pkm.Gender == 1 && (pkm.EncryptionConstant & 0xFF) > 0x3F; default: return false; } }
private bool IsMatchGender(PKM pkm) { if (Gender == -1 || Gender == pkm.Gender) { return(true); } if (Species == (int)Core.Species.Azurill && Generation == 4 && Location == 233 && pkm.Gender == 0) { return(PKX.GetGenderFromPIDAndRatio(pkm.PID, 0xBF) == 1); } return(false); }
/// <summary> /// Sanity checks the provided <see cref="PKM.Gender"/> value, and returns a sane value. /// </summary> /// <param name="pk"></param> /// <returns>Most-legal <see cref="PKM.Gender"/> value</returns> public static int GetSaneGender(this PKM pk) { int gt = pk.PersonalInfo.Gender; switch (gt) { case PersonalInfo.RatioMagicGenderless: return(2); case PersonalInfo.RatioMagicFemale: return(1); case PersonalInfo.RatioMagicMale: return(0); } if (!pk.IsGenderValid()) { return(PKX.GetGenderFromPIDAndRatio(pk.PID, gt)); } return(pk.Gender); }
/// <summary> /// Sanity checks the provided <see cref="PKM.Gender"/> value, and returns a sane value. /// </summary> /// <param name="pk"></param> /// <returns>Most-legal <see cref="PKM.Gender"/> value</returns> public static int GetSaneGender(this PKM pk) { int gt = pk.PersonalInfo.Gender; switch (gt) { case 255: return(2); // Genderless case 254: return(1); // Female-Only case 0: return(0); // Male-Only } if (!pk.IsGenderValid()) { return(PKX.GetGenderFromPIDAndRatio(pk.PID, gt)); } return(pk.Gender); }
private bool IsValidGenderPID(LegalityAnalysis data) { var pkm = data.pkm; bool genderValid = pkm.IsGenderValid(); if (!genderValid) { if (pkm.Format == 4 && pkm.Species == 292) // Shedinja glitch { // should match original gender var gender = PKX.GetGenderFromPIDAndRatio(pkm.PID, 0x7F); // 50M-50F if (gender == pkm.Gender) { return(true); } } else if (pkm.Format > 5 && (pkm.Species == 183 || pkm.Species == 184)) // Azurill/Marill Gender Ratio Change { var gv = pkm.PID & 0xFF; if (gv > 63 && pkm.Gender == 1) // evolved from azurill after transferring to keep gender { return(true); } } return(false); } // check for mixed->fixed gender incompatibility by checking the gender of the original species var EncounterMatch = data.EncounterMatch; if (Legal.FixedGenderFromBiGender.Contains(EncounterMatch.Species) && pkm.Gender != 2) // shedinja { var gender = PKX.GetGenderFromPID(EncounterMatch.Species, pkm.EncryptionConstant); if (gender != pkm.Gender) // gender must not be different from original { return(false); } } return(true); }
private static bool IsAzurillEdgeCaseM(PKM pk, uint nature, uint oldpid) { // check for Azurill evolution edge case... 75% F-M is now 50% F-M; was this a F->M bend? int spec = pk.Species; if (spec != (int)Species.Marill && spec != (int)Species.Azumarill) { return(false); } const int AzurillGenderRatio = 0xBF; var gender = PKX.GetGenderFromPIDAndRatio(pk.PID, AzurillGenderRatio); if (gender != 1) { return(false); } var pid = PIDGenerator.GetPokeWalkerPID(pk.TID, pk.SID, nature, 1, AzurillGenderRatio); return(pid == oldpid); }