Ejemplo n.º 1
0
        /// <summary>
        /// 计算胜率
        /// </summary>
        /// <param name="zjkssm">自己骑士属性</param>
        /// <param name="zjcard_1">自己卡1数据</param>
        /// <param name="zjcard_2">自己卡2数据</param>
        /// <param name="zjcard_3">自己卡3数据</param>
        /// <param name="drkssm">敌人骑士属性</param>
        /// <param name="drcard_1">敌人卡1数据</param>
        /// <param name="drcard_2">敌人卡1数据</param>
        /// <param name="drcard_3">敌人卡1数据</param>
        /// <returns>胜率</returns>
        public int jisuan(kssm zjkssm, card zjcard_1, card zjcard_2, card zjcard_3, kssm drkssm, card drcard_1, card drcard_2, card drcard_3)
        {
            int shenglv = 0;
            for (int i = 0; i < 10000; i++)
            {
                int zjkssm_data1 = kssm_jisuan(zjkssm, drkssm);
                int zjkssm_data2 = kssm_jisuan(zjkssm, drkssm);
                int zjkssm_data3 = kssm_jisuan(zjkssm, drkssm);

                int zjcard_1_data1 = card_jisuan(zjcard_1, drkssm);
                int zjcard_1_data2 = card_jisuan(zjcard_1, drkssm);

                int zjcard_2_data1 = card_jisuan(zjcard_2, drkssm);
                int zjcard_2_data2 = card_jisuan(zjcard_2, drkssm);

                int zjcard_3_data1 = card_jisuan(zjcard_3, drkssm);
                int zjcard_3_data2 = card_jisuan(zjcard_3, drkssm);

                int zjdata = zjkssm_data1 + zjkssm_data2 + zjkssm_data3 +
                    zjcard_1_data1 + zjcard_1_data2 +
                    zjcard_2_data1 + zjcard_2_data2 +
                    zjcard_3_data1 + zjcard_3_data2;


                 //Console.WriteLine("第{0}轮",i+1);
                
                 //Console.WriteLine("zjkssm_data1:" + zjkssm_data1 + " zjkssm_data2:" + zjkssm_data2 + " zjkssm_data3:" + zjkssm_data3 +
                 //    " zjcard_1_data1:" + zjcard_1_data1 + " zjcard_1_data2:" + zjcard_1_data2 +
                 //    " zjcard_2_data1:" + zjcard_2_data1 + " zjcard_2_data2:" + zjcard_2_data2 +
                 //    " zjcard_3_data1:" + zjcard_3_data1 + " zjcard_3_data2:" + zjcard_3_data2);

                int drkssm_data1 = kssm_jisuan(drkssm, zjkssm);
                int drkssm_data2 = kssm_jisuan(drkssm, zjkssm);
                int drkssm_data3 = kssm_jisuan(drkssm, zjkssm);

                int drcard_1_data1 = card_jisuan(drcard_1, zjkssm);
                int drcard_1_data2 = card_jisuan(drcard_1, zjkssm);

                int drcard_2_data1 = card_jisuan(drcard_2, zjkssm);
                int drcard_2_data2 = card_jisuan(drcard_2, zjkssm);

                int drcard_3_data1 = card_jisuan(drcard_3, zjkssm);
                int drcard_3_data2 = card_jisuan(drcard_3, zjkssm);

                int drdata = drkssm_data1 + drkssm_data2 + drkssm_data3 +
                    drcard_1_data1 + drcard_1_data2 +
                    drcard_2_data1 + drcard_2_data2 +
                    drcard_3_data1 + drcard_3_data2;

                //Console.WriteLine("drkssm_data1:" + drkssm_data1 + " drkssm_data2:" + drkssm_data2 + " drkssm_data3:" + drkssm_data3 +
                //  " drcard_1_data1:" + drcard_1_data1 + " drcard_1_data2:" + drcard_1_data2 +
                //  " drcard_2_data1:" + drcard_2_data1 + " drcard_2_data2:" + drcard_2_data2 +
                //  " drcard_3_data1:" + drcard_3_data1 + " drcard_3_data2:" + drcard_3_data2+"\n");



                if (zjdata > drdata)
                {
                    shenglv++;
                }
            }


            return shenglv;
        }
Ejemplo n.º 2
0
        public void dr_chaxun_click()
        {
            #region 武器查询
            if (youshou_2.Text.ToString().IndexOf('+') == -1)
            {

                Chushihua.wuqi_name = youshou_2.Text.ToString();
                Chushihua.wuqi_qianghua = 0;
            }
            else
            {
                Chushihua.wuqi_name = youshou_2.Text.ToString().Substring(0, (youshou_2.Text.ToString().IndexOf('+') - 1));
                Chushihua.wuqi_qianghua = int.Parse(youshou_2.Text.ToString().Substring((youshou_2.Text.ToString().IndexOf('+') + 1), ((youshou_2.Text.ToString().Length - (youshou_2.Text.ToString().IndexOf('+') + 1)))));
            }

            if (Chushihua.wuqi_name != "")
            {
                if (Dict.wuqi_dict.ContainsKey(Chushihua.wuqi_name))
                {
                    Dict.wuqi_dict.TryGetValue(Chushihua.wuqi_name, out Chushihua.wuqi_duiying);
                }
                else
                {
                    //炸了
                    log_list.Items.Insert(0, DateTime.Now.ToLongTimeString().ToString() + "\t" + "武器未找到,检查是否输入错误\n如未在列表中找到,请回帖报告\n(默认按无装备替代)");

                    Dict.wuqi_dict.TryGetValue("なし", out Chushihua.wuqi_duiying);
                }
            }
            else
            {
                Dict.wuqi_dict.TryGetValue("なし", out Chushihua.wuqi_duiying);
            }
            #endregion

            #region 盾查询

            if (zuoshou_2.Text.ToString().IndexOf('+') == -1)
            {

                Chushihua.dun_name = zuoshou_2.Text.ToString();
                Chushihua.dun_qianghua = 0;
            }
            else
            {
                Chushihua.dun_name = zuoshou_2.Text.ToString().Substring(0, (zuoshou_2.Text.ToString().IndexOf('+') - 1));
                Chushihua.dun_qianghua = int.Parse(zuoshou_2.Text.ToString().Substring((zuoshou_2.Text.ToString().IndexOf('+') + 1), ((zuoshou_2.Text.ToString().Length - (zuoshou_2.Text.ToString().IndexOf('+') + 1)))));
            }


            if (Chushihua.dun_name != "")
            {
                if (Dict.dun_dict.ContainsKey(Chushihua.dun_name))
                {
                    Dict.dun_dict.TryGetValue(Chushihua.dun_name, out Chushihua.dun_duiying);
                }
                else
                {
                    log_list.Items.Insert(0, DateTime.Now.ToLongTimeString().ToString() + "\t" + "盾未找到,检查是否输入错误\n如未在列表中找到,请回帖报告\n(默认按无装备替代)");
                    Dict.dun_dict.TryGetValue("なし", out Chushihua.dun_duiying);

                }
            }
            else
            {
                Dict.dun_dict.TryGetValue("なし", out Chushihua.dun_duiying);
            }
            #endregion

            #region 衣服查询

            if (ti_2.Text.ToString().IndexOf('+') == -1)
            {

                Chushihua.yifu_name = ti_2.Text.ToString();
                Chushihua.yifu_qianghua = 0;
            }
            else
            {
                Chushihua.yifu_name = ti_2.Text.ToString().Substring(0, (ti_2.Text.ToString().IndexOf('+') - 1));
                Chushihua.yifu_qianghua = int.Parse(ti_2.Text.ToString().Substring((ti_2.Text.ToString().IndexOf('+') + 1), ((ti_2.Text.ToString().Length - (ti_2.Text.ToString().IndexOf('+') + 1)))));
            }

            if (Chushihua.yifu_name != "")
            {
                if (Dict.yifu_dict.ContainsKey(Chushihua.yifu_name))
                {
                    Dict.yifu_dict.TryGetValue(Chushihua.yifu_name, out Chushihua.yifu_duiying);
                }
                else
                {
                    log_list.Items.Insert(0, DateTime.Now.ToLongTimeString().ToString() + "\t" + "衣服未找到,检查是否输入错误\n如未在列表中找到,请回帖报告\n(默认按无装备替代)");
                    Dict.yifu_dict.TryGetValue("なし", out Chushihua.yifu_duiying);

                }
            }
            else
            {
                Dict.yifu_dict.TryGetValue("なし", out Chushihua.yifu_duiying);
            }
            #endregion

            #region 指查询

            if (zhi_2.Text.ToString().IndexOf('+') == -1)
            {

                Chushihua.zhi_name = zhi_2.Text.ToString();
                Chushihua.zhi_qianghua = 0;
            }
            else
            {
                Chushihua.zhi_name = zhi_2.Text.ToString().Substring(0, (zhi_2.Text.ToString().IndexOf('+') - 1));
                Chushihua.zhi_qianghua = int.Parse(zhi_2.Text.ToString().Substring((zhi_2.Text.ToString().IndexOf('+') + 1), ((zhi_2.Text.ToString().Length - (zhi_2.Text.ToString().IndexOf('+') + 1)))));
            }

            if (Chushihua.zhi_name != "")
            {
                if (Dict.zhi_dict.ContainsKey(Chushihua.zhi_name))
                {
                    Dict.zhi_dict.TryGetValue(Chushihua.zhi_name, out Chushihua.zhi_duiying);
                }
                else
                {
                    log_list.Items.Insert(0, DateTime.Now.ToLongTimeString().ToString() + "\t" + "戒指未找到,检查是否输入错误\n如未在列表中找到,请回帖报告\n(默认按无装备替代)");
                    Dict.zhi_dict.TryGetValue("なし", out Chushihua.zhi_duiying);

                }
            }
            else
            {
                Dict.zhi_dict.TryGetValue("なし", out Chushihua.zhi_duiying);
            }
            #endregion

            #region 首查询

            if (shou_2.Text.ToString().IndexOf('+') == -1)
            {

                Chushihua.shou_name = shou_2.Text.ToString();
                Chushihua.shou_qianghua = 0;
            }
            else
            {
                Chushihua.shou_name = shou_2.Text.ToString().Substring(0, (shou_2.Text.ToString().IndexOf('+') - 1));
                Chushihua.shou_qianghua = int.Parse(shou_2.Text.ToString().Substring((shou_2.Text.ToString().IndexOf('+') + 1), ((shou_2.Text.ToString().Length - (shou_2.Text.ToString().IndexOf('+') + 1)))));
            }

            if (Chushihua.shou_name != "")
            {
                if (Dict.shou_dict.ContainsKey(Chushihua.shou_name))
                {
                    Dict.shou_dict.TryGetValue(Chushihua.shou_name, out Chushihua.shou_duiying);
                }
                else
                {
                    log_list.Items.Insert(0, DateTime.Now.ToLongTimeString().ToString() + "\t" + "项链未找到,检查是否输入错误\n如未在列表中找到,请回帖报告\n(默认按无装备替代)");
                    Dict.shou_dict.TryGetValue("なし", out Chushihua.shou_duiying);

                }
            }
            else
            {
                Dict.shou_dict.TryGetValue("なし", out Chushihua.shou_duiying);
            }
            #endregion

            #region 卡1查询
            Chushihua.card1_name = ka1_2.Text.ToString();
            Chushihua.card1_jieduan = ka1_cb_2.SelectedIndex;
            if (Chushihua.card1_name != "")
            {
                if (Dict.card_dict.ContainsKey(Chushihua.card1_name))
                {
                    Dict.card_dict.TryGetValue(Chushihua.card1_name, out Chushihua.card1_duiying);
                }
                else
                {
                    log_list.Items.Insert(0, DateTime.Now.ToLongTimeString().ToString() + "\t" + "卡1未找到,检查是否输入错误\n如未在列表中找到,请回帖报告\n(默认按无装备替代)");
                    Dict.card_dict.TryGetValue("なし", out Chushihua.card1_duiying);
                    Chushihua.card1_jieduan = 0;
                }
            }
            else
            {
                Dict.card_dict.TryGetValue("なし", out Chushihua.card1_duiying);
                Chushihua.card1_jieduan = 0;
            }
            #endregion

            #region 卡2查询
            Chushihua.card2_name = ka2_2.Text.ToString();
            Chushihua.card2_jieduan = ka2_cb_2.SelectedIndex;
            if (Chushihua.card2_name != "")
            {
                if (Dict.card_dict.ContainsKey(Chushihua.card2_name))
                {
                    Dict.card_dict.TryGetValue(Chushihua.card2_name, out Chushihua.card2_duiying);
                }
                else
                {
                    log_list.Items.Insert(0, DateTime.Now.ToLongTimeString().ToString() + "\t" + "卡2未找到,检查是否输入错误\n如未在列表中找到,请回帖报告\n(默认按无装备替代)");
                    Dict.card_dict.TryGetValue("なし", out Chushihua.card2_duiying);
                    Chushihua.card2_jieduan = 0;
                }
            }
            else
            {
                Dict.card_dict.TryGetValue("なし", out Chushihua.card2_duiying);
                Chushihua.card2_jieduan = 0;
            }
            #endregion

            #region 卡3查询
            Chushihua.card3_name = ka3_2.Text.ToString();
            Chushihua.card3_jieduan = ka3_cb_2.SelectedIndex;
            if (Chushihua.card3_name != "")
            {
                if (Dict.card_dict.ContainsKey(Chushihua.card3_name))
                {
                    Dict.card_dict.TryGetValue(Chushihua.card3_name, out Chushihua.card3_duiying);
                }
                else
                {
                    log_list.Items.Insert(0, DateTime.Now.ToLongTimeString().ToString() + "\t" + "卡3未找到,检查是否输入错误\n如未在列表中找到,请回帖报告\n(默认按无装备替代)");
                    Dict.card_dict.TryGetValue("なし", out Chushihua.card3_duiying);
                    Chushihua.card3_jieduan = 0;
                }
            }
            else
            {
                Dict.card_dict.TryGetValue("なし", out Chushihua.card3_duiying);
                Chushihua.card3_jieduan = 0;
            }
            #endregion


            diren = kssmzhuangzai.peizhi();

            wuligongji_2.Text = "物理攻击:" + diren.wuligongji;
            mofagongji_2.Text = "魔法攻击:" + diren.mofagongji;
            wulifangyu_2.Text = "物理防御:" + diren.wulifangyu;
            mofafangyu_2.Text = "魔法防御:" + diren.mofafangyu;
            balance_2.Text = "B值:" + diren.balance;
            critical_2.Text = "C值:" + diren.critical;
            shuxing_2.Text = "属性:" + diren.shuxingzhi + " " + diren.shuxingtype;
            wulimofa_2.Text = "" + diren.kssm_wmtype;



            diren_1 = cardzhuangzai.peizhi(Chushihua.card1_duiying, Chushihua.card1_jieduan);
            diren_2 = cardzhuangzai.peizhi(Chushihua.card2_duiying, Chushihua.card2_jieduan);
            diren_3 = cardzhuangzai.peizhi(Chushihua.card3_duiying, Chushihua.card3_jieduan);

            dr_card_1.Text = "卡1:\nad" + diren_1.atk
                + "\nsd" + diren_1.sdk
                + "\n发动" + diren_1.fadong
                + "\nB值" + diren_1.balance
                + "\nC值" + diren_1.critical
                + "\n属性" + diren_1.shuxingtype + diren_1.shuxingzhi;
            dr_card_2.Text = "卡1:\nad" + diren_2.atk
                + "\nsd" + diren_2.sdk
                + "\n发动" + diren_2.fadong
                + "\nB值" + diren_2.balance
                + "\nC值" + diren_2.critical
                + "\n属性" + diren_2.shuxingtype + diren_2.shuxingzhi;
            dr_card_3.Text = "卡1:\nad" + diren_3.atk
                + "\nsd" + diren_3.sdk
                + "\n发动" + diren_3.fadong
                + "\nB值" + diren_3.balance
                + "\nC值" + diren_3.critical
                + "\n属性" + diren_3.shuxingtype + diren_3.shuxingzhi;

        }
Ejemplo n.º 3
0
        /// <summary>
        /// 卡计算
        /// </summary>
        /// <param name="zjcard">自己的卡属性</param>
        /// <param name="drkssm">敌人骑士属性</param>
        /// <returns>伤害值</returns>
        public int card_jisuan(card zjcard, kssm drkssm)
        {
            //zjcard属性
            this.card_cunzai = zjcard.cunzai;
            this.card_wmtype = zjcard.card_wmtype;
            this.card_atk = zjcard.atk;
            this.card_sdk = zjcard.sdk;
            this.card_balance = zjcard.balance;
            this.card_critical = zjcard.critical;
            this.card_fadong = zjcard.fadong;
            this.card_shuxingtype = zjcard.shuxingtype;
            this.card_shuxingzhi = zjcard.shuxingzhi;

            //drkssm属性
            this.drkssm_wmtype = drkssm.kssm_wmtype;
            this.drkssm_wuligongji = drkssm.wuligongji;
            this.drkssm_mofagongji = drkssm.mofagongji;
            this.drkssm_wulifangyu = drkssm.wulifangyu;
            this.drkssm_mofafangyu = drkssm.mofafangyu;
            this.drkssm_balance = drkssm.balance;
            this.drkssm_critical = drkssm.critical;
            this.drkssm_shuxingtype = drkssm.shuxingtype;
            this.drkssm_shuxingzhi = drkssm.shuxingzhi;

            //局部变量
            int card_data = 0;
            int card_gongji;
            int drkssm_def;
            bool card_kezhi;

            //计算
            if (this.card_cunzai == false)
            {
                return 0;
            }
            else
            {
                //物理魔法type
                if (this.card_wmtype == wulimofaleixing.物理)
                {
                    drkssm_def = this.drkssm_wulifangyu;
                }
                else
                {
                    drkssm_def = this.drkssm_mofafangyu;
                }

                //属性克制
                card_kezhi = shuxingkezhi(this.drkssm_shuxingzhi, this.drkssm_shuxingtype, this.card_shuxingtype);

                //技发判定
                if (this.ran.Next(100) < this.card_fadong)
                {
                    card_gongji = this.card_sdk;
                }
                else
                {
                    card_gongji = this.card_atk;
                }

                //属性计算
                if (card_kezhi == true)
                {
                    card_data = card_gongji * (100 + this.card_shuxingzhi) / 100;
                }
                else
                {
                    card_data = card_gongji;
                }


                //b值
                card_data = card_data * this.ran.Next(100 - this.card_balance, 100 + this.card_balance) / 100;

                //c值
                if (this.ran.Next(100) > this.card_critical)
                {
                    card_data = card_data - drkssm_def;
                }

                //打不动情况
                if (card_data < 0)
                {
                    card_data = 0;
                }
            }

            return card_data;
        }
Ejemplo n.º 4
0
        public static card peizhi(Carddata duiying, int jieduan)
        {
            int queshengflag = 1;
            card_wmtype = (wulimofaleixing)(int.Parse(duiying.type));
            
            card_fadong = (int)duiying.sk[jieduan];//不带%
            while (card_fadong==-1)
            {
                card_fadong = (int)duiying.sk[jieduan - queshengflag];//不带%
                queshengflag++;
            }
            queshengflag = 1;

            card_balance = duiying.ba[jieduan];
            while (card_balance == -1)
            {
                card_balance = (int)duiying.ba[jieduan - queshengflag];//不带%
                queshengflag++;
            }
            queshengflag = 1;

            card_critical = duiying.ct[jieduan];
            while (card_critical == -1)
            {
                card_critical = (int)duiying.ct[jieduan - queshengflag];//不带%
                queshengflag++;
            }
            queshengflag = 1;

            queshengflag = 0;
            while (duiying.elevalue[jieduan - queshengflag] == -1)
            {
                queshengflag++;
            }
            card_shuxingzhi = Convert.ToInt32((duiying.elevalue[jieduan - queshengflag] * 100) - 100);
            queshengflag = 1;

            card_shuxingtype = (shuxingleixing)(int.Parse(duiying.eletype) - 1);

            int adbenjimax = 0;
            int sdbenjimax = 0;
            for (int i = 0; i <= jieduan; i++)
            {
                adbenjimax = adjisuan(i, adbenjimax, duiying);

                sdbenjimax = sdjisuan(i, sdbenjimax, duiying);
            }


            card_atk = adbenjimax;
            card_sdk = sdbenjimax;

            card card_obj = new card(card_cunzai, card_wmtype, card_atk, card_sdk, card_fadong, card_balance, card_critical, card_shuxingzhi, card_shuxingtype);

            return card_obj;

        }