竞技场提交

zhangshanxue 2020-08-17 02:45:58 +08:00
parent 7dd7e0523e
commit 20d9ebdd48
2 changed files with 29 additions and 12 deletions

View File

@ -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<Integer, Integer> force2robotId;
private static TreeMap<Integer, LinkedList<Integer>> force2robotId;
@Override
public void registConfigs(Set<String> 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<Integer, SArenaRobotConfig> integerSArenaRobotConfigMap = SArenaRobotConfig.getsArenaRobotConfigMap();
for(SArenaRobotConfig sArenaRobotConfig : integerSArenaRobotConfigMap.values()){
List<Integer> 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<Integer> 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<Integer,Integer> entry = force2robotId.ceilingEntry(force);
Map.Entry<Integer,LinkedList<Integer>> entry = force2robotId.ceilingEntry(force);
if(null==entry){
return force2robotId.firstEntry().getValue();
LinkedList<Integer> value = force2robotId.firstEntry().getValue();
int num = MathUtils.randomInt(value.size());
return value.get(num);
}
return entry.getValue();
}
LinkedList<Integer> value = entry.getValue();
int num = MathUtils.randomInt(value.size());
return value.get(num); }
}

View File

@ -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<ZSetOperations.TypedTuple<String>> typedTuples = RedisUtil.getInstence().rangeByScoreWithScores(RedisKey.AREDEF_TEAM_FORCE_RANK, "", 0, randomForce);
if (typedTuples.size() == 0) {
// if (typedTuples.size() == 0) {
//战力没有获取到 从机器人中选
// Set<Integer> 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){