我的战斗算法的核心代码
private void aHitb(HeroBean a,HeroBean b){ ///*自身状态(已经移到aHitBTeam那里) //判断A能否出招或者受到伤害什么的 //*/ //if(this->checkStatus(a) == 1) // return; // cout<<a->heroName<<"的回合"<<endl; System.out.println(a.heroName + "的回合"); /*输出层 得到一个伤害值 */ boolean isBaoji = this.isBaoji(a); boolean isBig = this.isBig(a); int damage = this.getDamageInfact(a,isBaoji,isBig); Gong_Type damageType = this.getDamageType(a); /*效果层 得到伤害附带效果 */ Gongji_Effect_Bad isHasEffect = Gongji_Effect_Bad.normal; if(isBig){ damageType = a.skill.juegongType; isHasEffect = this.isHasEffect(a); } // cout<<"输出"<<damage<<"的伤害"<<"("<<damageType<<"属性)"<<endl; System.out.println("输出"+damage +"的伤害("+damageType+")属性"); // cout<<b->heroName<<"的反应"<<endl; System.out.println(b.heroName + "的反应"); /*计算层 计算A和B的攻防,得到真实伤害 */ boolean isShanbi = this.isShanbi(b); boolean isDidang = this.isDiDang(b); boolean isUseless = this.isUseless(isShanbi,isDidang); int realDamage = this.getRealDamage(damage,damageType,isUseless,b); // cout<<b->heroName<<"受到"<<realDamage<<"点伤害"<<endl; System.out.println("受到"+realDamage+"点伤害"); /*结果层刷新状态 刷新A和B */ this.refreshAStatus(a); this.refreshBStatus(b,realDamage,isHasEffect,a.skill.effectDamage,a.skill.effectRound); }