Ejemplo n.º 1
0
        public PersonalEditor6(byte[][] infiles)
        {
            InitializeComponent();
            helditem_boxes = new[] { CB_HeldItem1, CB_HeldItem2, CB_HeldItem3 };
            ability_boxes  = new[] { CB_Ability1, CB_Ability2, CB_Ability3 };
            typing_boxes   = new[] { CB_Type1, CB_Type2 };
            eggGroup_boxes = new[] { CB_EggGroup1, CB_EggGroup2 };
            byte_boxes     = new[] { TB_BaseHP, TB_BaseATK, TB_BaseDEF, TB_BaseSPA, TB_BaseSPD, TB_BaseSPE, TB_Gender, TB_HatchCycles, TB_Friendship, TB_CatchRate };
            ev_boxes       = new[] { TB_HPEVs, TB_ATKEVs, TB_DEFEVs, TB_SPEEVs, TB_SPAEVs, TB_SPDEVs };
            rstat_boxes    = new[] { CHK_rHP, CHK_rATK, CHK_rDEF, CHK_rSPA, CHK_rSPD, CHK_rSPE };
            files          = infiles;

            abilities    = Main.Config.getText(TextName.AbilityNames);
            moves        = Main.Config.getText(TextName.MoveNames);
            items        = Main.Config.getText(TextName.ItemNames);
            species      = Main.Config.getText(TextName.SpeciesNames);
            types        = Main.Config.getText(TextName.Types);
            species[0]   = "---";
            abilities[0] = items[0] = moves[0] = "";
            string[][] AltForms = Main.Config.Personal.getFormList(species, Main.Config.MaxSpeciesID);
            species = Main.Config.Personal.getPersonalEntryList(AltForms, species, Main.Config.MaxSpeciesID, out baseForms, out formVal);
            TMHMEditor6.getTMHMList(Main.Config.ORAS, out TMs, out HMs);

            Setup(); //Turn string resources into arrays
            CB_Species.SelectedIndex = 1;
            RandSettings.GetFormSettings(this, TP_Randomizer.Controls);
        }
Ejemplo n.º 2
0
        private void B_RandAll_Click(object sender, EventArgs e)
        {
            ushort[] HMs = { 15, 19, 57, 70, 127, 249, 291 };
            ushort[] TMs = { };
            if (CHK_HMs.Checked && Main.ExeFSPath != null)
            {
                TMHMEditor6.getTMHMList(Main.Config.ORAS, ref TMs, ref HMs);
            }

            List <int> banned = new List <int> {
                165, 621
            };                                             // Struggle, Hyperspace Fury

            if (!CHK_HMs.Checked)
            {
                banned.AddRange(HMs.Select(z => (int)z));
            }

            setList();
            var sets = files.Select(z => new EggMoves6(z)).ToArray();
            var rand = new EggMoveRandomizer(Main.Config, sets)
            {
                Expand       = CHK_Expand.Checked,
                ExpandTo     = (int)NUD_Moves.Value,
                STAB         = CHK_STAB.Checked,
                rSTABPercent = NUD_STAB.Value,
                BannedMoves  = banned.ToArray()
            };

            rand.Execute();
            sets.Select(z => z.Write()).ToArray().CopyTo(files, 0);
            getList();
            WinFormsUtil.Alert("All Pokémon's Egg Moves have been randomized!");
        }
Ejemplo n.º 3
0
        private void B_RandAll_Click(object sender, EventArgs e)
        {
            ushort[] HMs = { 15, 19, 57, 70, 127, 249, 291 };
            ushort[] TMs = {};
            if (CHK_HMs.Checked && Main.ExeFSPath != null)
            {
                TMHMEditor6.getTMHMList(Main.Config.ORAS, out TMs, out HMs);
            }

            List <int> banned = new List <int> {
                165, 621
            };                                           // Struggle, Hyperspace Fury

            if (!CHK_HMs.Checked)
            {
                banned.AddRange(HMs.Select(z => (int)z));
            }
            if (CHK_NoFixedDamage.Checked)
            {
                banned.AddRange(MoveRandomizer.FixedDamageMoves);
            }

            setList();
            var sets = files.Select(z => new Learnset6(z)).ToArray();
            var rand = new LearnsetRandomizer(Main.Config, sets)
            {
                Expand       = CHK_Expand.Checked,
                ExpandTo     = (int)NUD_Moves.Value,
                Spread       = CHK_Spread.Checked,
                SpreadTo     = (int)NUD_Level.Value,
                STAB         = CHK_STAB.Checked,
                rSTABPercent = NUD_STAB.Value,
                STABFirst    = CHK_STAB.Checked,
                BannedMoves  = banned.ToArray(),
                Learn4Level1 = CHK_4MovesLvl1.Checked,
            };

            rand.Execute();
            sets.Select(z => z.Write()).ToArray().CopyTo(files, 0);
            getList();
            WinFormsUtil.Alert("All Pokémon's Level Up Moves have been randomized!", "Press the Dump button to see the new Level Up Moves!");
        }
Ejemplo n.º 4
0
        private void B_RandAll_Click(object sender, EventArgs e)
        {
            /*
             * 3111 Egg Moves Learned by 290 Species (10.73 avg)
             * 18 is the most
             * 1000 moves learned were STAB (32.1%)
             */
            Random rnd = new Random();

            ushort[] HMs = { 15, 19, 57, 70, 127, 249, 291 };
            ushort[] TMs = { };
            if (CHK_HMs.Checked && Main.ExeFSPath != null)
            {
                TMHMEditor6.getTMHMList(Main.Config.ORAS, ref TMs, ref HMs);
            }

            int[] banned = new int[HMs.Length];
            for (int i = 0; i < banned.Length; i++)
            {
                banned[i] = HMs[i];
            }
            banned = banned.Concat(new[] { 165, 621 }).ToArray(); // Struggle, Hyperspace Fury

            // Move Stats
            Move[] moveTypes = Main.Config.Moves;

            // Personal Stats

            // Set up Randomized Moves
            int[] randomMoves = Enumerable.Range(1, movelist.Length - 1).Select(i => i).ToArray();
            Util.Shuffle(randomMoves);
            int ctr = 0;

            for (int i = 0; i < CB_Species.Items.Count; i++)
            {
                CB_Species.SelectedIndex = i; // Get new Species
                int count   = dgv.Rows.Count - 1;
                int species = Util.getIndex(CB_Species);
                if (count == 0)
                {
                    continue;
                }

                if (CHK_Expand.Checked && (int)NUD_Moves.Value > count)
                {
                    dgv.Rows.AddCopies(count, (int)NUD_Moves.Value - count);
                }
                for (int j = 0; j < dgv.Rows.Count - 1; j++)
                {
                    // Assign New Moves
                    bool forceSTAB = CHK_STAB.Checked && rnd.Next(0, 99) < NUD_STAB.Value;
                    int  move      = Randomizer.getRandomSpecies(ref randomMoves, ref ctr);
                    while (           // Move is invalid
                        (!CHK_HMs.Checked && banned.Contains(move)) || // HM Moves Not Allowed
                        (forceSTAB && // STAB is required
                         !Main.Config.Personal[species].Types.Contains(moveTypes[move].Type))
                        )
                    {
                        move = Randomizer.getRandomSpecies(ref randomMoves, ref ctr);
                    }

                    // Assign Move
                    dgv.Rows[j].Cells[0].Value = movelist[move];
                }
            }
            CB_Species.SelectedIndex = 0;
            Util.Alert("All Pokemon's Egg Moves have been randomized!");
        }
Ejemplo n.º 5
0
        private void Setup()
        {
            ushort[] TMs = new ushort[0];
            ushort[] HMs = new ushort[0];
            TMHMEditor6.getTMHMList(Main.Config.ORAS, ref TMs, ref HMs);
            CLB_TMHM.Items.Clear();
            int hmcount = Main.Config.ORAS ? 7 : 5;

            if (TMs.Length == 0) // No ExeFS to grab TMs from.
            {
                for (int i = 1; i <= 100; i++)
                {
                    CLB_TMHM.Items.Add($"TM{i:00}");
                }
                for (int i = 1; i <= hmcount; i++)
                {
                    CLB_TMHM.Items.Add($"HM{i:00}");
                }
            }
            else // Use TMHM moves.
            {
                for (int i = 1; i <= 100; i++)
                {
                    CLB_TMHM.Items.Add($"TM{i:00} {moves[TMs[i - 1]]}");
                }
                for (int i = 1; i <= hmcount; i++)
                {
                    CLB_TMHM.Items.Add($"HM{i:00} {moves[HMs[i - 1]]}");
                }
            }
            for (int i = 0; i < tutormoves.Length - 1; i++)
            {
                CLB_MoveTutors.Items.Add(moves[tutormoves[i]]);
            }

            if (mode == "XY")
            {
                string[] temp_items = new string[718]; // 719 items in XY
                Array.Copy(items, temp_items, temp_items.Length);
                items = temp_items;

                string[] temp_moves = new string[moves.Length - 4]; // 4 new moves added in ORAS
                Array.Copy(moves, temp_moves, temp_moves.Length);
                moves = temp_moves;

                string[] temp_species = new string[799]; // 799 species in XY
                Array.Copy(species, temp_species, temp_species.Length);
                species = temp_species;

                CLB_OrasTutors.Visible       =
                    CLB_OrasTutors.Enabled   =
                        L_ORASTutors.Visible = false;
                CHK_ORASTutors.Visible       = false;
            }
            else if (mode == "ORAS")
            {
                CLB_MoveTutors.Items.Add(moves[tutormoves[tutormoves.Length - 1]]); //Dragon's Ascent
                foreach (ushort tm in tutor1)
                {
                    CLB_OrasTutors.Items.Add(moves[tm]);
                }
                foreach (ushort tm in tutor2)
                {
                    CLB_OrasTutors.Items.Add(moves[tm]);
                }
                foreach (ushort tm in tutor3)
                {
                    CLB_OrasTutors.Items.Add(moves[tm]);
                }
                foreach (ushort tm in tutor4)
                {
                    CLB_OrasTutors.Items.Add(moves[tm]);
                }

                CLB_OrasTutors.Visible       =
                    CLB_OrasTutors.Enabled   =
                        L_ORASTutors.Visible = true;
            }
            for (int i = 0; i < species.Length; i++)
            {
                CB_Species.Items.Add($"{species[i]} - {i:000}");
            }

            foreach (ComboBox cb in helditem_boxes)
            {
                foreach (string it in items)
                {
                    cb.Items.Add(it);
                }
            }

            foreach (ComboBox cb in ability_boxes)
            {
                foreach (string ab in abilities)
                {
                    cb.Items.Add(ab);
                }
            }

            foreach (ComboBox cb in typing_boxes)
            {
                foreach (string ty in types)
                {
                    cb.Items.Add(ty);
                }
            }

            foreach (ComboBox cb in eggGroup_boxes)
            {
                foreach (string eg in eggGroups)
                {
                    cb.Items.Add(eg);
                }
            }

            foreach (string co in colors)
            {
                CB_Color.Items.Add(co);
            }

            foreach (string eg in EXPGroups)
            {
                CB_EXPGroup.Items.Add(eg);
            }
        }
Ejemplo n.º 6
0
        private void B_RandAll_Click(object sender, EventArgs e)
        {
            // ORAS: 10682 moves learned on levelup/birth.
            // 5593 are STAB. 52.3% are STAB.
            // Steelix learns the most @ 25 (so many level 1)!
            // Move relearner ingame does not behave properly if the count exceeds 25:
            // https://twitter.com/Drayano60/status/630044237883666433
            Random rnd = new Random();

            int[] firstMoves = { 1, 40, 52, 55, 64, 71, 84, 98, 122, 141 };
            // Pound, Poison Sting, Ember, Water Gun, Peck, Absorb, Thunder Shock, Quick Attack, Lick, Leech Life

            ushort[] HMs = { 15, 19, 57, 70, 127, 249, 291 };
            ushort[] TMs = {};
            if (CHK_HMs.Checked && Main.ExeFSPath != null)
            {
                TMHMEditor6.getTMHMList(Main.Config.ORAS, ref TMs, ref HMs);
            }

            int[] banned = new int[HMs.Length];
            for (int i = 0; i < banned.Length; i++)
            {
                banned[i] = HMs[i];
            }
            banned = banned.Concat(new[] { 165, 621 }).ToArray(); // Struggle, Hyperspace Fury

            // Move Stats
            Move[] moveTypes = Main.Config.Moves;

            // Set up Randomized Moves
            int[] randomMoves = Enumerable.Range(1, movelist.Length - 1).Select(i => i).ToArray();
            Util.Shuffle(randomMoves);
            int ctr = 0;

            for (int i = 0; i < CB_Species.Items.Count; i++)
            {
                CB_Species.SelectedIndex = i; // Get new Species
                int count   = dgv.Rows.Count - 1;
                int species = WinFormsUtil.getIndex(CB_Species);
                if (CHK_Expand.Checked && (int)NUD_Moves.Value > count)
                {
                    dgv.Rows.AddCopies(count, (int)NUD_Moves.Value - count);
                }

                // Default First Move
                dgv.Rows[0].Cells[0].Value = 1;
                dgv.Rows[0].Cells[1].Value = movelist[firstMoves[rnd.Next(0, firstMoves.Length)]];
                for (int j = 1; j < dgv.Rows.Count - 1; j++)
                {
                    // Assign New Moves
                    bool forceSTAB = CHK_STAB.Checked && rnd.Next(0, 99) < NUD_STAB.Value;
                    int  move      = Randomizer.getRandomSpecies(ref randomMoves, ref ctr);
                    while (          // Move is invalid
                        !CHK_HMs.Checked && banned.Contains(move) || // HM Moves Not Allowed
                        forceSTAB && // STAB is required
                        !Main.Config.Personal[species].Types.Contains(moveTypes[move].Type))
                    {
                        move = Randomizer.getRandomSpecies(ref randomMoves, ref ctr);
                    }

                    // Assign Move
                    dgv.Rows[j].Cells[1].Value = movelist[move];
                    // Assign Level
                    if (j >= count)
                    {
                        string level = (dgv.Rows[count - 1].Cells[0].Value ?? 0).ToString();
                        ushort lv;
                        ushort.TryParse(level, out lv);
                        if (lv > 100)
                        {
                            lv = 100;
                        }
                        else if (lv == 0)
                        {
                            lv = 1;
                        }
                        dgv.Rows[j].Cells[0].Value = lv + (j - count) + 1;
                    }
                    if (CHK_Spread.Checked)
                    {
                        dgv.Rows[j].Cells[0].Value = ((int)(j * (NUD_Level.Value / (dgv.Rows.Count - 1)))).ToString();
                    }
                }
            }
            CB_Species.SelectedIndex = 0;
            WinFormsUtil.Alert("All Pokemon's Level Up Moves have been randomized!");
        }