/// <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="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; }