コード例 #1
0
        private void getList()
        {
            entry = WinFormsUtil.getIndex(CB_Species);
            int s = baseForms[entry];
            int f = formVal[entry];

            if (entry <= Main.Config.MaxSpeciesID)
            {
                s = entry;
            }
            int[]  specForm = { s, f };
            string filename = "_" + specForm[0] + (entry > Main.Config.MaxSpeciesID ? "_" + (specForm[1] + 1) : "");

            PB_MonSprite.Image = (Bitmap)Resources.ResourceManager.GetObject(filename);

            dgv.Rows.Clear();
            byte[] input = files[entry];
            if (input.Length <= 4)
            {
                files[entry] = BitConverter.GetBytes(-1); return;
            }
            pkm = new Learnset7(input);

            dgv.Rows.Add(pkm.Count);

            // Fill Entries
            for (int i = 0; i < pkm.Count; i++)
            {
                dgv.Rows[i].Cells[0].Value = pkm.Levels[i];
                dgv.Rows[i].Cells[1].Value = movelist[pkm.Moves[i]];
            }

            dgv.CancelEdit();
        }
コード例 #2
0
ファイル: EggMoveEditor6.cs プロジェクト: nichan200/pk3DS
        private void getList()
        {
            entry = WinFormsUtil.getIndex(CB_Species);

            int[]  specForm = Main.Config.Personal.getSpeciesForm(entry, Main.Config);
            string filename = "_" + specForm[0] + (entry > 721 ? "_" + (specForm[1] + 1) : "");

            PB_MonSprite.Image = (Bitmap)Resources.ResourceManager.GetObject(filename);

            dgv.Rows.Clear();
            byte[] input = files[entry];
            if (input.Length == 0)
            {
                return;
            }
            pkm = new EggMoves6(input);
            if (pkm.Count < 1)
            {
                files[entry] = new byte[0]; return;
            }
            dgv.Rows.Add(pkm.Count);

            // Fill Entries
            for (int i = 0; i < pkm.Count; i++)
            {
                dgv.Rows[i].Cells[0].Value = movelist[pkm.Moves[i]];
            }

            dgv.CancelEdit();
        }
コード例 #3
0
        private void getList()
        {
            entry = WinFormsUtil.getIndex(CB_Species);
            int s = 0, f = 0;

            if (entry <= Main.Config.MaxSpeciesID)
            {
                s = entry;
            }
            int[]  specForm = { s, f };
            string filename = "_" + specForm[0] + (entry > Main.Config.MaxSpeciesID ? "_" + (specForm[1] + 1) : "");

            PB_MonSprite.Image = (Bitmap)Resources.ResourceManager.GetObject(filename);

            dgv.Rows.Clear();
            byte[] input = files[entry];
            pkm = new EggMoves7(input);
            NUD_FormTable.Value = pkm.FormTableIndex;
            if (pkm.Count < 1)
            {
                files[entry] = new byte[0]; return;
            }
            dgv.Rows.Add(pkm.Count);

            // Fill Entries
            for (int i = 0; i < pkm.Count; i++)
            {
                dgv.Rows[i].Cells[0].Value = movelist[pkm.Moves[i]];
            }

            dgv.CancelEdit();
        }
コード例 #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();

            int[] banned = new[] { 165, 621, 464 }.Concat(Legal.Z_Moves).ToArray(); // Struggle, Hyperspace Fury, Dark Void

            // 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);
                }

                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 (banned.Contains(move) || /* Invalid */
                           forceSTAB && !Main.SpeciesStat[species].Types.Contains(moveTypes[move].Type)) // STAB is required
                    {
                        move = Randomizer.getRandomSpecies(ref randomMoves, ref ctr);
                    }

                    // Assign Move
                    dgv.Rows[j].Cells[0].Value = movelist[move];
                }
            }
            CB_Species.SelectedIndex = 0;
            WinFormsUtil.Alert("All Pokemon's Egg Up Moves have been randomized!");
        }
コード例 #5
0
 private void setEntry()
 {
     if (entry < 1 || entry == 384)
     {
         return;                            // Don't edit invalid / Rayquaza.
     }
     for (int i = 0; i < 2; i++)
     {
         if (me.Method[i] > 1)
         {
             return; // Shouldn't hit this.
         }
         me.Method[i]   = (ushort)(checkbox_spec[i].Checked ? 1 : 0);
         me.Argument[i] = (ushort)WinFormsUtil.getIndex(item_spec[i]);
         me.Form[i]     = (ushort)forme_spec[i].SelectedIndex;
     }
     files[entry] = me.Write();
 }
コード例 #6
0
        private void Update_PBs(int i)
        {
            if (!loaded)
            {
                return;
            }
            CheckBox CB = checkbox_spec[i];

            if (CB.Checked)
            {
                UpdateImage(picturebox_spec[0][i], entry, 0, WinFormsUtil.getIndex(item_spec[i]), 0);
                UpdateImage(picturebox_spec[1][i], entry, forme_spec[i].SelectedIndex, WinFormsUtil.getIndex(item_spec[i]), 0);
            }
            else
            {
                UpdateImage(picturebox_spec[0][i], 0, 0, WinFormsUtil.getIndex(item_spec[i]), 0);
                UpdateImage(picturebox_spec[1][i], 0, 0, WinFormsUtil.getIndex(item_spec[i]), 0);
            }
        }
コード例 #7
0
 private void Update_PBs(object sender, EventArgs e)
 {
     if (!loaded)
     {
         return;
     }
     for (int i = 0; i < checkbox_spec.Length; i++)
     {
         CheckBox CB = checkbox_spec[i];
         if (CB.Checked)
         {
             UpdateImage(picturebox_spec[0][i], entry, 0, WinFormsUtil.getIndex(item_spec[i]), 0);
             UpdateImage(picturebox_spec[1][i], entry, forme_spec[i].SelectedIndex, WinFormsUtil.getIndex(item_spec[i]), 0);
         }
         else
         {
             UpdateImage(picturebox_spec[0][i], 0, 0, WinFormsUtil.getIndex(item_spec[i]), 0);
             UpdateImage(picturebox_spec[1][i], 0, 0, WinFormsUtil.getIndex(item_spec[i]), 0);
         }
     }
 }
コード例 #8
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 glitch fixed (52 tested), but keep below 75:
            // https://twitter.com/Drayano60/status/807297858244411397
            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

            int[] banned = new[] { 165, 621, 464 }.Concat(Legal.Z_Moves).ToArray(); // Struggle, Hyperspace Fury, Dark Void

            // 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 (banned.Contains(move) || /* Invalid */
                           forceSTAB && !Main.SpeciesStat[species].Types.Contains(moveTypes[move].Type)) // STAB is required
                    {
                        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;
                        UInt16.TryParse(level, out lv);
                        if (lv > 100)
                        {
                            lv = 100;
                        }
                        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!");
        }
コード例 #9
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!");
        }
コード例 #10
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 = WinFormsUtil.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;
            WinFormsUtil.Alert("All Pokemon's Egg Moves have been randomized!");
        }