Пример #1
0
        private void UpdatePKMFromSettings(TrainerPoke pk)
        {
            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 = (int)Util.Rand32() % 4;
            }
            if (Settings.MaxIVs)
            {
                pk.IVs = new[] { 31, 31, 31, 31, 31, 31 }
            }
            ;
            if (Settings.MaxDynamaxLevel && pk is TrainerPoke8 c && c.DynamaxLevel != 0)
            {
                c.DynamaxLevel = 10;
            }

            RandomizeEntryMoves(pk);
        }
Пример #2
0
        private void RandomizeEntryMoves(TrainerPoke pk)
        {
            switch (Settings.MoveRandType)
            {
            case MoveRandType.RandomMoves:     // Random
                pk.Moves = RandMove.GetRandomMoveset(pk.Species);
                break;

            case MoveRandType.LevelUpMoves:
                pk.Moves = Learn.GetCurrentMoves(pk.Species, pk.Form, pk.Level);
                break;

            case MoveRandType.HighPowered:
                pk.Moves = Learn.GetHighPoweredMoves(pk.Species, pk.Form);
                break;

            case MoveRandType.MetronomeOnly:     // Metronome
                pk.Moves = new[] { 118, 0, 0, 0 };
                break;

            default:
                return;
            }

            // sanitize moves
            var moves = pk.Moves;

            if (RandMove.SanitizeMovesetForBannedMoves(moves, pk.Species))
            {
                pk.Moves = moves;
            }
        }
Пример #3
0
        private void PopulateFields(TrainerPoke pk)
        {
            pkm = pk.Clone();

            Stats.UpdatingFields = true;

            CB_Species.SelectedIndex = pkm.Species;
            CB_Forme.SelectedIndex   = pkm.Form;
            CB_Ability.SelectedIndex = pkm.Ability;
            CB_Nature.SelectedIndex  = pkm.Nature;
            NUD_Level.Value          = Math.Min(NUD_Level.Maximum, pkm.Level);
            CB_Item.SelectedIndex    = pkm.HeldItem;
            CHK_Shiny.Checked        = pkm.Shiny;
            CB_Gender.SelectedIndex  = pkm.Gender;

            CB_Move1.SelectedIndex = pkm.Move1;
            CB_Move2.SelectedIndex = pkm.Move2;
            CB_Move3.SelectedIndex = pkm.Move3;
            CB_Move4.SelectedIndex = pkm.Move4;

            if (pk is TrainerPoke7b b)
            {
                CHK_CanMega.Checked  = b.CanMegaEvolve;
                NUD_MegaForm.Value   = b.MegaFormChoice;
                FLP_HeldItem.Visible = FLP_Ability.Visible = false;
                NUD_Friendship.Value = b.Friendship;
            }
            else
            {
                FLP_Friendship.Visible = FLP_Mega.Visible = false;
                FLP_HeldItem.Visible   = FLP_Ability.Visible = true;
            }

            Stats.LoadStats(pk);
        }
Пример #4
0
 private static void GetQuickFiller(PictureBox pb, TrainerPoke pk)
 {
     if (pk is TrainerPoke8 c)
     {
         pb.Image = SpriteUtil.GetSprite(c.Species, c.Form, c.Gender, c.HeldItem, false, c.Shiny, c.CanGigantamax);
     }
     else
     {
         pb.Image = SpriteUtil.GetSprite(pk.Species, pk.Form, pk.Gender, pk.HeldItem, false, pk.Shiny, false);
     }
 }
Пример #5
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);
        }
Пример #6
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)
                {
                    c.Species = GigantamaxForms[Util.Random.Next(GigantamaxForms.Length)];
                    c.Form    = 0; // only Kanto Meowth can Gigantamax
                }
                if (Settings.MaxDynamaxLevel && c.CanDynamax)
                {
                    c.DynamaxLevel = 10;
                }
            }

            RandomizeEntryMoves(pk);
        }
Пример #7
0
        private void UpdatePKMFromSettings(TrainerPoke pk)
        {
            if (Settings.BoostLevel)
            {
                pk.Level = Legal.GetModifiedLevel(pk.Level, Settings.LevelBoostRatio);
            }
            if (Settings.RandomShinies)
            {
                pk.Shiny = Util.Random.Next(0, 100 + 1) < Settings.ShinyChance;
            }
            if (Settings.RandomAbilities)
            {
                pk.Ability = (int)Util.Rand32() % 4;
            }
            if (Settings.MaxIVs)
            {
                pk.IVs = new[] { 31, 31, 31, 31, 31, 31 }
            }
            ;

            RandomizeEntryMoves(pk);
        }
Пример #8
0
 private static void GetQuickFiller(PictureBox pb, TrainerPoke pk)
 {
     pb.Image = SpriteUtil.GetSprite(pk.Species, pk.Form, pk.Gender, pk.HeldItem, false, pk.Shiny);
 }
Пример #9
0
        private static void GetQuickFiller(PictureBox pb, TrainerPoke pk)
        {
            var rawImg = SpriteUtil.GetSprite(pk.Species, pk.Form, pk.Gender, pk.HeldItem, false, pk.Shiny);

            pb.Image = ImageUtil.ResizeImage((Bitmap)rawImg, pb.Width, pb.Height);
        }
Пример #10
0
        private static void GetQuickFiller(PictureBox pb, TrainerPoke pk)
        {
            var rawImg = SpriteBuilder.GetSprite(pk.Species, pk.Form, pk.Gender, pk.HeldItem, false, pk.Shiny);

            pb.Image = ImageUtil.ScaleImage((Bitmap)rawImg, 2);
        }
Пример #11
0
        private string GetTrainerString(VsTrainer Trainer)
        {
            var file = Trainer.ID;
            var tr   = Trainer.Self;
            var name = Trainer.Name;
            var team = Trainer.Team;
            var sb   = new StringBuilder();

            if (tr.Class > trClass.Length) // Klara and Avery out of bounds trclass edge case
            {
                tr.Class = 1;
            }

            // Trainer ID  --   Trainer Class  --  Trainer Name
            sb.Append(file).Append(":").Append(trClass[tr.Class]).Append(":").AppendLine(name);
            // Number of Pokemon
            sb.Append(tr.NumPokemon).AppendLine();
            for (int i = 0; i < tr.NumPokemon; i++)
            {
                TrainerPoke pk = team[i];

                // // Pokemon Shiny Disable for now
                // if (pk.Shiny)
                //     sb.Append("Shiny ");

                // Pokemon Species
                sb.Append(pk.Species).Append(":").Append(specieslist[pk.Species]);
                sb.Append(" form:").Append(pk.Form).Append(" level:").Append(pk.Level);
                sb.Append(" nature:").Append(pk.Nature).Append(" ability:").Append(pk.Ability);

                string[] moves = new string[4];

                Debug.WriteLine("I pass through ability...");

                moves[0] = pk.Move1.ToString() + "-" + movelist[pk.Move1].Replace(' ', '_');
                moves[1] = pk.Move2.ToString() + "-" + movelist[pk.Move2].Replace(' ', '_');
                moves[2] = pk.Move3.ToString() + "-" + movelist[pk.Move3].Replace(' ', '_');
                moves[3] = pk.Move4.ToString() + "-" + movelist[pk.Move4].Replace(' ', '_');

                sb.Append(" moves:").Append(string.Join("/", moves));

                Debug.WriteLine("I pass through moves...");

                var ivs = pk.IVs;
                sb.Append(" IVs:").Append(string.Join("/", ivs));

                switch (pk)
                {
                case TrainerPoke8 c:
                    sb.Append(" canDyna:").Append(c.CanDynamax);
                    sb.Append(" dynaLevel:").Append(c.DynamaxLevel);
                    sb.Append(" canGiga:").Append(c.CanGigantamax);
                    break;
                }

                Debug.WriteLine("I got to new line");

                sb.AppendLine();
            }
            return(sb.ToString());
        }