• Cocos2d-x游戏开发_战斗算法


    我的战斗算法的核心代码

    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);
    
    	}
    

      

  • 相关阅读:
    NPM 重新回炉
    构建工具
    工作的环境部署
    Proxy 代理
    Promise 的 用法及实现
    JS 的 继承
    动态规划——LCS
    矩阵连乘——动态规划
    线段树&树状数组
    SpringAOP
  • 原文地址:https://www.cnblogs.com/hezijian/p/3758188.html
Copyright © 2020-2023  润新知