private void RandomizeTable7(EncounterTable Table, int slotStart, int slotStop)
        {
            int end = slotStop < 0 ? Table.Encounter7s.Length : slotStop;

            for (int s = slotStart; s < end; s++)
            {
                var EncounterSet = Table.Encounter7s[s];
                foreach (var enc in EncounterSet.Where(enc => enc.Species != 0))
                {
                    enc.Species = (uint)RandSpec.GetRandomSpecies((int)enc.Species);
                    enc.Forme   = (uint)RandForm.GetRandomForme((int)enc.Species);
                }
            }
        }
Пример #2
0
        private void RandomizeSpecForm(TrainerPoke7b pk, int type)
        {
            bool isMega = pk.MegaFormChoice != 0;

            if (isMega)
            {
                int[] mega = GetRandomMega(MegaDictionary, out int species);
                pk.Species        = species;
                pk.CanMegaEvolve  = true;
                pk.MegaFormChoice = Util.Random.Next(mega.Length) + 1;
                pk.Form           = 0; // allow it to Mega Evolve naturally
                return;
            }

            pk.Species = RandSpec.GetRandomSpeciesType(pk.Species, type);
            pk.Form    = RandForm.GetRandomForme(pk.Species, Settings.AllowRandomMegaForms, Settings.AllowRandomFusions, true, false, Personal.Table);
        }
Пример #3
0
        private void RandomizeSpecFormItem(IPokeData pk, int Type)
        {
            if (pk is TrainerPoke7b p7b)
            {
                RandomizeSpecForm(p7b, Type);
                return;
            }

            // replaces Megas with another Mega (Dexio and Lysandre in USUM)
            if (MegaDictionary.Any(z => z.Value.Contains(pk.HeldItem)))
            {
                int[] mega = GetRandomMega(MegaDictionary, out int species);
                pk.Species = species;
                int index = Util.Random.Next(mega.Length);
                pk.HeldItem = mega[index];
                pk.Form     = 0; // allow it to Mega Evolve naturally
            }
            else // every other pkm
            {
                pk.Species = RandSpec.GetRandomSpeciesType(pk.Species, Type);
                pk.Form    = RandForm.GetRandomForme(pk.Species, Settings.AllowRandomMegaForms, Settings.AllowRandomFusions, true, true, Personal.Table);
            }
        }
Пример #4
0
        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);
        }