Exemple #1
0
        private void GenerateData_Click(object sender, EventArgs e)
        {
            if (seedBox.Text.Length == 0)
            {
                return;
            }
            ulong        start_seed   = ulong.Parse(seedBox.Text, System.Globalization.NumberStyles.HexNumber);
            uint         start_frame  = uint.Parse(startFrame.Text);
            uint         end_frame    = uint.Parse(endFrame.Text);
            ulong        current_seed = Advance(start_seed, start_frame);
            RaidTemplate pkmn         = (RaidTemplate)((ComboboxItem)speciesList.SelectedItem).Value;

            raidContent.Rows.Clear();
            var rows = new List <DataGridViewRow>();

            ((ISupportInitialize)raidContent).BeginInit();
            for (uint current_frame = start_frame; current_frame <= start_frame + end_frame; current_frame++, current_seed += XOROSHIRO.XOROSHIRO_CONST)
            {
                RaidPKM res = pkmn.ConvertToPKM(current_seed, 0, 0);
                var     row = CreateRaidRow(current_frame, res, GameStrings, current_seed);
                rows.Add(row);
            }
            raidContent.Rows.AddRange(rows.ToArray());
            // Double buffering can make DGV slow in remote desktop
            if (!SystemInformation.TerminalServerSession)
            {
                raidContent.DoubleBuffered(true);
            }
            ((ISupportInitialize)raidContent).EndInit();
            //raidContent
        }
Exemple #2
0
            public Pokemon(RaidTemplate entry, int rank)
            {
                Rank = rank;

                int     rawSpecies = entry.Species;
                decimal altForm    = entry.AltForm;

                DisplaySpecies = rawSpecies;

                // マホイップ、カラナクシ、トリトドンは無視
                if (rawSpecies == 869 || rawSpecies == 422 || rawSpecies == 423)
                {
                    altForm = 0;
                }
                // FCロトムは全て1に
                else if (rawSpecies == 479)
                {
                    if (altForm != 0)
                    {
                        altForm = 1;
                    }
                }

                // ダルマッカ
                if (rawSpecies == 554)
                {
                    CalcSpecies = 993;
                }
                else
                {
                    CalcSpecies = rawSpecies + altForm / 10m;
                }

                // ガラル表示は省略
                if (c_GalarForms.ContainsKey(rawSpecies))
                {
                    DisplaySpecies = rawSpecies;
                }
                else
                {
                    DisplaySpecies = rawSpecies + altForm / 10m;
                }

                FlawlessIvs  = entry.FlawlessIVs;
                IsGigantamax = entry.IsGigantamax;
                Ability      = entry.Ability;
                // レイドデータで固定されているのはイエッサン、ニャオニクス、エンニュートのみ
                // ♂のみ:バルキー系、エルレイド、ナゲキ、ダゲキ、ウォーグル系、オーロンゲ系
                // ♀のみ:ビークイン、ユキメノコ、バルジーナ系、アマージョ系、ブリムオン系、マホイップ系
                if (c_FixedGender.ContainsKey(rawSpecies))
                {
                    IsFixedGender = true;
                }
                else
                {
                    IsFixedGender = (entry.Gender != 0);
                }

                RefreshKey();
            }
Exemple #3
0
 public void Merge(RaidTemplate entry)
 {
     // 夢特性固定があれば上書き
     if (entry.Ability == 2)
     {
         Ability = 2;
     }
 }
        public IVCalculator(PKHeX.Core.GameStrings gameStrings, RaidTemplate raidInfo, NumericUpDown hP1, NumericUpDown aTK1, NumericUpDown dEF1, NumericUpDown sPA1, NumericUpDown sPD1, NumericUpDown sPE1, ComboBox cB_Nature)
        {
            InitializeComponent();
            CB_Nature.Items.Clear();
            for (int i = 0; i < gameStrings.natures.Length; i++)
            {
                CB_Nature.Items.Add(new ComboboxItem(gameStrings.natures[i], i));
            }
            CB_Nature.SelectedIndex = cB_Nature.SelectedIndex;
            nature          = cB_Nature;
            this.RaidInfo   = raidInfo;
            TB_Species.Text = gameStrings.Species[raidInfo.Species];
            var baseinfo = PKHeX.Core.PersonalTable.SWSH[raidInfo.Species];

            basestats = new int[] { baseinfo.HP, baseinfo.ATK, baseinfo.DEF, baseinfo.SPA, baseinfo.SPD, baseinfo.SPE };
            minVals   = new TextBox[] { ResHP1, ResAtk1, ResDef1, ResSpa1, ResSpd1, ResSpe1 };
            maxVals   = new TextBox[] { ResHP2, ResAtk2, ResDef2, ResSpa2, ResSpd2, ResSpe2 };
            ratings   = new ComboBox[] { CB_Rating1, CB_Rating2, CB_Rating3, CB_Rating4, CB_Rating5, CB_Rating6 };
            original  = new NumericUpDown[] { hP1, aTK1, dEF1, sPA1, sPD1, sPE1 };
        }
        private void BT_Search_Click(object sender, EventArgs e)
        {
            int[]        iv1       = { -1, -1, -1, -1, -1, -1 }; // 1 low IV
            int[]        iv2       = { -1, -1, -1, -1, -1, -1 }; // 1 mid IV
            int[]        iv3       = { -1, -1, -1, -1, -1, -1 }; // 1 high IV
            int[]        iv4       = { -1, -1, -1, -1, -1, -1 }; // 2
            int[]        iv5       = { -1, -1, -1, -1, -1, -1 }; // 3
            int          flawless1 = 0;
            int          flawless2 = 0;
            int          flawless3 = 0;
            int          flawless4 = 0;
            int          flawless5 = 0;
            RaidTemplate pkmn1     = null;
            RaidTemplate pkmn2     = null;
            RaidTemplate pkmn3     = null;
            RaidTemplate pkmn4     = null;
            RaidTemplate pkmn5     = null;

            int ability1 = -1;
            int ability2 = -1;
            int ability3 = -1;
            int ability4 = -1;
            int ability5 = -1;

            int nature1 = -1;
            int nature2 = -1;
            int nature3 = -1;
            int nature4 = -1;
            int nature5 = -1;

            int characteristics1 = -1;
            int characteristics2 = -1;
            int characteristics3 = -1;
            int characteristics4 = -1;
            int characteristics5 = -1;

            int fixedIV1 = -1;
            int fixedIV2 = -1;
            int fixedIV3 = -1;
            int fixedIV4 = -1;
            int fixedIV5 = -1;

            bool noGender1 = false;
            bool noGender2 = false;
            bool noGender3 = false;
            bool noGender4 = false;
            bool noGender5 = false;

            bool HA1 = false;
            bool HA2 = false;
            bool HA3 = false;
            bool HA4 = false;
            bool HA5 = false;

            if (GB_41.Enabled)
            {
                pkmn1            = (RaidTemplate)((ComboboxItem)CB_Species[0].SelectedItem).Value;
                ability1         = CB_Ability1.SelectedIndex - 1;
                characteristics1 = CB_Characteristic1.SelectedIndex - 1;
                fixedIV1         = pkmn1.FlawlessIVs;
                nature1          = CB_Nature1.SelectedIndex;
                int Gender = PersonalTable.SWSH[pkmn1.Species].Gender;
                noGender1 = Gender == 0 || Gender > 253;
                HA1       = pkmn1.Ability == 4;
            }

            if (GB_42.Enabled)
            {
                pkmn2            = (RaidTemplate)((ComboboxItem)CB_Species[1].SelectedItem).Value;
                ability2         = CB_Ability2.SelectedIndex - 1;
                characteristics2 = CB_Characteristic2.SelectedIndex - 1;
                fixedIV2         = pkmn2.FlawlessIVs;
                nature2          = CB_Nature2.SelectedIndex;
                int Gender = PersonalTable.SWSH[pkmn2.Species].Gender;
                noGender2 = Gender == 0 || Gender > 253;
                HA2       = pkmn2.Ability == 4;
            }

            if (GB_43.Enabled)
            {
                pkmn3            = (RaidTemplate)((ComboboxItem)CB_Species[2].SelectedItem).Value;
                ability3         = CB_Ability3.SelectedIndex - 1;
                characteristics3 = CB_Characteristic3.SelectedIndex - 1;
                fixedIV3         = pkmn3.FlawlessIVs;
                nature3          = CB_Nature3.SelectedIndex;
                int Gender = PersonalTable.SWSH[pkmn3.Species].Gender;
                noGender3 = Gender == 0 || Gender > 253;
                HA3       = pkmn3.Ability == 4;
            }

            if (GB_51.Enabled)
            {
                pkmn4            = (RaidTemplate)((ComboboxItem)CB_Species[3].SelectedItem).Value;
                ability4         = CB_Ability4.SelectedIndex - 1;
                characteristics4 = CB_Characteristic4.SelectedIndex - 1;
                fixedIV4         = pkmn4.FlawlessIVs;
                nature4          = CB_Nature4.SelectedIndex;
                int Gender = PersonalTable.SWSH[pkmn4.Species].Gender;
                noGender4 = Gender == 0 || Gender > 253;
                HA4       = pkmn4.Ability == 4;
            }

            if (GB_61.Enabled)
            {
                pkmn5            = (RaidTemplate)((ComboboxItem)CB_Species[4].SelectedItem).Value;
                ability5         = CB_Ability5.SelectedIndex - 1;
                characteristics5 = CB_Characteristic5.SelectedIndex - 1;
                fixedIV5         = pkmn5.FlawlessIVs;
                nature5          = CB_Nature5.SelectedIndex;
                int Gender = PersonalTable.SWSH[pkmn5.Species].Gender;
                noGender5 = Gender == 0 || Gender > 253;
                HA5       = pkmn5.Ability == 4;
            }

            for (int i = 0; i < 6; i++)
            {
                iv1[i] = (int)NUD_Stats[i].Value;
                iv2[i] = (int)NUD_Stats[i + 6 * 1].Value;
                iv3[i] = (int)NUD_Stats[i + 6 * 2].Value;
                iv4[i] = (int)NUD_Stats[i + 6 * 3].Value;
                iv5[i] = (int)NUD_Stats[i + 6 * 4].Value;
                if (iv1[i] == 31)
                {
                    flawless1++;
                }
                if (iv2[i] == 31)
                {
                    flawless2++;
                }
                if (iv3[i] == 31)
                {
                    flawless3++;
                }
                if (iv4[i] == 31)
                {
                    flawless4++;
                }
                if (iv5[i] == 31)
                {
                    flawless5++;
                }
            }
            if (GB_41.Enabled && flawless1 < fixedIV1)
            {
                MessageBox.Show("Invalid IV for Pokémon 1.");
                return;
            }
            if (GB_42.Enabled && flawless2 < fixedIV2)
            {
                MessageBox.Show("Invalid IV for Pokémon 2.");
                return;
            }
            if (GB_43.Enabled && flawless3 < fixedIV3)
            {
                MessageBox.Show("Invalid IV for Pokémon 3.");
                return;
            }
            if (GB_51.Enabled && flawless4 < fixedIV4)
            {
                MessageBox.Show("Invalid IV for Pokémon 4.");
                return;
            }
            if (GB_51.Enabled && flawless5 < fixedIV5)
            {
                MessageBox.Show("Invalid IV for Pokémon 5.");
                return;
            }

            // sanity check characteristics
            if (characteristics1 >= 0 && iv1[iv_order[characteristics1]] != 31)
            {
                MessageBox.Show("Invalid Characteristic for Pokémon 1.");
                return;
            }
            if (characteristics2 >= 0 && iv2[iv_order[characteristics2]] != 31)
            {
                MessageBox.Show("Invalid Characteristic for Pokémon 2.");
                return;
            }
            if (characteristics3 >= 0 && iv3[iv_order[characteristics3]] != 31)
            {
                MessageBox.Show("Invalid Characteristic for Pokémon 3.");
                return;
            }
            if (characteristics4 >= 0 && iv4[iv_order[characteristics4]] != 31)
            {
                MessageBox.Show("Invalid Characteristic for Pokémon 4.");
                return;
            }
            if (characteristics5 >= 0 && iv5[iv_order[characteristics5]] != 31)
            {
                MessageBox.Show("Invalid Characteristic for Pokémon 5.");
                return;
            }
            int[] fixedIV        = { -1, -1, -1, -1, -1 };
            int[] consecutiveIVs = CheckIVs(ref fixedIV);

            if (pkmn1.FlawlessIVs == 1)
            {
                if (fixedIV[0] == -1)
                {
                    MessageBox.Show("Invalid IV for Pokémon 1.");
                    return;
                }
                SearchOneIV(fixedIV[0]);
                return;
            }

            if (consecutiveIVs[4] == -1)
            {
                MessageBox.Show("Invalid IVs for first Pokémon. Use \"Check IVs\" option to check your IVs.");
                return;
            }
            // 2+ search
            // calculate seed LSB
            int LSB        = -1;
            var candidates = new List <int>();

            candidates.AddRange(new int[] { 0, 1, 2, 3, 4, 5 });
            if (characteristics1 >= 0 && flawless1 > 1)
            {
                removeCandidates(characteristics1, iv1, ref candidates);
            }
            else
            {
                characteristics1 = -1; // ensure its -1
            }
            if (GB_42.Enabled && characteristics2 >= 0 && flawless2 > 1)
            {
                removeCandidates(characteristics2, iv2, ref candidates);
            }
            else
            {
                characteristics2 = -1; // ensure its -1
            }
            if (GB_43.Enabled && characteristics3 >= 0 && flawless3 > 1)
            {
                removeCandidates(characteristics3, iv3, ref candidates);
            }
            else
            {
                characteristics3 = -1; // ensure its -1
            }
            shiftCandidates(ref candidates);
            if (characteristics4 >= 0 && flawless4 > 1)
            {
                removeCandidates(characteristics4, iv4, ref candidates);
            }
            else
            {
                characteristics4 = -1; // ensure its -1
            }
            shiftCandidates(ref candidates);
            if (characteristics5 >= 0 && flawless5 > 1)
            {
                removeCandidates(characteristics5, iv5, ref candidates);
            }
            else
            {
                characteristics5 = -1; // ensure its -1
            }
            if (candidates.Count == 1)
            {
                LSB = 1 - candidates[0] & 1;
                characteristics1 = (candidates[0] + 4) % 6;
            }
            else
            {
                if (candidates.Count == 0)
                {
                    var result = Util.Prompt(MessageBoxButtons.YesNo, "Entered characteristics seem to be wrong. This might increase the search time. Do you want to start the search anyway?");
                    if (result == DialogResult.No)
                    {
                        return;
                    }
                }
                characteristics1 = -1;
            }

            SeedSearcher searcher = new SeedSearcher(consecutiveIVs[5] == -1 ? SeedSearcher.Mode.Star35_5 : SeedSearcher.Mode.Star35_6);

            SeedSearcher.SetSixFirstCondition(iv1[0], iv1[1], iv1[2], iv1[3], iv1[4], iv1[5], pkmn1.FlawlessIVs, ability1, nature1, characteristics1, noGender1, HA1);
            if (GB_42.Enabled)
            {
                SeedSearcher.SetSixSecondCondition(iv2[0], iv2[1], iv2[2], iv2[3], iv2[4], iv2[5], pkmn2.FlawlessIVs, ability2, nature2, characteristics2, noGender2, HA2);
            }
            else
            {
                SeedSearcher.SetSixSecondCondition(iv3[0], iv3[1], iv3[2], iv3[3], iv3[4], iv3[5], pkmn3.FlawlessIVs, ability3, nature3, characteristics3, noGender3, HA3);
            }

            SeedSearcher.SetSixThirdCondition(iv4[0], iv4[1], iv4[2], iv4[3], iv4[4], iv4[5], pkmn4.FlawlessIVs, ability4, nature4, characteristics4, noGender4, HA4);
            SeedSearcher.SetSixFourthCondition(iv5[0], iv5[1], iv5[2], iv5[3], iv5[4], iv5[5], pkmn5.FlawlessIVs, ability5, nature5, characteristics5, noGender5, HA5);
            SeedSearcher.SetSixLSB(LSB);

            if (consecutiveIVs[5] == -1)
            {
                SeedSearcher.SetTargetCondition5(consecutiveIVs[0], consecutiveIVs[1], consecutiveIVs[2], consecutiveIVs[3], consecutiveIVs[4]);
            }
            else
            {
                SeedSearcher.SetTargetCondition6(consecutiveIVs[0], consecutiveIVs[1], consecutiveIVs[2], consecutiveIVs[3], consecutiveIVs[4], consecutiveIVs[5]);
            }

            SearchImpl(searcher);
        }
        private void SearchOneIV(int flawlessIdx)
        {
            int[]        iv1       = { -1, -1, -1, -1, -1, -1 };
            int[]        iv2       = { -1, -1, -1, -1, -1, -1 };
            int[]        iv3       = { -1, -1, -1, -1, -1, -1 };
            int          flawless1 = 0;
            int          flawless2 = 0;
            int          flawless3 = 0;
            RaidTemplate pkmn1     = (RaidTemplate)((ComboboxItem)CB_Species[0].SelectedItem).Value;
            RaidTemplate pkmn2     = (RaidTemplate)((ComboboxItem)CB_Species[3].SelectedItem).Value;
            RaidTemplate pkmn3     = (RaidTemplate)((ComboboxItem)CB_Species[4].SelectedItem).Value;

            for (int i = 0; i < 6; i++)
            {
                iv1[i] = (int)NUD_Stats[i].Value;
                iv2[i] = (int)NUD_Stats[i + 6 * 3].Value;
                iv3[i] = (int)NUD_Stats[i + 6 * 4].Value;
            }

            int ability1 = CB_Ability1.SelectedIndex - 1;
            int ability2 = CB_Ability4.SelectedIndex - 1;
            int ability3 = CB_Ability5.SelectedIndex - 1;

            int characteristics1 = CB_Characteristic1.SelectedIndex - 1;
            int characteristics2 = CB_Characteristic4.SelectedIndex - 1;
            int characteristics3 = CB_Characteristic5.SelectedIndex - 1;

            // calculate seed LSB
            int LSB        = -1;
            var candidates = new List <int>();

            candidates.AddRange(new int[] { 0, 1, 2, 3, 4, 5 });
            if (characteristics1 >= 0 && flawless1 > 1)
            {
                removeCandidates(characteristics1, iv1, ref candidates);
            }
            else
            {
                characteristics1 = -1; // ensure its -1
            }
            shiftCandidates(ref candidates);
            if (characteristics2 >= 0 && flawless2 > 1)
            {
                removeCandidates(characteristics2, iv2, ref candidates);
            }
            else
            {
                characteristics2 = -1; // ensure its -1
            }
            shiftCandidates(ref candidates);
            if (characteristics3 >= 0 && flawless3 > 1)
            {
                removeCandidates(characteristics3, iv3, ref candidates);
            }
            else
            {
                characteristics3 = -1; // ensure its -1
            }
            if (candidates.Count == 1)
            {
                LSB = 1 - (candidates[0] & 1);
                characteristics1 = candidates[0];
            }
            else
            {
                if (candidates.Count == 0)
                {
                    var result = Util.Prompt(MessageBoxButtons.YesNo, "Entered characteristics seem to be wrong. This might increase the search time. Do you want to start the search anyway?");
                    if (result == DialogResult.No)
                    {
                        return;
                    }
                }
                characteristics1 = -1;
            }
            int nature1 = CB_Nature1.SelectedIndex;
            int nature2 = CB_Nature4.SelectedIndex;
            int nature3 = CB_Nature5.SelectedIndex;

            int Gender1 = PersonalTable.SWSH[pkmn1.Species].Gender;
            int Gender2 = PersonalTable.SWSH[pkmn2.Species].Gender;
            int Gender3 = PersonalTable.SWSH[pkmn3.Species].Gender;

            bool noGender1 = Gender1 == 0 || Gender1 > 253;
            bool noGender2 = Gender2 == 0 || Gender2 > 253;
            bool noGender3 = Gender3 == 0 || Gender3 > 253;

            bool HA1 = pkmn1.Ability == 4;
            bool HA2 = pkmn2.Ability == 4;
            bool HA3 = pkmn3.Ability == 4;

            SeedSearcher searcher = new SeedSearcher(SeedSearcher.Mode.Star12);

            SeedSearcher.SetFirstCondition(iv1[0], iv1[1], iv1[2], iv1[3], iv1[4], iv1[5], pkmn1.FlawlessIVs, flawlessIdx, ability1, nature1, characteristics1, noGender1, HA1);
            SeedSearcher.SetNextCondition(iv2[0], iv2[1], iv2[2], iv2[3], iv2[4], iv2[5], pkmn2.FlawlessIVs, ability2, nature2, characteristics2, noGender2, HA2);
            SeedSearcher.SetThirdCondition(iv3[0], iv3[1], iv3[2], iv3[3], iv3[4], iv3[5], pkmn3.FlawlessIVs, ability3, nature3, characteristics3, noGender3, HA3);
            SeedSearcher.SetLSB(LSB);
            SearchImpl(searcher);
        }
Exemple #7
0
        public IVCalculator(PKHeX.Core.GameStrings gameStrings, RaidTemplate raidInfo, NumericUpDown hP1, NumericUpDown aTK1, NumericUpDown dEF1, NumericUpDown sPA1, NumericUpDown sPD1, NumericUpDown sPE1, ComboBox cB_Nature
                            , NumericUpDown hP2 = null, NumericUpDown aTK2 = null, NumericUpDown dEF2 = null, NumericUpDown sPA2 = null, NumericUpDown sPD2 = null, NumericUpDown sPE2 = null)
        {
            InitializeComponent();
            CB_Nature.Items.Clear();
            for (int i = 0; i < gameStrings.natures.Length; i++)
            {
                if (raidInfo.Species == (int)PKHeX.Core.Species.Toxtricity)
                {
                    if (raidInfo.AltForm == 0)
                    {
                        if (ToxtricityAmplifiedNatures.Contains(i))
                        {
                            CB_Nature.Items.Add(new ComboboxItem(gameStrings.natures[i], i));
                        }
                    }
                    else
                    {
                        if (ToxtricityLowKeyNatures.Contains(i))
                        {
                            CB_Nature.Items.Add(new ComboboxItem(gameStrings.natures[i], i));
                        }
                    }
                }
                else
                {
                    CB_Nature.Items.Add(new ComboboxItem(gameStrings.natures[i], i));
                }
            }

            CB_Nature.SelectedIndex = 0;
            for (int i = 0; i < CB_Nature.Items.Count; i++)
            {
                if (cB_Nature.Text == CB_Nature.Items[i].ToString())
                {
                    CB_Nature.SelectedIndex = i;
                    break;
                }
            }

            nature          = cB_Nature;
            this.RaidInfo   = raidInfo;
            TB_Species.Text = gameStrings.Species[raidInfo.Species];
            PKHeX.Core.PersonalInfo baseinfo;
            if (raidInfo.Species == (int)PKHeX.Core.Species.Indeedee)
            {
                baseinfo = PKHeX.Core.PersonalTable.SWSH.GetFormeEntry(raidInfo.Species, raidInfo.Gender);
            }
            else
            {
                baseinfo = PKHeX.Core.PersonalTable.SWSH.GetFormeEntry(raidInfo.Species, raidInfo.AltForm);
            }

            //var baseinfo = PKHeX.Core.PersonalTable.SWSH[raidInfo.Species];
            basestats = new int[] { baseinfo.HP, baseinfo.ATK, baseinfo.DEF, baseinfo.SPA, baseinfo.SPD, baseinfo.SPE };
            minVals   = new TextBox[] { ResHP1, ResAtk1, ResDef1, ResSpa1, ResSpd1, ResSpe1 };
            maxVals   = new TextBox[] { ResHP2, ResAtk2, ResDef2, ResSpa2, ResSpd2, ResSpe2 };
            ratings   = new ComboBox[] { CB_Rating1, CB_Rating2, CB_Rating3, CB_Rating4, CB_Rating5, CB_Rating6 };
            if (hP2 == null)
            {
                original = new NumericUpDown[] { hP1, aTK1, dEF1, sPA1, sPD1, sPE1 };
            }
            else
            {
                original = new NumericUpDown[] { hP1, aTK1, dEF1, sPA1, sPD1, sPE1, hP2, aTK2, dEF2, sPA2, sPD2, sPE2 };
            }


            LBL_Level.Text   = Properties.strings.Level;
            LBL_Nature.Text  = Properties.strings.Nature;
            LBL_Species.Text = Properties.strings.Pokemon;
            LBL_REC.Text     = Properties.strings.RecommendedNextLevel;
            LBL_HP1.Text     = Properties.strings.HP;
            LBL_ATK1.Text    = Properties.strings.ATK;
            LBL_DEF1.Text    = Properties.strings.DEF;
            LBL_SPA1.Text    = Properties.strings.SPA;
            LBL_SPD1.Text    = Properties.strings.SPD;
            LBL_SPE1.Text    = Properties.strings.SPE;
            LBL_HP2.Text     = Properties.strings.HP;
            LBL_ATK2.Text    = Properties.strings.ATK;
            LBL_DEF2.Text    = Properties.strings.DEF;
            LBL_SPA2.Text    = Properties.strings.SPA;
            LBL_SPD2.Text    = Properties.strings.SPD;
            LBL_SPE2.Text    = Properties.strings.SPE;

            ButtonApply.Enabled = hP2 == null;
        }
Exemple #8
0
        public void Raid_Matched()
        {
            var temp = new RaidTemplate()
            {
                Zone        = "Crystallos, Lair of the Awakened",
                Name        = "Kerafyrm",
                Mobs        = new[] { "Kerafyrm the Awakened", "A wyvern assassin" },
                EndsOnDeath = new[] { "Kerafyrm the Awakened" }
            };

            var chars = new CharTracker();

            chars.GetOrAdd(PLAYER1).Type = CharType.Friend;
            chars.GetOrAdd(PLAYER2).Type = CharType.Friend;
            var tracker = new FightTracker(new SpellParser(), chars);

            tracker.HandleEvent(new LogPartyEvent {
                Status = PartyStatus.RaidJoined, Name = PLAYER1
            });
            tracker.AddTemplate(temp);
            var results = new List <FightInfo>();

            tracker.OnFightFinished += e => results.Add(e);

            // act
            var time = DateTime.Now;

            tracker.HandleEvent(new LogZoneEvent {
                Timestamp = time, Name = temp.Zone
            });
            tracker.HandleEvent(new LogHitEvent {
                Timestamp = time, Source = PLAYER1, Target = temp.Mobs[0], Amount = 100
            });
            tracker.HandleEvent(new LogHitEvent {
                Timestamp = time, Source = PLAYER2, Target = temp.Mobs[1], Amount = 20
            });
            tracker.HandleEvent(new LogHitEvent {
                Timestamp = time, Source = PLAYER2, Target = "Unrelated Mob", Amount = 30
            });
            tracker.HandleEvent(new LogDeathEvent {
                Timestamp = time, Name = temp.EndsOnDeath[0]
            });

            // assert
            var raids = results.OfType <RaidFightInfo>().ToArray();

            Assert.Single(raids);
            Assert.Equal("Kerafyrm", raids[0].Name);
            Assert.Equal("Crystallos, Lair of the Awakened", raids[0].Zone);
            Assert.Equal(2, raids[0].MobCount);
            Assert.Equal(120, raids[0].HP);
            Assert.Single(tracker.ActiveFights); // the unrelated mob


            /*
             *
             * // this should be ignored
             * var f3 = new FightInfo() { Name = "Fippy Darkpaw", Zone = "Crystallos, Lair of the Awakened", Status = FightStatus.Killed };
             * f3.Target.InboundHitSum = 20;
             * tracker.HandleFight(f3);
             *
             * // this should be included, and create a new raid
             * var f2 = new FightInfo() { Name = "A wyvern assassin", Zone = "Crystallos, Lair of the Awakened", Status = FightStatus.Killed };
             * f2.Target.InboundHitSum = 10;
             * tracker.HandleFight(f2);
             *
             * // this should finish the raid
             * var f1 = new FightInfo() { Name = "Kerafyrm the Awakened", Zone = "Crystallos, Lair of the Awakened", Status = FightStatus.Killed };
             * f1.Target.InboundHitSum = 100;
             * tracker.HandleFight(f1);
             *
             * Assert.Single(results);
             * Assert.Equal("Kerafyrm", results[0].Name);
             * Assert.Equal("Crystallos, Lair of the Awakened", results[0].Zone);
             * Assert.Equal(2, results[0].MobCount);
             * Assert.Equal(110, results[0].HP);
             *
             */
        }