Merge branch 'master_test_hw' of http://60.1.1.230/backend/jieling_server into master_test_hw

lvxinran 2020-12-28 16:38:45 +08:00
commit e40d422d55
1 changed files with 7 additions and 6 deletions

View File

@ -56,7 +56,7 @@ public class NewGeneralAttackHandler extends BaseHandler<ActivityProto.NewGenera
// 读表
int monsterGroupId = newHeroConfig.getMonsterGroup(); //怪物id
long bossBlood = 0; //怪物血量
double bossBlood = 0.0; //怪物血量
int[][] hurtList = newHeroConfig.getDropCell(); //伤害奖励表
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(monsterGroupId);
@ -98,10 +98,7 @@ public class NewGeneralAttackHandler extends BaseHandler<ActivityProto.NewGenera
// 战斗结果,第二位是伤害
int[] checkResult = fightResult.getCheckResult();
// 设置小数点后4位
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(4);
long lessBlood = 0;
double lessBlood = 0.0;
// checkResult第一位输赢1赢其他输
if (checkResult[0] == 1){
lessBlood = bossBlood;
@ -110,10 +107,14 @@ public class NewGeneralAttackHandler extends BaseHandler<ActivityProto.NewGenera
for (int i = 2; i < checkResult.length; i++) {
lessBlood+=checkResult[i];
}
lessBlood = bossBlood - lessBlood;
}
// 伤害/血量 用float表示
String blood = numberFormat.format((float)lessBlood/(float)bossBlood);
// 设置小数点后4位
NumberFormat nf = NumberFormat.getInstance();
nf.setMaximumFractionDigits(4);
String blood = nf.format(lessBlood/bossBlood);
// 表里面配置的伤害是万分比所以这里的概率乘以10000
float b = Float.parseFloat(blood)*10000;