我的战斗算法的核心代码
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47 |
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); } |
Cocos2d-x游戏开发_战斗算法,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/hezijian/p/3758188.html