抽卡修改

back_recharge
lvxinran 2020-06-19 09:48:52 +08:00
parent 06ba20787b
commit af59909390
1 changed files with 17 additions and 9 deletions

View File

@ -323,13 +323,12 @@ public class HeroLogic{
HeroManager heroManager = user.getHeroManager();
//设置必出计数器
if(specialConfigs!=null&&!specialConfigs.isEmpty()){
for(SLotterySpecialConfig config:specialConfigs){
if(!heroManager.getRandomPoolByType().containsKey(mergePool)){
Map<Integer,Integer> map = new HashMap<>();
map.put(config.getDifferentType(),0);
heroManager.getRandomPoolByType().put(mergePool,new HashMap<>());
}
if(!heroManager.getRandomPoolByType().containsKey(mergePool)){
heroManager.getRandomPoolByType().put(mergePool,new HashMap<>());
for(SLotterySpecialConfig config:specialConfigs){
heroManager.getRandomPoolByType().get(mergePool).put(config.getDifferentType(),0);
// heroManager.getRandomPoolByType().computeIfAbsent(mergePool,n->new HashMap<>()).put(config.getId(),0);
}
}
}
Map<Integer, Integer> countMap = heroManager.getRandomPoolByType().get(mergePool);
@ -354,7 +353,7 @@ public class HeroLogic{
}
Map<Integer, Integer> mustRandomCount = heroManager.getMustRandomCount();
if(mustRandomCount.containsKey(countEntry.getKey())) {
if(mustRandomCount.get(countEntry.getKey())>=config.getMin_num()) {
if(config.getMin_num()!=0&&mustRandomCount.get(countEntry.getKey())>=config.getMin_num()) {
continue;
}else{
mustRandomCount.put(countEntry.getKey(), mustRandomCount.get(countEntry.getKey())+1);
@ -383,8 +382,17 @@ public class HeroLogic{
for(int mustId:mustSet){
maxId = mustId;
}
sLotteryRewardConfig = randomHeroByPoolId(STableManager.getConfig(SLotterySpecialConfig.class).get(maxId).getpool_id(), 1, user.getPlayerInfoManager().getLevel());
SLotterySpecialConfig onConfig = null;
for(SLotterySpecialConfig everyConfig:specialConfigs){
if(everyConfig.getDifferentType()!=maxId){
continue;
}
onConfig = everyConfig;
}
if(onConfig==null){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
sLotteryRewardConfig = randomHeroByPoolId(onConfig.getpool_id(), 1, user.getPlayerInfoManager().getLevel());
countMap.put(maxId,0);
}
heroManager.updateRandomPoolByType(mergePool,countMap);