/// <summary> /// Sets the <see cref="PKM.Gender"/> value, with special consideration for the <see cref="PKM.Format"/> values which derive the <see cref="PKM.Gender"/> value. /// </summary> /// <param name="pk">Pokémon to modify.</param> /// <param name="gender">Desired <see cref="PKM.Gender"/> value to set.</param> public static void SetGender(this PKM pk, int gender) { gender = Math.Min(2, Math.Max(0, gender)); if (pk.Format <= 2) { pk.SetATKIVGender(gender); } else if (pk.Format <= 5) { pk.SetPIDGender(gender); pk.Gender = gender; } else { pk.Gender = gender; } }