新将boss,改获取伤害为获取血量
parent
0e9e5e6502
commit
41ee275964
|
@ -56,7 +56,7 @@ public class NewGeneralAttackHandler extends BaseHandler<ActivityProto.NewGenera
|
|||
|
||||
// 读表
|
||||
int monsterGroupId = newHeroConfig.getMonsterGroup(); //怪物id
|
||||
int bossBlood = 0; //怪物血量
|
||||
float bossBlood = 0; //怪物血量
|
||||
int[][] hurtList = newHeroConfig.getDropCell(); //伤害奖励表
|
||||
|
||||
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(monsterGroupId);
|
||||
|
@ -101,12 +101,22 @@ public class NewGeneralAttackHandler extends BaseHandler<ActivityProto.NewGenera
|
|||
// 设置小数点后4位
|
||||
NumberFormat numberFormat = NumberFormat.getInstance();
|
||||
numberFormat.setMaximumFractionDigits(4);
|
||||
float lessBlood = 0;
|
||||
// checkResult第一位输赢,1赢,其他输
|
||||
if (checkResult[0] == 1){
|
||||
lessBlood = bossBlood;
|
||||
}else {
|
||||
// checkResult第三位开始为血量,下标0开始
|
||||
for (int i = 2; i < checkResult.length; i++) {
|
||||
lessBlood+=checkResult[i];
|
||||
}
|
||||
lessBlood = bossBlood - lessBlood;
|
||||
}
|
||||
|
||||
// 伤害/血量 ,用float表示
|
||||
String blood = numberFormat.format((float) checkResult[1] / (float)bossBlood);
|
||||
String blood = numberFormat.format(lessBlood/bossBlood);
|
||||
// 表里面配置的伤害是万分比,所以这里的概率乘以10000
|
||||
float b = Float.parseFloat(blood)*10000;
|
||||
// 伤害可能溢出
|
||||
b = b > 10000?10000:b;
|
||||
|
||||
// 获取奖励id
|
||||
int[] dropList = new int[1];
|
||||
|
|
Loading…
Reference in New Issue