抽卡逻辑修改

back_recharge
lvxinran 2021-04-21 14:44:26 +08:00
parent 47efe87f3a
commit 66a0486528
2 changed files with 21 additions and 6 deletions

View File

@ -22,6 +22,7 @@ public class HeroManager extends MongoBase {
private Map<Integer,Integer> mustRandomCount= new HashMap<>();
private Map<Integer,Integer> randomPoolInfo = new HashMap<>();//每个池子抽了多少次的信息
private Map<Integer,Integer> heroHandBook = new HashMap<>();
private Set<Integer> heroHandBookEnabled = new HashSet<>();
@ -253,5 +254,13 @@ public class HeroManager extends MongoBase {
}
public Map<Integer, Integer> getRandomPoolInfo() {
return randomPoolInfo;
}
public void addRandomPoolInfo(int poolId) {
randomPoolInfo.put(poolId,randomPoolInfo.getOrDefault(poolId,0)+1);
updateString("randomPoolInfo", randomPoolInfo);
}
}

View File

@ -519,7 +519,8 @@ public class HeroLogic{
//是否有必出
int currStarId = 0;
if(mustSet.isEmpty()){
sLotteryRewardConfig = randomHeroByPoolId(getPooId(sLotterySetting), 1, user.getPlayerInfoManager().getLevel());
int pooId = getPooId(sLotterySetting);
sLotteryRewardConfig = randomHeroByPoolId(pooId, user);
// if(randomPoolByType.get(mergePool)!=null) {
// for (int key : randomPoolByType.get(mergePool).keySet()) {
// if (star == key) {
@ -530,7 +531,10 @@ public class HeroLogic{
// }
// }
// }
currStarId = sLotteryRewardConfig.getStar();
if(sLotteryRewardConfig!=null){
currStarId = sLotteryRewardConfig.getStar();
LOGGER.info("随机到了{}-->对应star-->{}",sLotteryRewardConfig.getId(),currStarId);
}
}else{
//有必出时比较各个优先级,取优先级高的
@ -549,7 +553,7 @@ public class HeroLogic{
if(onConfig==null){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
sLotteryRewardConfig = randomHeroByPoolId(onConfig.getpool_id(), 1, user.getPlayerInfoManager().getLevel());
sLotteryRewardConfig = randomHeroByPoolId(onConfig.getpool_id(), user);
currStarId = maxId;
}
if(randomPoolByType.get(mergePool)!=null) {
@ -558,6 +562,7 @@ public class HeroLogic{
//如果生效次数是0可重置
List<SLotterySpecialConfig> lotteryListByDifferentType = SLotterySpecialConfig.getLotteryListByDifferentType(key);
if (currStarId >= key && lotteryListByDifferentType != null && lotteryListByDifferentType.iterator().hasNext() && lotteryListByDifferentType.iterator().next().getMin_num() == 0) {
LOGGER.info("清除计数{}下的--->{}",mergePool,key);
randomPoolByType.get(mergePool).put(key, 0);
} else {
int curValue = randomPoolByType.get(mergePool).getOrDefault(key, 0);
@ -567,6 +572,7 @@ public class HeroLogic{
}
heroManager.updateRandomPoolByType(mergePool,randomPoolByType.get(mergePool));
int result = sLotteryRewardConfig.getId();
heroManager.addRandomPoolInfo(sLotteryRewardConfig.getPool());
return result;
}
@ -641,7 +647,7 @@ public class HeroLogic{
public static SLotteryRewardConfig randomHeroByPoolId(int poolId,int randomCount,int userLevel){
public static SLotteryRewardConfig randomHeroByPoolId(int poolId,User user){
List<SLotteryRewardConfig> sLotteryRewardConfigs = new ArrayList<>();
List<SLotteryRewardConfig> sLotteryRewardConfigListByPoolId = SLotteryRewardConfig.getSLotteryRewardConfigListByPoolId(poolId);
int totalCountByPoolId =0;
@ -653,10 +659,10 @@ public class HeroLogic{
int openValue = openRules[1];
switch (openType) {
case 1:
canAdd = randomCount > openValue;
canAdd = user.getHeroManager().getRandomPoolInfo().getOrDefault(poolId,0) > openValue;
break;
case 2:
canAdd = userLevel > openValue;
canAdd = user.getPlayerInfoManager().getLevel() > openValue;
break;
default: {
break;