抽卡修改

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