/// <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; }
/// <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; }
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; }
/// <summary> /// //kssm计算 /// </summary> /// <param name="zjkssm">自己骑士属性</param> /// <param name="drkssm">敌人骑士属性</param> /// <returns>伤害值</returns> public int kssm_jisuan(kssm zjkssm, kssm drkssm) { //zjkssm属性 this.zjkssm_wmtype = zjkssm.kssm_wmtype; this.zjkssm_wuligongji = zjkssm.wuligongji; this.zjkssm_mofagongji = zjkssm.mofagongji; this.zjkssm_wulifangyu = zjkssm.wulifangyu; this.zjkssm_mofafangyu = zjkssm.mofafangyu; this.zjkssm_balance = zjkssm.balance; this.zjkssm_critical = zjkssm.critical; this.zjkssm_shuxingtype = zjkssm.shuxingtype; this.zjkssm_shuxingzhi = zjkssm.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 zjkssm_atk; int drksssm_def; bool kezhi; //计算 if (this.zjkssm_wmtype == wulimofaleixing.物理) { zjkssm_atk = this.zjkssm_wuligongji; drksssm_def = this.drkssm_wulifangyu; } else { zjkssm_atk = this.zjkssm_mofagongji; drksssm_def = this.drkssm_mofafangyu; } int zjdata = 0; kezhi = shuxingkezhi(this.drkssm_shuxingzhi, this.drkssm_shuxingtype, this.zjkssm_shuxingtype); //属性 if (kezhi == true) { zjdata = zjkssm_atk * (100 + this.zjkssm_shuxingzhi) / 100; } else { zjdata = zjkssm_atk; } //b值 zjdata = zjdata * this.ran.Next(100 - zjkssm_balance, 100 + zjkssm_balance) / 100; //c值 if (this.ran.Next(100) > this.zjkssm_critical) { zjdata = zjdata - drksssm_def; } //打不动情况 if (zjdata < 0) { zjdata = 0; } return zjdata; }
public static kssm peizhi() { wuligongji = 10; mofagongji = 10; wulifangyu = 10; mofafangyu = 10; critical = 10; balance = 5; shuxingzhi = 0; shuxingtype = 0; shuxing = new int[4][] { new int[] { 0, 0 }, new int[] { 0, 1 }, new int[] { 0, 2 }, new int[] { 0, 3 } }; //武器 if (Chushihua.wuqi_duiying[8] == 0) { wulichengzhang = 5; mofachengzhang = 0; } else { wulichengzhang = 0; mofachengzhang = 5; } wuligongji = wuligongji + Chushihua.wuqi_duiying[0] * (100 + wulichengzhang * Chushihua.wuqi_qianghua) / 100; mofagongji = mofagongji + Chushihua.wuqi_duiying[1] * (100 + mofachengzhang * Chushihua.wuqi_qianghua) / 100; wulifangyu = wulifangyu + Chushihua.wuqi_duiying[2]; mofafangyu = mofafangyu + Chushihua.wuqi_duiying[3]; critical = critical + Chushihua.wuqi_duiying[4]; balance = balance + Chushihua.wuqi_duiying[5]; if (Chushihua.wuqi_duiying[6] != -1) { shuxing[Chushihua.wuqi_duiying[6]][0] = shuxing[Chushihua.wuqi_duiying[6]][0] + Chushihua.wuqi_duiying[7]; } //盾 if (Chushihua.dun_duiying[8] == 0) { wulichengzhang = 2; mofachengzhang = 3; } else { wulichengzhang = 3; mofachengzhang = 2; } wuligongji = wuligongji + Chushihua.dun_duiying[0]; mofagongji = mofagongji + Chushihua.dun_duiying[1]; wulifangyu = wulifangyu + Chushihua.dun_duiying[2] * (100 + wulichengzhang * Chushihua.dun_qianghua) / 100; mofafangyu = mofafangyu + Chushihua.dun_duiying[3] * (100 + mofachengzhang * Chushihua.dun_qianghua) / 100; critical = critical + Chushihua.dun_duiying[4]; balance = balance + Chushihua.dun_duiying[5]; if (Chushihua.dun_duiying[6] != -1) { shuxing[Chushihua.dun_duiying[6]][0] = shuxing[Chushihua.dun_duiying[6]][0] + Chushihua.dun_duiying[7]; } //衣服 if (Chushihua.yifu_duiying[8] == 0) { wulichengzhang = 5; mofachengzhang = 2; } else { wulichengzhang = 2; mofachengzhang = 5; } wuligongji = wuligongji + Chushihua.yifu_duiying[0]; mofagongji = mofagongji + Chushihua.yifu_duiying[1]; wulifangyu = wulifangyu + Chushihua.yifu_duiying[2] * (100 + wulichengzhang * Chushihua.yifu_qianghua) / 100; mofafangyu = mofafangyu + Chushihua.yifu_duiying[3] * (100 + mofachengzhang * Chushihua.yifu_qianghua) / 100; critical = critical + Chushihua.yifu_duiying[4]; balance = balance + Chushihua.yifu_duiying[5]; if (Chushihua.yifu_duiying[6] != -1) { shuxing[Chushihua.yifu_duiying[6]][0] = shuxing[Chushihua.yifu_duiying[6]][0] + Chushihua.yifu_duiying[7]; } //指 wuligongji = wuligongji + Chushihua.zhi_duiying[0] * (100 + 5 * Chushihua.zhi_qianghua) / 100; mofagongji = mofagongji + Chushihua.zhi_duiying[1] * (100 + 5 * Chushihua.zhi_qianghua) / 100; wulifangyu = wulifangyu + Chushihua.zhi_duiying[2] * (100 + 5 * Chushihua.zhi_qianghua) / 100; mofafangyu = mofafangyu + Chushihua.zhi_duiying[3] * (100 + 5 * Chushihua.zhi_qianghua) / 100; critical = critical + Chushihua.zhi_duiying[4]; balance = balance + Chushihua.zhi_duiying[5]; if (Chushihua.zhi_duiying[6] != -1) { shuxing[Chushihua.zhi_duiying[6]][0] = shuxing[Chushihua.zhi_duiying[6]][0] + Chushihua.zhi_duiying[7]; } //首 wuligongji = wuligongji + Chushihua.shou_duiying[0] * (100 + 5 * Chushihua.shou_qianghua) / 100; mofagongji = mofagongji + Chushihua.shou_duiying[1] * (100 + 5 * Chushihua.shou_qianghua) / 100; wulifangyu = wulifangyu + Chushihua.shou_duiying[2] * (100 + 5 * Chushihua.shou_qianghua) / 100; mofafangyu = mofafangyu + Chushihua.shou_duiying[3] * (100 + 5 * Chushihua.shou_qianghua) / 100; critical = critical + Chushihua.shou_duiying[4]; balance = balance + Chushihua.shou_duiying[5]; if (Chushihua.shou_duiying[6] != -1) { shuxing[Chushihua.shou_duiying[6]][0] = shuxing[Chushihua.shou_duiying[6]][0] + Chushihua.shou_duiying[7]; } shuxingjisuan(); kssm kssm_obj = new kssm(wuligongji, mofagongji, wulifangyu, mofafangyu, balance, critical, shuxingzhi, shuxingtype); return kssm_obj; }