/// <summary> /// 骑士方法重写 /// </summary> /// <param name="wuligongji">物理攻击</param> /// <param name="mofagongji">魔法攻击</param> /// <param name="wulifangyu">物理防御</param> /// <param name="mofafangyu">魔法防御</param> /// <param name="balance">B值</param> /// <param name="critical">C值</param> /// <param name="shuxingzhi">属性值</param> /// <param name="shuxingtype">属性种类</param> public kssm(int wuligongji, int mofagongji, int wulifangyu, int mofafangyu, int balance, int critical, int shuxingzhi, shuxingleixing shuxingtype) { this.wuligongji = wuligongji; this.mofagongji = mofagongji; this.wulifangyu = wulifangyu; this.mofafangyu = mofafangyu; this.balance = balance; this.critical = critical; if (this.critical > 50) { this.critical = 50; } this.shuxingzhi = shuxingzhi; this.shuxingtype = shuxingtype; if (this.wuligongji >= this.mofagongji) { this.kssm_wmtype = wulimofaleixing.物理; } else { this.kssm_wmtype = wulimofaleixing.魔法; } }
/// <summary> /// 属性克制判断 /// </summary> /// <param name="drshuxingzhi">敌人属性值</param> /// <param name="drshuxingtype">敌人属性种类</param> /// <param name="zjshuxingtype">自己属性种类(人/卡)</param> /// <returns></returns> public bool shuxingkezhi(int drshuxingzhi, shuxingleixing drshuxingtype, shuxingleixing zjshuxingtype) { bool kezhi = false; if (drshuxingzhi > 0) { if (zjshuxingtype == shuxingleixing.wind) { if (zjshuxingtype - drshuxingtype == 3) { kezhi = true; } else { kezhi = false; } } else { if (zjshuxingtype - drshuxingtype == -1) { kezhi = true; } else { kezhi = false; } } } else { kezhi = false; } return kezhi; }
/// <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; }
/// <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; }
/// <summary> /// 卡方法重写 /// </summary> /// <param name="cunzai">卡是否存在</param> /// <param name="card_wmtype">物理魔法类型</param> /// <param name="atk">攻击</param> /// <param name="sdk">技攻</param> /// <param name="fadong">发动</param> /// <param name="balance">B值</param> /// <param name="critical">C值</param> /// <param name="shuxingzhi">属性值</param> /// <param name="shuxingtype">属性类型</param> public card(bool cunzai, wulimofaleixing card_wmtype, int atk, int sdk, int fadong, int balance, int critical, int shuxingzhi, shuxingleixing shuxingtype) { this.cunzai = cunzai; this.card_wmtype = card_wmtype; this.atk = atk; this.sdk = sdk; this.fadong = fadong; this.balance = balance; this.critical = critical; this.shuxingzhi = shuxingzhi; this.shuxingtype = shuxingtype; }
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; }
public static void shuxingjisuan() { if (shuxing[0][0] == 0 && shuxing[1][0] == 0 && shuxing[2][0] == 0 && shuxing[3][0] == 0) { shuxingtype = 0; shuxingzhi = 0; } else { int max = 0, maxweizhi = 0, temp1 = 0, temp2 = 0; for (int i = 0; i < 4; i++) { for (int j = 0; j < i; j++) { if (shuxing[j][0] > max) { max = shuxing[j][0]; maxweizhi = j; } } if (shuxing[i][0] > max) { temp1 = shuxing[i][0]; temp2 = shuxing[i][1]; shuxing[i][0] = shuxing[maxweizhi][0]; shuxing[i][1] = shuxing[maxweizhi][1]; shuxing[maxweizhi][0] = temp1; shuxing[maxweizhi][1] = temp2; } max = 0; maxweizhi = 0; } if (shuxing[0][0] == shuxing[1][0]) { if (shuxing[1][0] == shuxing[2][0]) { if (shuxing[2][0] == shuxing[3][0]) { shuxingtype = shuxingleixing.earth; shuxingzhi = shuxing[0][0]; } else { switch (shuxing[3][1]) { case 0: shuxingtype = shuxingleixing.water; break; case 1: shuxingtype = shuxingleixing.earth; break; case 2: shuxingtype = shuxingleixing.earth; break; case 3: shuxingtype = shuxingleixing.earth; break; default: break; } shuxingzhi = shuxing[0][0]; } } else { if (shuxing[0][1] < shuxing[1][1]) { shuxingtype = (shuxingleixing)shuxing[0][1]; shuxingzhi = shuxing[0][0]; } else { shuxingtype = (shuxingleixing)shuxing[1][1]; shuxingzhi = shuxing[1][0]; } } } else { shuxingtype = (shuxingleixing)shuxing[0][1]; shuxingzhi = shuxing[0][0]; } } }
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; }