From af599093900e5e5c608d3b60843c9695fdb6c680 Mon Sep 17 00:00:00 2001 From: lvxinran Date: Fri, 19 Jun 2020 09:48:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=BD=E5=8D=A1=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ljsd/jieling/logic/hero/HeroLogic.java | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java index 901c41a21..3f8f98218 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java @@ -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 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 countMap = heroManager.getRandomPoolByType().get(mergePool); @@ -354,7 +353,7 @@ public class HeroLogic{ } Map 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);