Exemple #1
0
        /// <summary>Returns a random <see cref="PBEGender"/> for the given <paramref name="genderRatio"/>.</summary>
        /// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="genderRatio"/> is invalid.</exception>
        public static PBEGender RandomGender(PBEGenderRatio genderRatio)
        {
            switch (genderRatio)
            {
            case PBEGenderRatio.M7_F1: return(RandomBool(875, 1000) ? PBEGender.Male : PBEGender.Female);

            case PBEGenderRatio.M3_F1: return(RandomBool(750, 1000) ? PBEGender.Male : PBEGender.Female);

            case PBEGenderRatio.M1_F1: return(RandomBool(500, 1000) ? PBEGender.Male : PBEGender.Female);

            case PBEGenderRatio.M1_F3: return(RandomBool(250, 1000) ? PBEGender.Male : PBEGender.Female);

            case PBEGenderRatio.M0_F1: return(PBEGender.Female);

            case PBEGenderRatio.M0_F0: return(PBEGender.Genderless);

            case PBEGenderRatio.M1_F0: return(PBEGender.Male);

            default: throw new ArgumentOutOfRangeException(nameof(genderRatio));
            }
        }
Exemple #2
0
 public BaseStats(JToken j)
 {
     HP             = j[nameof(HP)].Value <byte>();
     Attack         = j[nameof(Attack)].Value <byte>();
     Defense        = j[nameof(Defense)].Value <byte>();
     SpAttack       = j[nameof(SpAttack)].Value <byte>();
     SpDefense      = j[nameof(SpDefense)].Value <byte>();
     Speed          = j[nameof(Speed)].Value <byte>();
     Type1          = j[nameof(Type1)].ReadEnumValue <PBEType>();
     Type2          = j[nameof(Type2)].ReadEnumValue <PBEType>();
     CatchRate      = j[nameof(CatchRate)].Value <byte>();
     BaseFriendship = j[nameof(BaseFriendship)].Value <byte>();
     EggCycles      = j[nameof(EggCycles)].Value <byte>();
     GenderRatio    = j[nameof(GenderRatio)].ReadEnumValue <PBEGenderRatio>();
     GrowthRate     = j[nameof(GrowthRate)].ReadEnumValue <PBEGrowthRate>();
     BaseEXPYield   = j[nameof(BaseEXPYield)].Value <ushort>();
     EggGroup1      = j[nameof(EggGroup1)].ReadEnumValue <EggGroup>();
     EggGroup2      = j[nameof(EggGroup2)].ReadEnumValue <EggGroup>();
     Ability1       = j[nameof(Ability1)].ReadEnumValue <PBEAbility>();
     Ability2       = j[nameof(Ability2)].ReadEnumValue <PBEAbility>();
     AbilityH       = j[nameof(AbilityH)].ReadEnumValue <PBEAbility>();
     FleeRate       = j[nameof(FleeRate)].Value <byte>();
     Weight         = j[nameof(Weight)].Value <double>();
 }