心愿抽卡,未选择心愿报错兼容,直接返回原本英雄

DESKTOP-98AVA47\Administrator 2022-07-29 22:38:34 +08:00
parent ae47b63edd
commit ecf41ec2b3
1 changed files with 4 additions and 4 deletions

View File

@ -586,12 +586,12 @@ public class HeroLogic {
}
}
});
// 全部抽中
if (map.isEmpty()) {
return item;
}
// 随机权重
int weight = map.values().stream().mapToInt(Integer::intValue).sum();
// 全部抽中
if (map.isEmpty() || weight <= 0) {
return item;
}
int randomInt = MathUtils.randomInt(weight);
LOGGER.error("*************************************心愿抽奖权重,总权重:{},随机值:{},map:{}", weight, randomInt, map.toString());
// 遍历权重