zoukankan      html  css  js  c++  java
  • 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);
    
    	}
    

      

  • 相关阅读:
    SecondiosAppTutorial--学习笔记
    Your First iOS App--苹果官方iOS文档学习
    使用cocoapods碰到的难题
    xcode6 使用pch出错解决办法
    Mac上安装与更新Ruby,Rails运行环境
    对contentoffset的理解
    CALayer笔记
    StoryBoard解惑
    post和get请求
    程序内部让用户直接上appstore评价游戏的链接地址以及跳转方法
  • 原文地址:https://www.cnblogs.com/hezijian/p/3758188.html
Copyright © 2011-2022 走看看