From 20d9ebdd487662e2cd543bc9f71da10092389b1f Mon Sep 17 00:00:00 2001 From: zhangshanxue Date: Mon, 17 Aug 2020 02:45:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=9E=E6=8A=80=E5=9C=BA=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SArenaRobotStaticConfig.java | 23 ++++++++++++++----- .../logic/expedition/ExpeditionLogic.java | 18 ++++++++++----- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/config/clazzStaticCfg/SArenaRobotStaticConfig.java b/serverlogic/src/main/java/com/ljsd/jieling/config/clazzStaticCfg/SArenaRobotStaticConfig.java index 7f135408d..f07face53 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/config/clazzStaticCfg/SArenaRobotStaticConfig.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/config/clazzStaticCfg/SArenaRobotStaticConfig.java @@ -7,11 +7,12 @@ import config.SWorkShopTechnology; import manager.AbstractClassStaticConfig; import manager.STableManager; import manager.Table; +import util.MathUtils; import java.util.*; public class SArenaRobotStaticConfig extends AbstractClassStaticConfig { - private static TreeMap force2robotId; + private static TreeMap> force2robotId; @Override public void registConfigs(Set registConfigs) { registConfigs.add(SArenaRobotConfig.class.getAnnotation(Table.class).name()); @@ -21,6 +22,7 @@ public class SArenaRobotStaticConfig extends AbstractClassStaticConfig { public void figureConfigs() { force2robotId = new TreeMap<>(); Map integerSArenaRobotConfigMap = SArenaRobotConfig.getsArenaRobotConfigMap(); + for(SArenaRobotConfig sArenaRobotConfig : integerSArenaRobotConfigMap.values()){ List heroList = sArenaRobotConfig.getHeroList(); int heroLevel = sArenaRobotConfig.getRobotLevel(); @@ -36,7 +38,13 @@ public class SArenaRobotStaticConfig extends AbstractClassStaticConfig { } int totleForce = HeroLogic.getInstance().calRobotTotalForce(sArenaRobotConfig); sArenaRobotConfig.setTotalForce(totleForce); - force2robotId.put(totleForce,sArenaRobotConfig.getId()); + LinkedList integers = force2robotId.get(totleForce); + if(integers==null){ + integers =new LinkedList<>(); + force2robotId.put(totleForce,integers); + } + integers.add(sArenaRobotConfig.getId()); + force2robotId.put(totleForce,integers); } int[][] returnMaterials = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getReturnMaterials(); @@ -53,10 +61,13 @@ public class SArenaRobotStaticConfig extends AbstractClassStaticConfig { public static Integer getFloorForce2robotId(int force) { - Map.Entry entry = force2robotId.ceilingEntry(force); + Map.Entry> entry = force2robotId.ceilingEntry(force); if(null==entry){ - return force2robotId.firstEntry().getValue(); + LinkedList value = force2robotId.firstEntry().getValue(); + int num = MathUtils.randomInt(value.size()); + return value.get(num); } - return entry.getValue(); - } + LinkedList value = entry.getValue(); + int num = MathUtils.randomInt(value.size()); + return value.get(num); } } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/expedition/ExpeditionLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/expedition/ExpeditionLogic.java index 9a934a610..c94ae9a93 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/expedition/ExpeditionLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/expedition/ExpeditionLogic.java @@ -315,7 +315,13 @@ public class ExpeditionLogic { int minFoce = sExpeditionSetting.getMatchForce()[leve-1][0]; int manFoce = sExpeditionSetting.getMatchForce()[leve-1][1]; - int standerFoce = (int) (user.getPlayerInfoManager().getMaxForce() * ((minFoce / 10000f) + ((float) nodeInfo.getLay()) / size * ((float) (manFoce - minFoce)/10000f))); + float v = user.getPlayerInfoManager().getMaxForce() * ((minFoce / 10000f)); + System.out.println("v = " + v); + float v1 = (minFoce / 10000f) + ((float) nodeInfo.getLay()) / 11 * ((float) (manFoce - minFoce) / 10000f); + System.out.println("v1 = " + v1); + int standerFoce = (int) (user.getPlayerInfoManager().getMaxForce() * ((minFoce / 10000f) + ((float) nodeInfo.getLay()) / 11 * ((float) (manFoce - minFoce)/10000f))); + + float randomForce = (standerFoce * ((sExpeditionSetting.getMatchForceRange()[0] + (int) (Math.random() * (sExpeditionSetting.getMatchForceRange()[1] - sExpeditionSetting.getMatchForceRange()[0]))) / 10000f)); if(nodeInfo.getType()==NODETYPE_ADVANCE){ @@ -325,7 +331,7 @@ public class ExpeditionLogic { } Set> typedTuples = RedisUtil.getInstence().rangeByScoreWithScores(RedisKey.AREDEF_TEAM_FORCE_RANK, "", 0, randomForce); - if (typedTuples.size() == 0) { + // if (typedTuples.size() == 0) { //战力没有获取到 从机器人中选 // Set set = ArenaLogic.randomRobot(SArenaSetting.getSArenaSetting().getScore(), 1); //// if (set.size() == 0) { @@ -336,10 +342,10 @@ public class ExpeditionLogic { int robotId= SArenaRobotStaticConfig.getFloorForce2robotId((int)randomForce); SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(robotId); snapOneFightInfo(nodeInfo, sArenaRobotConfig); - } else { - String serarchIdFromRank = typedTuples.iterator().next().getValue(); - snapOneFightInfo(user, nodeInfo, Integer.valueOf(serarchIdFromRank)); - } + // } else { + // String serarchIdFromRank = typedTuples.iterator().next().getValue(); + // snapOneFightInfo(user, nodeInfo, Integer.valueOf(serarchIdFromRank)); + // } } if(nodeInfo.getType()==ExpeditionLogic.NODETYPE_GREED||nodeInfo.getType() ==ExpeditionLogic.NODETYPE_TRY){