示例#1
0
        private void savePersonal()
        {
            pkm.HP  = Convert.ToByte(TB_BaseHP.Text);
            pkm.ATK = Convert.ToByte(TB_BaseATK.Text);
            pkm.DEF = Convert.ToByte(TB_BaseDEF.Text);
            pkm.SPE = Convert.ToByte(TB_BaseSPE.Text);
            pkm.SPA = Convert.ToByte(TB_BaseSPA.Text);
            pkm.SPD = Convert.ToByte(TB_BaseSPD.Text);

            pkm.EV_HP  = Convert.ToByte(TB_HPEVs.Text);
            pkm.EV_ATK = Convert.ToByte(TB_ATKEVs.Text);
            pkm.EV_DEF = Convert.ToByte(TB_DEFEVs.Text);
            pkm.EV_SPE = Convert.ToByte(TB_SPEEVs.Text);
            pkm.EV_SPA = Convert.ToByte(TB_SPAEVs.Text);
            pkm.EV_SPD = Convert.ToByte(TB_SPDEVs.Text);

            pkm.CatchRate = Convert.ToByte(TB_CatchRate.Text);
            pkm.EvoStage  = Convert.ToByte(TB_Stage.Text);

            pkm.Types = new[] { CB_Type1.SelectedIndex, CB_Type2.SelectedIndex };
            pkm.Items = new[] { CB_HeldItem1.SelectedIndex, CB_HeldItem2.SelectedIndex, CB_HeldItem3.SelectedIndex };

            pkm.Gender         = Convert.ToByte(TB_Gender.Text);
            pkm.HatchCycles    = Convert.ToByte(TB_HatchCycles.Text);
            pkm.BaseFriendship = Convert.ToByte(TB_Friendship.Text);
            pkm.EXPGrowth      = (byte)CB_EXPGroup.SelectedIndex;
            pkm.EggGroups      = new[] { CB_EggGroup1.SelectedIndex, CB_EggGroup2.SelectedIndex };
            pkm.Abilities      = new[] { CB_Ability1.SelectedIndex, CB_Ability2.SelectedIndex, CB_Ability3.SelectedIndex };

            pkm.FormeSprite = Convert.ToUInt16(TB_FormeSprite.Text);
            pkm.FormeCount  = Convert.ToByte(TB_FormeCount.Text);
            pkm.Color       = (byte)(Convert.ToByte(CB_Color.SelectedIndex) | (Convert.ToByte(TB_RawColor.Text) & 0xF0));
            pkm.BaseEXP     = Convert.ToUInt16(TB_BaseExp.Text);

            decimal h; decimal.TryParse(TB_Height.Text, out h);
            decimal w; decimal.TryParse(TB_Weight.Text, out w);

            pkm.Height = (int)(h * 100);
            pkm.Weight = (int)(w * 10);

            for (int i = 0; i < CLB_TM.Items.Count; i++)
            {
                pkm.TMHM[i] = CLB_TM.GetItemChecked(i);
            }

            for (int t = 0; t < CLB_MoveTutors.Items.Count; t++)
            {
                pkm.TypeTutors[t] = CLB_MoveTutors.GetItemChecked(t);
            }

            pkm.EscapeRate = Convert.ToByte(TB_CallRate.Text);
            if (Main.Config.SM)
            {
                PersonalInfoSM sm = (PersonalInfoSM)pkm;
                sm.SpecialZ_Item     = CB_ZItem.SelectedIndex;
                sm.SpecialZ_BaseMove = CB_ZBaseMove.SelectedIndex;
                sm.SpecialZ_ZMove    = CB_ZMove.SelectedIndex;
                sm.LocalVariant      = CHK_Variant.Checked;
            }
        }
示例#2
0
        private void B_ModifyAll(object sender, EventArgs e)
        {
            if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Modify all? Cannot undo.", "Double check Modification settings in the Enhancements tab.") != DialogResult.Yes)
            {
                return;
            }

            for (int i = 1; i < CB_Species.Items.Count; i++)
            {
                CB_Species.SelectedIndex = i; // Get new Species

                if (CHK_NoEV.Checked)
                {
                    for (int z = 0; z < 6; z++)
                    {
                        ev_boxes[z].Text = 0.ToString();
                    }
                }
                if (CHK_Growth.Checked)
                {
                    CB_EXPGroup.SelectedIndex = 5;
                }
                if (CHK_EXP.Checked)
                {
                    TB_BaseExp.Text = ((float)NUD_EXP.Value * (Convert.ToUInt16(TB_BaseExp.Text) / 100f)).ToString("000");
                }

                if (CHK_NoTutor.Checked)
                {
                    foreach (int tm in CLB_TM.CheckedIndices)
                    {
                        CLB_TM.SetItemCheckState(tm, CheckState.Unchecked);
                    }
                    foreach (int mt in CLB_MoveTutors.CheckedIndices)
                    {
                        CLB_MoveTutors.SetItemCheckState(mt, CheckState.Unchecked);
                    }
                    foreach (int ao in CLB_BeachTutors.CheckedIndices)
                    {
                        CLB_BeachTutors.SetItemCheckState(ao, CheckState.Unchecked);
                    }
                }

                if (CHK_QuickHatch.Checked)
                {
                    TB_HatchCycles.Text = 1.ToString();
                }
                if (CHK_CallRate.Checked)
                {
                    TB_CallRate.Text = ((int)NUD_CallRate.Value).ToString();
                }
                if (CHK_CatchRateMod.Checked)
                {
                    TB_CatchRate.Text = ((int)NUD_CatchRateMod.Value).ToString();
                }
            }
            CB_Species.SelectedIndex = 1;
            WinFormsUtil.Alert("Modified all Pokémon Personal data entries according to specification!", "Press the Dump All button to view the new Personal data!");
        }
示例#3
0
        public void SavePersonal()
        {
            var pkm = cPersonal;

            pkm.HP  = Util.ToInt32(TB_BaseHP.Text);
            pkm.ATK = Util.ToInt32(TB_BaseATK.Text);
            pkm.DEF = Util.ToInt32(TB_BaseDEF.Text);
            pkm.SPE = Util.ToInt32(TB_BaseSPE.Text);
            pkm.SPA = Util.ToInt32(TB_BaseSPA.Text);
            pkm.SPD = Util.ToInt32(TB_BaseSPD.Text);

            pkm.EV_HP  = Util.ToInt32(TB_HPEVs.Text);
            pkm.EV_ATK = Util.ToInt32(TB_ATKEVs.Text);
            pkm.EV_DEF = Util.ToInt32(TB_DEFEVs.Text);
            pkm.EV_SPE = Util.ToInt32(TB_SPEEVs.Text);
            pkm.EV_SPA = Util.ToInt32(TB_SPAEVs.Text);
            pkm.EV_SPD = Util.ToInt32(TB_SPDEVs.Text);

            pkm.CatchRate = Util.ToInt32(TB_CatchRate.Text);
            pkm.EvoStage  = Util.ToInt32(TB_Stage.Text);

            pkm.Types = new[] { CB_Type1.SelectedIndex, CB_Type2.SelectedIndex };
            pkm.Items = new[] { CB_HeldItem1.SelectedIndex, CB_HeldItem2.SelectedIndex, CB_HeldItem3.SelectedIndex };

            pkm.Gender         = Util.ToInt32(TB_Gender.Text);
            pkm.HatchCycles    = Util.ToInt32(TB_HatchCycles.Text);
            pkm.BaseFriendship = Util.ToInt32(TB_Friendship.Text);
            pkm.EXPGrowth      = (byte)CB_EXPGroup.SelectedIndex;
            pkm.EggGroups      = new[] { CB_EggGroup1.SelectedIndex, CB_EggGroup2.SelectedIndex };
            pkm.Abilities      = new[] { CB_Ability1.SelectedIndex, CB_Ability2.SelectedIndex, CB_Ability3.SelectedIndex };

            pkm.FormeSprite = Convert.ToUInt16(TB_FormeSprite.Text);
            pkm.FormeCount  = Util.ToInt32(TB_FormeCount.Text);
            pkm.Color       = (byte)(CB_Color.SelectedIndex) | (Util.ToInt32(TB_RawColor.Text) & 0xF0);
            pkm.BaseEXP     = Convert.ToUInt16(TB_BaseExp.Text);

            if (decimal.TryParse(TB_Height.Text, out decimal h))
            {
                pkm.Height = (int)(h * 100);
            }

            if (decimal.TryParse(TB_Weight.Text, out decimal w))
            {
                pkm.Weight = (int)(w * 10);
            }

            if (pkm is PersonalInfoSM sm)
            {
                pkm.EscapeRate       = Util.ToInt32(TB_CallRate.Text);
                sm.SpecialZ_Item     = CB_ZItem.SelectedIndex;
                sm.SpecialZ_BaseMove = CB_ZBaseMove.SelectedIndex;
                sm.SpecialZ_ZMove    = CB_ZMove.SelectedIndex;
                sm.LocalVariant      = CHK_Variant.Checked;
            }
            if (pkm is PersonalInfoGG gg)
            {
                gg.GoSpecies = Convert.ToUInt16(MT_GoID.Text);
            }

            for (int i = 0; i < CLB_TM.Items.Count; i++)
            {
                pkm.TMHM[i] = CLB_TM.GetItemChecked(i);
            }
        }
示例#4
0
        public void LoadPersonal(PersonalInfo pkm)
        {
            cPersonal       = pkm;
            TB_BaseHP.Text  = pkm.HP.ToString("000");
            TB_BaseATK.Text = pkm.ATK.ToString("000");
            TB_BaseDEF.Text = pkm.DEF.ToString("000");
            TB_BaseSPE.Text = pkm.SPE.ToString("000");
            TB_BaseSPA.Text = pkm.SPA.ToString("000");
            TB_BaseSPD.Text = pkm.SPD.ToString("000");
            TB_HPEVs.Text   = pkm.EV_HP.ToString("0");
            TB_ATKEVs.Text  = pkm.EV_ATK.ToString("0");
            TB_DEFEVs.Text  = pkm.EV_DEF.ToString("0");
            TB_SPEEVs.Text  = pkm.EV_SPE.ToString("0");
            TB_SPAEVs.Text  = pkm.EV_SPA.ToString("0");
            TB_SPDEVs.Text  = pkm.EV_SPD.ToString("0");

            CB_Type1.SelectedIndex = pkm.Types[0];
            CB_Type2.SelectedIndex = pkm.Types[1];

            TB_CatchRate.Text = pkm.CatchRate.ToString("000");
            TB_Stage.Text     = pkm.EvoStage.ToString("0");

            CB_HeldItem1.SelectedIndex = pkm.Items[0];
            CB_HeldItem2.SelectedIndex = pkm.Items[1];
            CB_HeldItem3.SelectedIndex = pkm.Items[2];

            TB_Gender.Text      = pkm.Gender.ToString("000");
            TB_HatchCycles.Text = pkm.HatchCycles.ToString("000");
            TB_Friendship.Text  = pkm.BaseFriendship.ToString("000");

            CB_EXPGroup.SelectedIndex = pkm.EXPGrowth;

            CB_EggGroup1.SelectedIndex = pkm.EggGroups[0];
            CB_EggGroup2.SelectedIndex = pkm.EggGroups[1];

            CB_Ability1.SelectedIndex = pkm.Abilities[0];
            CB_Ability2.SelectedIndex = pkm.Abilities[1];
            CB_Ability3.SelectedIndex = pkm.Abilities[2];

            TB_FormeCount.Text  = pkm.FormeCount.ToString("000");
            TB_FormeSprite.Text = pkm.FormeSprite.ToString("000");

            TB_RawColor.Text       = pkm.Color.ToString("000");
            CB_Color.SelectedIndex = pkm.Color & 0xF;

            TB_BaseExp.Text = pkm.BaseEXP.ToString("000");
            TB_BST.Text     = pkm.BST.ToString("000");

            TB_Height.Text = ((decimal)pkm.Height / 100).ToString("00.00");
            TB_Weight.Text = ((decimal)pkm.Weight / 10).ToString("000.0");

            if (pkm is PersonalInfoSM sm)
            {
                TB_CallRate.Text            = sm.EscapeRate.ToString("000");
                CB_ZItem.SelectedIndex      = sm.SpecialZ_Item;
                CB_ZBaseMove.SelectedIndex  = sm.SpecialZ_BaseMove;
                CB_ZMove.SelectedIndex      = sm.SpecialZ_ZMove;
                CHK_Variant.Checked         = sm.LocalVariant;
                CHK_IsPresentInGame.Visible = false;
            }
            if (pkm is PersonalInfoGG gg)
            {
                MT_GoID.Text                = gg.GoSpecies.ToString("000");
                CHK_Variant.Checked         = gg.LocalVariant;
                CHK_IsPresentInGame.Visible = false;
            }
            if (pkm is PersonalInfoSWSH swsh)
            {
                MT_GoID.Text = swsh.SpriteIndex.ToString("000");
                CHK_IsPresentInGame.Checked = swsh.IsPresentInGame;
                CHK_Variant.Visible         = false;
            }

            for (int i = 0; i < CLB_TM.Items.Count; i++)
            {
                CLB_TM.SetItemChecked(i, pkm.TMHM[i]); // Bitflags for TM
            }
        }
        private void readInfo()
        {
            pkm = Main.SpeciesStat[entry];

            TB_BaseHP.Text  = pkm.HP.ToString("000");
            TB_BaseATK.Text = pkm.ATK.ToString("000");
            TB_BaseDEF.Text = pkm.DEF.ToString("000");
            TB_BaseSPE.Text = pkm.SPE.ToString("000");
            TB_BaseSPA.Text = pkm.SPA.ToString("000");
            TB_BaseSPD.Text = pkm.SPD.ToString("000");
            TB_HPEVs.Text   = pkm.EV_HP.ToString("0");
            TB_ATKEVs.Text  = pkm.EV_ATK.ToString("0");
            TB_DEFEVs.Text  = pkm.EV_DEF.ToString("0");
            TB_SPEEVs.Text  = pkm.EV_SPE.ToString("0");
            TB_SPAEVs.Text  = pkm.EV_SPA.ToString("0");
            TB_SPDEVs.Text  = pkm.EV_SPD.ToString("0");

            CB_Type1.SelectedIndex = pkm.Types[0];
            CB_Type2.SelectedIndex = pkm.Types[1];

            TB_CatchRate.Text = pkm.CatchRate.ToString("000");
            TB_Stage.Text     = pkm.EvoStage.ToString("0");

            CB_HeldItem1.SelectedIndex = pkm.Items[0];
            CB_HeldItem2.SelectedIndex = pkm.Items[1];
            CB_HeldItem3.SelectedIndex = pkm.Items[2];

            TB_Gender.Text      = pkm.Gender.ToString("000");
            TB_HatchCycles.Text = pkm.HatchCycles.ToString("000");
            TB_Friendship.Text  = pkm.BaseFriendship.ToString("000");

            CB_EXPGroup.SelectedIndex = pkm.EXPGrowth;

            CB_EggGroup1.SelectedIndex = pkm.EggGroups[0];
            CB_EggGroup2.SelectedIndex = pkm.EggGroups[1];

            CB_Ability1.SelectedIndex = pkm.Abilities[0];
            CB_Ability2.SelectedIndex = pkm.Abilities[1];
            CB_Ability3.SelectedIndex = pkm.Abilities[2];

            TB_FormeCount.Text  = pkm.FormeCount.ToString("000");
            TB_FormeSprite.Text = pkm.FormeSprite.ToString("000");

            TB_RawColor.Text       = pkm.Color.ToString("000");
            CB_Color.SelectedIndex = pkm.Color & 0xF;

            TB_BaseExp.Text = pkm.BaseEXP.ToString("000");
            TB_BST.Text     = pkm.BST.ToString("000");

            TB_Height.Text = ((decimal)pkm.Height / 100).ToString("00.00");
            TB_Weight.Text = ((decimal)pkm.Weight / 10).ToString("000.0");

            for (int i = 0; i < CLB_TM.Items.Count; i++)
            {
                CLB_TM.SetItemChecked(i, pkm.TMHM[i]); // Bitflags for TM
            }
            for (int i = 0; i < CLB_MoveTutors.Items.Count; i++)
            {
                CLB_MoveTutors.SetItemChecked(i, pkm.TypeTutors[i]); // Bitflags for Tutors
            }
            if (Main.Config.SM || Main.Config.USUM)
            {
                PersonalInfoSM sm = (PersonalInfoSM)pkm;
                TB_CallRate.Text           = sm.EscapeRate.ToString("000");
                CB_ZItem.SelectedIndex     = sm.SpecialZ_Item;
                CB_ZBaseMove.SelectedIndex = sm.SpecialZ_BaseMove;
                CB_ZMove.SelectedIndex     = sm.SpecialZ_ZMove;
                CHK_Variant.Checked        = sm.LocalVariant;
            }
            var special = pkm.SpecialTutors;

            if (special.Length > 0)
            {
                for (int b = 0; b < CLB_BeachTutors.Items.Count; b++)
                {
                    CLB_BeachTutors.SetItemChecked(b, special[0][b]);
                }
            }
        }
示例#6
0
        private void B_Randomize_Click(object sender, EventArgs e)
        {
            Random    rnd          = new Random();
            const int TMPercent    = 35; // Average Learnable TMs is 35.260.
            const int TutorPercent = 2;  //136 special tutor moves learnable by species in Untouched ORAS.

            ushort[] itemlist  = Main.Config.ORAS ? Legal.Pouch_Items_ORAS : Legal.Pouch_Items_XY;
            ushort[] berrylist = Legal.Pouch_Berry_XY;
            Array.Resize(ref itemlist, itemlist.Length + berrylist.Length);
            Array.Copy(berrylist, 0, itemlist, itemlist.Length - berrylist.Length, berrylist.Length);

            int itemlen = itemlist.Length;
            int abillen = CB_Ability1.Items.Count;
            int typelen = CB_Type1.Items.Count;

            for (int i = 1; i < CB_Species.Items.Count; i++)
            {
                CB_Species.SelectedIndex = i; // Get new Species

                // Fiddle with TM Learnsets
                if (CHK_TM.Checked)
                {
                    for (int t = 0; t < 100; t++)
                    {
                        CLB_TM.SetItemCheckState(t, rnd.Next(0, 100) < TMPercent ? CheckState.Checked : CheckState.Unchecked);
                    }
                }
                if (CHK_HM.Checked)
                {
                    for (int t = 100; t < CLB_TM.Items.Count; t++)
                    {
                        CLB_TM.SetItemCheckState(t, rnd.Next(0, 100) < TMPercent ? CheckState.Checked : CheckState.Unchecked);
                    }
                }
                if (CHK_Tutors.Checked)
                {
                    for (int t = 0; t < CLB_MoveTutors.Items.Count; t++)
                    {
                        CLB_MoveTutors.SetItemCheckState(t, rnd.Next(0, 100) < TutorPercent ? CheckState.Checked : CheckState.Unchecked);
                    }
                    if (Main.Config.ORAS && (CB_Species.SelectedIndex == 384 || CB_Species.SelectedIndex == 814)) //Make sure Rayquaza can learn Dragon Ascent.
                    {
                        CLB_MoveTutors.SetItemCheckState(CLB_MoveTutors.Items.Count - 1, CheckState.Checked);
                    }
                }

                // Abilities:
                if (CHK_Ability.Checked)
                {
                    ComboBox[] abils = { CB_Ability1, CB_Ability2, CB_Ability3 };
                    for (int a = 0; a < 3; a++) // Set 3 New Abilities, none being Wonder Guard (25) unless CHK_WGuard is checked.
                    {
                        int newabil = rnd.Next(1, abillen);
                        while (newabil == 25 && !CHK_WGuard.Checked)
                        {
                            newabil = rnd.Next(1, abillen);
                        }
                        if (abils[a].SelectedIndex != 25 || CHK_WGuard.Checked)
                        {
                            abils[a].SelectedIndex = newabil;
                        }
                    }
                }

                // Fiddle with Base Stats, don't muck with Shedinja.
                if (CHK_Stats.Checked)
                {
                    if (Convert.ToByte(byte_boxes[0].Text) != 1)
                    {
                        for (int z = 0; z < 6; z++)
                        {
                            if (rstat_boxes[z].Checked)
                            {
                                byte_boxes[z].Text =
                                    Math.Max(5, rnd.Next(
                                                 Math.Min(255, (int)(Convert.ToByte(byte_boxes[z].Text) * (1 - NUD_StatDev.Value / 100))),
                                                 Math.Min(255, (int)(Convert.ToByte(byte_boxes[z].Text) * (1 + NUD_StatDev.Value / 100)))
                                                 )).ToString("000");
                            }
                        }
                    }
                }
                // EV yield stays the same...

                if (CHK_CatchRate.Checked)
                {
                    TB_CatchRate.Text = rnd.Next(3, 251).ToString("000"); //Random Catch Rate between 3 and 250. Should I make this normally distributed?
                }
                if (CHK_EggGroup.Checked)
                {
                    if (rnd.Next(0, 100) < NUD_Egg.Value) // 50% chance to have either One or Two Egg Groups
                    {
                        CB_EggGroup1.SelectedIndex = CB_EggGroup2.SelectedIndex = rnd.Next(1, CB_EggGroup1.Items.Count);
                    }
                    else
                    {
                        CB_EggGroup1.SelectedIndex = rnd.Next(1, CB_EggGroup1.Items.Count);
                        CB_EggGroup2.SelectedIndex = rnd.Next(1, CB_EggGroup1.Items.Count);
                    }
                }

                // Items
                if (CHK_Item.Checked)
                {
                    CB_HeldItem1.SelectedIndex = itemlist[rnd.Next(1, itemlen)];
                    CB_HeldItem2.SelectedIndex = itemlist[rnd.Next(1, itemlen)];
                    CB_HeldItem3.SelectedIndex = itemlist[rnd.Next(1, itemlen)];
                }

                // Type
                if (CHK_Type.Checked)
                {
                    if (rnd.Next(0, 100) < NUD_TypePercent.Value) // 50% chance to have either Single or Dual Typing
                    {
                        CB_Type1.SelectedIndex = CB_Type2.SelectedIndex = rnd.Next(0, typelen);
                    }
                    else
                    {
                        CB_Type1.SelectedIndex = rnd.Next(0, typelen);
                        CB_Type2.SelectedIndex = rnd.Next(0, typelen);
                    }
                }
            }
            saveEntry();
            Util.Alert("All relevant Pokemon Personal Entries have been randomized!");
        }