public static void SetRandomWildPID(PKM pk, int gen, int nature, int ability, int gender, PIDType specific = PIDType.None) { if (specific == PIDType.Pokewalker) { pk.Gender = gender; do { pk.PID = GetPokeWalkerPID(pk.TID, pk.SID, (uint)nature, gender, pk.PersonalInfo.Gender); } while (!pk.IsGenderValid()); pk.RefreshAbility((int)(pk.PID & 1)); SetRandomIVs(pk); return; } switch (gen) { case 3: case 4: SetRandomWildPID4(pk, nature, ability, gender, specific); break; case 5: SetRandomWildPID5(pk, nature, ability, gender, specific); break; default: SetRandomWildPID(pk, nature, ability, gender); break; } }
/// <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); }