コード例 #1
0
 internal static Gender GetGender(this uint pid, GenderRatio ratio)
 {
     if (ratio == GenderRatio.Genderless)
     {
         return(Gender.Genderless);
     }
     return((pid & 0xFF) < (uint)ratio ? Gender.Female : Gender.Male);
 }
コード例 #2
0
 public static Xoroshiro128Plus GetGender(Xoroshiro128Plus rng, GenderRatio ratio, uint genderIn, out uint gender)
 {
     gender = genderIn switch
     {
         0 => ratio == GenderRatio.Genderless ? 2 : ratio == GenderRatio.Female ? 1 : ratio == GenderRatio.Male ? 0 : ((rng.NextInt(253) + 1) < (uint)ratio ? (uint)GenderType.Female : (uint)GenderType.Male),
         1 => 0,
         2 => 1,
         3 => 2,
         _ => (rng.NextInt(253) + 1) < (uint)ratio ? (uint)GenderType.Female : (uint)GenderType.Male,
     };
     return(rng);
 }
コード例 #3
0
        public BaseStats(ushort i, string n, byte h, byte atk, byte def, byte satk, byte sdef, byte spd, Types t, byte ctch, byte exp, ushort ev, GenderRatio gender, GrowthRate growth, EggGroups eg, Ability[] ab, LearnableMove[] ls, PokedexEntry pe, IEvolution[] evo = null)
        {
            id   = i;
            name = n;

            baseHP             = h;
            baseAttack         = atk;
            baseDefense        = def;
            baseSpeed          = sdef;
            baseSpecialAttack  = satk;
            baseSpecialDefense = spd;
            types       = t;
            catchRate   = ctch;
            expYield    = exp;
            evYield     = ev;
            genderRatio = gender;

            /* 0	Arceus, Buneary, Darkrai, Deoxys, Deoxys (Attack), Deoxys (Defense), Deoxys (Speed), Dialga, Genosekuto, Giratina (Altered), Giratina (Origin), Groudon, Ho-oh, Kyogre, Kyuremu, Lugia, Mewtwo, Palkia, Rayquaza, Regigigas, Reshiram, Zekrom
             * 35	Absol, Aggron, Aron, Articuno, Axew, Bagon, Banette, Baruchai, Barujiina, Beldum, Birijion, Cacnea, Cacturne, Carvanha, Chatot, Dragonair, Dragonite, Dratini, Dusclops, Dusknoir, Duskull, Entei, Fraxure, Gallade, Gardevoir, Glaceon, Haxorus, Honchkrow, Houndoom, Houndour, Jiheddo, Kerudio, Kirikizan, Kirlia, Kobaruon, Komatana, Lairon, Larvitar, Leafeon, Metagross, Metang, Misdreavus, Mismagius, Moltres, Monozu, Murkrow, Pupitar, Raikou, Ralts, Regice, Regirock, Registeel, Sableye, Salamence, Sazandora, Sharpedo, Shelgon, Shuppet, Sneasel, Suicune, Terakion, Tyranitar, Umbreon, Weavile, Zapdos, Zuruggu
             * 70	All other Pokemon
             * 90	Borutorosu, Latias, Latios, Randorosu, Torunerosu
             * 100	Ambipom, Celebi, Cresselia, Croagunk, Heatran, Jirachi, Luxio, Meroetta, Meroetta, Mew, Pachirisu, Shaymin, Shaymin (Sky), Victini
             * 140	Azelf, Blissey, Chansey, Clefable, Clefairy, Cleffa, Happiny, Lopunny, Mesprit, Uxie
             */
            if (i == 150)
            {
                baseHappiness = 0;
            }
            else if (i >= 144 && i <= 149)
            {
                baseHappiness = 35;
            }
            else if (i == 151)
            {
                baseHappiness = 100;
            }
            else
            {
                baseHappiness = 70;
            }
            growthRate = growth;
            eggGroups  = eg;
            abilities  = ab;
            learnset   = ls;
            entry      = pe;
            evolutions = evo;
        }
コード例 #4
0
        protected override async Task Context()
        {
            await base.Context();

            _newIndividual = new Individual();
            _newAgeRange   = new ParameterRange {
                ParameterName = CoreConstants.Parameters.AGE
            };
            _newWeightRange = new ParameterRange {
                ParameterName = CoreConstants.Parameters.MEAN_WEIGHT
            };

            _snapshot = await sut.MapToSnapshot(_randomPopulationSettings);

            _snapshot.ProportionOfFemales = _proportionOfFemale;

            A.CallTo(() => _parameterRangeMapper.MapToModel(_snapshot.Age, A <ParameterRangeSnapshotContext> .That.Matches(x => x.ParameterRange == _newAgeRange))).Returns(_newAgeRange);
            A.CallTo(() => _parameterRangeMapper.MapToModel(_snapshot.Weight, A <ParameterRangeSnapshotContext> .That.Matches(x => x.ParameterRange == _newWeightRange))).Returns(_newWeightRange);
            A.CallTo(() => _individualMapper.MapToModel(_snapshotIndividual, _snapshotContext)).Returns(_newIndividual);

            _mappedSettings = new RandomPopulationSettings();
            A.CallTo(() => _populationSettingsMapper.MapFrom(_newIndividual)).Returns(_mappedSettings);
            _mappedSettings.AddParameterRange(_newAgeRange);
            _mappedSettings.AddParameterRange(_newWeightRange);

            _maleRatio = new GenderRatio
            {
                Gender = _genderRepository.Male,
                Ratio  = 50
            };

            _femaleRatio = new GenderRatio
            {
                Gender = _genderRepository.Female,
                Ratio  = 50
            };

            _mappedSettings.AddGenderRatio(_maleRatio);
            _mappedSettings.AddGenderRatio(_femaleRatio);

            _snapshot.DiseaseStateParameters = null;
        }
コード例 #5
0
        protected override async Task Context()
        {
            await base.Context();

            _newIndividual = new Individual();

            _snapshot = await sut.MapToSnapshot(_randomPopulationSettings);

            _snapshot.ProportionOfFemales = null;
            A.CallTo(() => _individualMapper.MapToModel(_snapshotIndividual)).Returns(_newIndividual);

            _mappedSettings = new RandomPopulationSettings();
            A.CallTo(() => _populationSettingsMapper.MapFrom(_newIndividual)).Returns(_mappedSettings);
            _unknownGender = new GenderRatio
            {
                Gender = new Gender {
                    Id = "Gender"
                },
                Ratio = 100
            };
            _mappedSettings.AddGenderRatio(_unknownGender);
        }
コード例 #6
0
 static public bool IsFixed(this GenderRatio ratio) => ratio == GenderRatio.FemaleOnly || ratio == GenderRatio.MaleOnly || ratio == GenderRatio.Genderless;
コード例 #7
0
 public static Gender GetGender(uint genderValue, GenderRatio ratio)
 => ratio == GenderRatio.Genderless ? Gender.Genderless : (genderValue < (uint)ratio ? Gender.Female : Gender.Male);
コード例 #8
0
ファイル: BaseStats.cs プロジェクト: filialpails/Syllogomania
        public BaseStats(ushort i, string n, byte h, byte atk, byte def, byte satk, byte sdef, byte spd, Types t, byte ctch, byte exp, ushort ev, GenderRatio gender, GrowthRate growth, EggGroups eg, Ability[] ab, LearnableMove[] ls, PokedexEntry pe, IEvolution[] evo = null)
        {
            id = i;
            name = n;

            baseHP = h;
            baseAttack = atk;
            baseDefense = def;
            baseSpeed = sdef;
            baseSpecialAttack = satk;
            baseSpecialDefense = spd;
            types = t;
            catchRate = ctch;
            expYield = exp;
            evYield = ev;
            genderRatio = gender;
            /* 0	Arceus, Buneary, Darkrai, Deoxys, Deoxys (Attack), Deoxys (Defense), Deoxys (Speed), Dialga, Genosekuto, Giratina (Altered), Giratina (Origin), Groudon, Ho-oh, Kyogre, Kyuremu, Lugia, Mewtwo, Palkia, Rayquaza, Regigigas, Reshiram, Zekrom
             * 35	Absol, Aggron, Aron, Articuno, Axew, Bagon, Banette, Baruchai, Barujiina, Beldum, Birijion, Cacnea, Cacturne, Carvanha, Chatot, Dragonair, Dragonite, Dratini, Dusclops, Dusknoir, Duskull, Entei, Fraxure, Gallade, Gardevoir, Glaceon, Haxorus, Honchkrow, Houndoom, Houndour, Jiheddo, Kerudio, Kirikizan, Kirlia, Kobaruon, Komatana, Lairon, Larvitar, Leafeon, Metagross, Metang, Misdreavus, Mismagius, Moltres, Monozu, Murkrow, Pupitar, Raikou, Ralts, Regice, Regirock, Registeel, Sableye, Salamence, Sazandora, Sharpedo, Shelgon, Shuppet, Sneasel, Suicune, Terakion, Tyranitar, Umbreon, Weavile, Zapdos, Zuruggu
             * 70	All other Pokemon
             * 90	Borutorosu, Latias, Latios, Randorosu, Torunerosu
             * 100	Ambipom, Celebi, Cresselia, Croagunk, Heatran, Jirachi, Luxio, Meroetta, Meroetta, Mew, Pachirisu, Shaymin, Shaymin (Sky), Victini
             * 140	Azelf, Blissey, Chansey, Clefable, Clefairy, Cleffa, Happiny, Lopunny, Mesprit, Uxie
             */
            if (i == 150) baseHappiness = 0;
            else if (i >= 144 && i <= 149) baseHappiness = 35;
            else if (i == 151) baseHappiness = 100;
            else baseHappiness = 70;
            growthRate = growth;
            eggGroups = eg;
            abilities = ab;
            learnset = ls;
            entry = pe;
            evolutions = evo;
        }
コード例 #9
0
        public IActionResult GenderRatio(GenderRatio genderRatio)
        {
            this.dataService.DeleteGenderRatio(genderRatio.Id);

            return(this.RedirectToAction("GenderRatios", "Admin"));
        }
コード例 #10
0
        public IActionResult GenderRatio(int id)
        {
            GenderRatio model = this.dataService.GetObjectByPropertyValue <GenderRatio>("Id", id);

            return(this.View(model));
        }
コード例 #11
0
 private IEnumerable <object> reportFor(GenderRatio genderRatio)
 {
     yield return(this.ReportValue(_infoRepository.DisplayNameFor(genderRatio.Gender), string.Format("{0}%", _formatter.Format(genderRatio.Ratio))));
 }
コード例 #12
0
 internal static bool CheckGender(this uint pid, GenderRatio genderRatio, Gender fixedGender)
 => genderRatio.IsFixed() || fixedGender == Gender.Genderless || pid.GetGender(genderRatio) == fixedGender;