无尽修改

back_recharge
lvxinran 2019-09-05 16:57:16 +08:00
parent b45af85013
commit 702c7c705e
2 changed files with 51 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package com.ljsd.jieling.config;
import com.ljsd.jieling.logic.STableManager;
import com.ljsd.jieling.logic.Table;
import java.util.HashMap;
import java.util.Map;
@Table(name ="EndlessMapConfig")
@ -22,11 +23,24 @@ public class SEndlessMapConfig implements BaseConfig {
private int[][] endlessPoint;
private int[][] initializeCount;
public static Map<Integer,SEndlessMapConfig> sEndlessMapConfigMap;
public static Map<Integer,Map<Integer,Integer>> initRandomPointMap;
@Override
public void init() throws Exception {
sEndlessMapConfigMap = STableManager.getConfig(SEndlessMapConfig.class);
initRandomPointMap = new HashMap<>();
for(Map.Entry<Integer,SEndlessMapConfig> entry:sEndlessMapConfigMap.entrySet()){
Map<Integer,Integer> pointMap = new HashMap<>();
int[][] initializeCount = entry.getValue().getInitializeCount();
for(int i = 0;i<initializeCount.length;i++){
pointMap.put(initializeCount[i][0],initializeCount[i][1]);
}
initRandomPointMap.put(entry.getKey(),pointMap);
}
}
@ -57,4 +71,8 @@ public class SEndlessMapConfig implements BaseConfig {
public int[] getMapItem() {
return mapItem;
}
public int[][] getInitializeCount() {
return initializeCount;
}
}

View File

@ -387,6 +387,9 @@ public class MapLogic {
mapManager.checkSuddenlyBoss();
int suddenlyBoss = mapManager.getSuddenlyBoss();
boolean canFindsuddenlyBoss = System.currentTimeMillis()> (mapManager.getSuddenlyBossStartTime() + SGameSetting.getGameSetting().getIncidentalBossCd())*1000;
Map<Integer, Map<Integer, Integer>> initRandomPointMap = SEndlessMapConfig.initRandomPointMap;
Map<Integer,List<Integer>> endlessRandomPoint = new HashMap<>();
for (Map.Entry<Integer, SCMap> entry : scMap.entrySet()) {
SCMap scMap1 = entry.getValue();
// 必出现的事件点
@ -401,6 +404,7 @@ public class MapLogic {
}
continue;
}
// 随机出现的事件点
int randomIndex = random.nextInt(scMap1.getGroups().length);
int x = scMap1.getGroups()[randomIndex][0];
@ -424,8 +428,35 @@ public class MapLogic {
continue;
}
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
//如果是无尽本
if(initRandomPointMap.get(mapManager.getCurMapId())!=null){
if(initRandomPointMap.get(mapManager.getCurMapId()).get(mapPointConfig.getId())!=null){
if(endlessRandomPoint.get( mapPointConfig.getId())!=null){
endlessRandomPoint.get(mapPointConfig.getId()).add(xy);
}else{
List<Integer> points = new ArrayList<>();
points.add(xy);
endlessRandomPoint.put(mapPointConfig.getId(),points);
}
}
}else{
newMap.put(xy, cellValue);
}
}
//无尽本随机点处理
if(endlessRandomPoint.size()>0){
for(Map.Entry<Integer,List<Integer>> entry:endlessRandomPoint.entrySet()){
int count = initRandomPointMap.get(mapManager.getCurMapId()).get(entry.getKey());
List<Integer> points = entry.getValue();
Collections.shuffle(points);
for(int i = 0 ; i <count;i++){
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(entry.getKey());
Cell cellValue = new Cell(points.get(i), mapPointConfig.getInitialEventId(),entry.getKey());
LOGGER.info("无尽生成{}的随机点为{},{}",entry.getKey(),CellUtil.pos2XY(points.get(i))[0],CellUtil.pos2XY(points.get(i))[1]);
newMap.put(points.get(i), cellValue);
}
newMap.put(xy, cellValue);
}
}
if (user.getPlayerInfoManager().getMapId() == 100) {
SGameSetting sGameSetting = SGameSetting.getGameSetting();
@ -438,8 +469,8 @@ public class MapLogic {
mission.setMissionId(challengeMapConfig.getMissionId());
mission.setMissionStep(0);
mission.setTime(0);
int xy = CellUtil.xy2Pos(challengeMapConfig.getPosition()[0], challengeMapConfig.getPosition()[1]);
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
int xy = CellUtil.xy2Pos(challengeMapConfig.getPosition()[0], challengeMapConfig.getPosition()[1]);
int type = sChallengeConfig.getType();
if(type==4){
if(mapManager.getEndlessMapInfo().getCurCell()!=0){