コード例 #1
0
        /// <summary>
        /// Initializes the <see cref="RandSpec"/> according to the provided settings.
        /// </summary>
        /// <param name="settings">General settings</param>
        /// <param name="banlist">Optional extra: banned species</param>
        public void Initialize(SpeciesSettings settings, params int[] banlist)
        {
            s = settings;
            var list = s.GetSpecies(Game.MaxSpeciesID, Game.Generation).Except(banlist);

            RandSpec = new GenericRandomizer(list.ToArray());
        }
コード例 #2
0
ファイル: SpeciesRandomizer.cs プロジェクト: wooddice/pkNX
        /// <summary>
        /// Initializes the <see cref="RandSpec"/> according to the provided settings.
        /// </summary>
        /// <param name="settings"></param>
        public void Initialize(SpeciesSettings settings)
        {
            s = settings;
            var list = s.GetSpecies(Game.MaxSpeciesID, Game.Generation);

            RandSpec = new GenericRandomizer(list);
        }
コード例 #3
0
ファイル: TrainerRandomizer.cs プロジェクト: jmmontem/pkNX
        private void UpdatePKMFromSettings(TrainerPoke pk)
        {
            if (Settings.AllowRandomHeldItems)
            {
                pk.HeldItem = PossibleHeldItems[Util.Random.Next(PossibleHeldItems.Length)];
            }
            if (Settings.BoostLevel)
            {
                BoostLevel(pk, Settings.LevelBoostRatio);
            }
            if (Settings.RandomShinies)
            {
                pk.Shiny = Util.Random.Next(0, 100 + 1) < Settings.ShinyChance;
            }
            if (Settings.RandomAbilities)
            {
                pk.Ability = Util.Random.Next(1, 4); // 1, 2, or H
            }
            if (Settings.MaxIVs)
            {
                pk.IVs = new[] { 31, 31, 31, 31, 31, 31 }
            }
            ;

            TryForceEvolve(pk);

            // Gen 8 settings
            if (pk is TrainerPoke8 c)
            {
                if (Settings.GigantamaxSwap && c.CanGigantamax)
                {
                    // only allow Gigantamax Forms per the user's species settings
                    var species             = SpecSettings.GetSpecies(Info.MaxSpeciesID, Info.Generation);
                    var AllowedGigantamaxes = species.Intersect(GigantamaxForms).ToArray();

                    if (AllowedGigantamaxes.Length == 0) // return if the user's settings make it to where no gmax fits the criteria
                    {
                        return;
                    }

                    c.Species = AllowedGigantamaxes[Util.Random.Next(AllowedGigantamaxes.Length)];
                    c.Form    = c.Species == (int)Species.Pikachu || c.Species == (int)Species.Meowth ? 0 : RandForm.GetRandomForme(c.Species, false, false, false, false, Personal.Table); // Pikachu & Meowth altforms can't gmax
                }
                if (Settings.MaxDynamaxLevel && c.CanDynamax)
                {
                    c.DynamaxLevel = 10;
                }
            }

            RandomizeEntryMoves(pk);
        }