From 702c7c705e9a1eecff40b8a9200943d1ccc5e594 Mon Sep 17 00:00:00 2001 From: lvxinran Date: Thu, 5 Sep 2019 16:57:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0=E5=B0=BD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jieling/config/SEndlessMapConfig.java | 18 ++++++++++ .../ljsd/jieling/handler/map/MapLogic.java | 35 +++++++++++++++++-- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/config/SEndlessMapConfig.java b/serverlogic/src/main/java/com/ljsd/jieling/config/SEndlessMapConfig.java index 4924a6cd5..c7579b862 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/config/SEndlessMapConfig.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/config/SEndlessMapConfig.java @@ -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 sEndlessMapConfigMap; + + public static Map> initRandomPointMap; @Override public void init() throws Exception { sEndlessMapConfigMap = STableManager.getConfig(SEndlessMapConfig.class); + initRandomPointMap = new HashMap<>(); + for(Map.Entry entry:sEndlessMapConfigMap.entrySet()){ + Map pointMap = new HashMap<>(); + int[][] initializeCount = entry.getValue().getInitializeCount(); + for(int i = 0;i (mapManager.getSuddenlyBossStartTime() + SGameSetting.getGameSetting().getIncidentalBossCd())*1000; + + Map> initRandomPointMap = SEndlessMapConfig.initRandomPointMap; + Map> endlessRandomPoint = new HashMap<>(); for (Map.Entry 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 points = new ArrayList<>(); + points.add(xy); + endlessRandomPoint.put(mapPointConfig.getId(),points); + } + } + }else{ + newMap.put(xy, cellValue); + } + } + //无尽本随机点处理 + if(endlessRandomPoint.size()>0){ + for(Map.Entry> entry:endlessRandomPoint.entrySet()){ + int count = initRandomPointMap.get(mapManager.getCurMapId()).get(entry.getKey()); + List points = entry.getValue(); + Collections.shuffle(points); + for(int i = 0 ; i