Beispiel #1
0
 public GenderDecision( MonsterGender g, MonsterInfo t )
 {
     ExpectedGender = g;
     TypeGenderByte = t.Gender;
 }
Beispiel #2
0
        private uint GenerateRandom(MonsterGender gender, bool isShiny, short ability)
        {
            Generate:
            var random = new MersenneTwisterRandom();
            var thirtyBits = (uint) random.Next(1 << 30);
            var twoBits = (uint) random.Next(1 << 2);
            var result = (thirtyBits << 2) | twoBits;

            Check:
            var Gender = StaticData.MaleRate < 0.0f ? MonsterGender.Genderless : (result % 256 < (byte) (StaticData.MaleRate * byte.MaxValue) ? MonsterGender.Male : MonsterGender.Female);
            var FirstAbility = (result / 65536 % 2) == 0;
            var IsShiny = (result % 65536) < 16;

            if(gender != Gender || ((ability == StaticData.Abilities.Ability_0.Id) != FirstAbility) || isShiny != IsShiny)
                goto Generate;

            return result;
        }
Beispiel #3
0
 public GenderDecision( MonsterGender g, uint index )
     : this(g, MonsterList.Get( index ))
 {
 }
Beispiel #4
0
        public MonsterInstanceData(short species, MonsterGender gender, bool isShiny, short ability, byte nature)
        {
            StaticData = MonsterStaticData.LoadStaticDataPokeApiV2(species).Result;

            Species = species;
            PersonalityValue = StaticData.Abilities.Contains(ability) ? GenerateRandom(gender, isShiny, ability) : 0;
            Nature = nature;
        }