地图提交
parent
44f726aaa7
commit
21059efe4a
|
@ -681,11 +681,11 @@ public class MapLogic {
|
||||||
int type = SChallengeConfig.sChallengeConfigs.get(mapId).getType();
|
int type = SChallengeConfig.sChallengeConfigs.get(mapId).getType();
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
public static AbstractMap getAbstractMap(User user){
|
public static AbstractMap getAbstractMap(User user) throws Exception {
|
||||||
MapManager mapManager = user.getMapManager();
|
MapManager mapManager = user.getMapManager();
|
||||||
return MapEnum.getToAbstractMap(getMapTypeByMapId(mapManager.getCurMapId()));
|
return MapEnum.getToAbstractMap(getMapTypeByMapId(mapManager.getCurMapId()));
|
||||||
}
|
}
|
||||||
public static AbstractMap getAbstractMap(int mapId){
|
public static AbstractMap getAbstractMap(int mapId) throws Exception {
|
||||||
return MapEnum.getToAbstractMap(getMapTypeByMapId(mapId));
|
return MapEnum.getToAbstractMap(getMapTypeByMapId(mapId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,16 +54,19 @@ import java.util.*;
|
||||||
* @discribe
|
* @discribe
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractMap implements IMap {
|
public abstract class AbstractMap implements IMap {
|
||||||
abstract int getType();
|
|
||||||
static final Logger LOGGER = LoggerFactory.getLogger(AbstractMap.class);
|
static final Logger LOGGER = LoggerFactory.getLogger(AbstractMap.class);
|
||||||
private Map<Integer, BaseBehavior> baseBehaviorMap = new HashMap<>();
|
private Map<Integer, BaseBehavior> baseBehaviorMap = new HashMap<>();
|
||||||
|
int endlessSeason;
|
||||||
|
int type;
|
||||||
public void init(ConfigurableApplicationContext configurableApplicationContext) {
|
public void init(ConfigurableApplicationContext configurableApplicationContext) {
|
||||||
Map<String, BaseBehavior> beansOfType = configurableApplicationContext.getBeansOfType(BaseBehavior.class);
|
Map<String, BaseBehavior> beansOfType = configurableApplicationContext.getBeansOfType(BaseBehavior.class);
|
||||||
for (BaseBehavior baseBehavior : beansOfType.values()) {
|
for (BaseBehavior baseBehavior : beansOfType.values()) {
|
||||||
baseBehaviorMap.put(baseBehavior.getBehaviorType(), baseBehavior);
|
baseBehaviorMap.put(baseBehavior.getBehaviorType(), baseBehavior);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int endlessSeason;
|
public AbstractMap(int type) {
|
||||||
|
this.type = type ;
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public AbstractMap getInstence(int mapType) {
|
public AbstractMap getInstence(int mapType) {
|
||||||
Map<Integer,AbstractMap> mapInstence = new HashMap<>();
|
Map<Integer,AbstractMap> mapInstence = new HashMap<>();
|
||||||
|
@ -557,14 +560,10 @@ public abstract class AbstractMap implements IMap {
|
||||||
Map<Integer, SCMap> scMap =SCMap.sCMap.get(mapManager.getCurMapId());
|
Map<Integer, SCMap> scMap =SCMap.sCMap.get(mapManager.getCurMapId());
|
||||||
Map<Integer, Cell> newMap = new HashMap<>();
|
Map<Integer, Cell> newMap = new HashMap<>();
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
StoreManager storeManager = user.getStoreManager();
|
|
||||||
boolean alreadHadYunShop = StoreLogic.checkContainsStore(user, StoreType.CLOUD_STORE,true);
|
boolean alreadHadYunShop = StoreLogic.checkContainsStore(user, StoreType.CLOUD_STORE,true);
|
||||||
mapManager.checkSuddenlyBoss();
|
mapManager.checkSuddenlyBoss();
|
||||||
int suddenlyBoss = mapManager.getSuddenlyBoss();
|
int suddenlyBoss = mapManager.getSuddenlyBoss();
|
||||||
boolean canFindsuddenlyBoss = System.currentTimeMillis()> (mapManager.getSuddenlyBossStartTime() + STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getIncidentalBossCd())*1000;
|
boolean canFindsuddenlyBoss = System.currentTimeMillis()> (mapManager.getSuddenlyBossStartTime() + STableManager.getFigureConfig(CommonStaticConfig.class).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()) {
|
for (Map.Entry<Integer, SCMap> entry : scMap.entrySet()) {
|
||||||
SCMap scMap1 = entry.getValue();
|
SCMap scMap1 = entry.getValue();
|
||||||
// 必出现的事件点
|
// 必出现的事件点
|
||||||
|
@ -595,66 +594,12 @@ public abstract class AbstractMap implements IMap {
|
||||||
if (mapPointConfig.getStyle() == EventType.suddenlyBoss && (suddenlyBoss != 0 || !canFindsuddenlyBoss) ){
|
if (mapPointConfig.getStyle() == EventType.suddenlyBoss && (suddenlyBoss != 0 || !canFindsuddenlyBoss) ){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
||||||
//如果是无尽本
|
newMap.put(xy, cellValue);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//无尽本随机点处理
|
initMapMission(user,newMap);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (user.getPlayerInfoManager().getMapId() == 100) {
|
|
||||||
SGameSetting sGameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
|
|
||||||
int xy = CellUtil.xy2Pos(sGameSetting.getBornPosition()[0], sGameSetting.getBornPosition()[1]);
|
|
||||||
mapManager.setCurXY(xy);
|
|
||||||
}
|
|
||||||
SChallengeMapConfig challengeMapConfig = STableManager.getConfig(SChallengeMapConfig.class).get(mapManager.getCurMapId());
|
|
||||||
|
|
||||||
Mission mission = new Mission();
|
|
||||||
mission.setMissionId(challengeMapConfig.getMissionId());
|
|
||||||
mission.setMissionStep(0);
|
|
||||||
mission.setTime(0);
|
|
||||||
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().getSeason()!=endlessSeason) {
|
|
||||||
for(Map.Entry<String,Integer> entry:mapManager.getEndlessMapInfo().getEndlessHeroInfo().entrySet()){
|
|
||||||
mapManager.updateEndlessHeroHp(entry.getKey(),10000);
|
|
||||||
}
|
|
||||||
mapManager.updateEndlessLocation(0);
|
|
||||||
}
|
|
||||||
if(mapManager.getEndlessMapInfo().getCurCell()!=0){
|
|
||||||
xy = mapManager.getEndlessMapInfo().getCurCell();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mapManager.setCurXY(xy);
|
|
||||||
mapManager.setMission(mission);
|
|
||||||
mapManager.setMapInfo(newMap);
|
|
||||||
MapLogic.getInstance().initMapMission(mapManager);
|
|
||||||
}
|
}
|
||||||
public void mustAppear(SCMap scMap,Map<Integer, Cell> newMap){
|
public void mustAppear(SCMap scMap,Map<Integer, Cell> newMap){
|
||||||
for (int i = 0; i < scMap.getGroups().length; i++) {
|
for (int i = 0; i < scMap.getGroups().length; i++) {
|
||||||
|
@ -666,5 +611,26 @@ public abstract class AbstractMap implements IMap {
|
||||||
newMap.put(xy, cellValue);
|
newMap.put(xy, cellValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public int getXY(MapManager mapManager){
|
||||||
|
SChallengeMapConfig challengeMapConfig = STableManager.getConfig(SChallengeMapConfig.class).get(mapManager.getCurMapId());
|
||||||
|
return CellUtil.xy2Pos(challengeMapConfig.getPosition()[0], challengeMapConfig.getPosition()[1]);
|
||||||
|
}
|
||||||
|
public void initMapMission(User user,Map<Integer, Cell> newMap) throws Exception {
|
||||||
|
MapManager mapManager = user.getMapManager();
|
||||||
|
if (user.getPlayerInfoManager().getMapId() == 100) {
|
||||||
|
SGameSetting sGameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
|
||||||
|
int xy = CellUtil.xy2Pos(sGameSetting.getBornPosition()[0], sGameSetting.getBornPosition()[1]);
|
||||||
|
mapManager.setCurXY(xy);
|
||||||
|
}
|
||||||
|
SChallengeMapConfig challengeMapConfig = STableManager.getConfig(SChallengeMapConfig.class).get(mapManager.getCurMapId());
|
||||||
|
Mission mission = new Mission();
|
||||||
|
mission.setMissionId(challengeMapConfig.getMissionId());
|
||||||
|
mission.setMissionStep(0);
|
||||||
|
mission.setTime(0);
|
||||||
|
mapManager.setCurXY(getXY(mapManager));
|
||||||
|
mapManager.setMission(mission);
|
||||||
|
mapManager.setMapInfo(newMap);
|
||||||
|
MapLogic.getInstance().initMapMission(mapManager);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,10 @@ import java.util.Map;
|
||||||
* @discribe
|
* @discribe
|
||||||
*/
|
*/
|
||||||
public class DifficultMap extends AbstractMap {
|
public class DifficultMap extends AbstractMap {
|
||||||
|
|
||||||
|
public DifficultMap(int type){
|
||||||
|
super(type);
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public void outMap(int uid,int outType, int curXY,MapInfoProto.MapOutResponse.Builder builder) throws Exception{
|
public void outMap(int uid,int outType, int curXY,MapInfoProto.MapOutResponse.Builder builder) throws Exception{
|
||||||
super.outMap(uid,outType,curXY,builder);
|
super.outMap(uid,outType,curXY,builder);
|
||||||
|
@ -48,11 +52,6 @@ public class DifficultMap extends AbstractMap {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
int getType() {
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enterMap(int uid, int mapId, int teamId, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception {
|
public void enterMap(int uid, int mapId, int teamId, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception {
|
||||||
super.enterMap(uid, mapId, teamId, mapEnterResponse);
|
super.enterMap(uid, mapId, teamId, mapEnterResponse);
|
||||||
|
@ -70,6 +69,6 @@ public class DifficultMap extends AbstractMap {
|
||||||
throw new ErrorCodeException(ErrorCode.newDefineCode("no ticket"));
|
throw new ErrorCodeException(ErrorCode.newDefineCode("no ticket"));
|
||||||
}
|
}
|
||||||
initMap(user.getMapManager(), user);
|
initMap(user.getMapManager(), user);
|
||||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,getType(),mapId);
|
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,type,mapId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,22 @@
|
||||||
package com.ljsd.jieling.handler.map.mapType;
|
package com.ljsd.jieling.handler.map.mapType;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||||
import com.ljsd.jieling.config.clazzStaticCfg.MapStaticConfig;
|
import com.ljsd.jieling.config.clazzStaticCfg.MapStaticConfig;
|
||||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||||
import com.ljsd.jieling.globals.BIReason;
|
import com.ljsd.jieling.globals.BIReason;
|
||||||
import com.ljsd.jieling.handler.map.Cell;
|
import com.ljsd.jieling.handler.map.*;
|
||||||
import com.ljsd.jieling.handler.map.EndlessMapInfo;
|
|
||||||
import com.ljsd.jieling.handler.map.MapLogic;
|
|
||||||
import com.ljsd.jieling.handler.map.MapManager;
|
|
||||||
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
||||||
|
import com.ljsd.jieling.handler.mission.Mission;
|
||||||
import com.ljsd.jieling.ktbeans.KtEventUtils;
|
import com.ljsd.jieling.ktbeans.KtEventUtils;
|
||||||
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
|
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
|
||||||
import com.ljsd.jieling.logic.GlobalDataManaager;
|
import com.ljsd.jieling.logic.GlobalDataManaager;
|
||||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||||
import com.ljsd.jieling.logic.dao.Hero;
|
import com.ljsd.jieling.logic.dao.*;
|
||||||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
|
||||||
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
|
||||||
import com.ljsd.jieling.logic.dao.UserManager;
|
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
||||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||||
|
import com.ljsd.jieling.logic.store.StoreType;
|
||||||
import com.ljsd.jieling.protocols.CommonProto;
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
import com.ljsd.jieling.protocols.FightInfoProto;
|
import com.ljsd.jieling.protocols.FightInfoProto;
|
||||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||||
|
@ -41,9 +38,9 @@ import java.util.*;
|
||||||
*/
|
*/
|
||||||
public class EndlessMap extends AbstractMap{
|
public class EndlessMap extends AbstractMap{
|
||||||
|
|
||||||
@Override
|
|
||||||
int getType() {
|
public EndlessMap(int type){
|
||||||
return 4;
|
super(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
int endlessMapId = 4001;
|
int endlessMapId = 4001;
|
||||||
|
@ -123,7 +120,7 @@ public class EndlessMap extends AbstractMap{
|
||||||
public void enterNewMap(User user, int mapId,int teamId, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception {
|
public void enterNewMap(User user, int mapId,int teamId, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception {
|
||||||
super.enterNewMap(user, mapId,teamId, mapEnterResponse);
|
super.enterNewMap(user, mapId,teamId, mapEnterResponse);
|
||||||
initMap(user.getMapManager(), user);
|
initMap(user.getMapManager(), user);
|
||||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,getType(),mapId);
|
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,type,mapId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -240,4 +237,93 @@ public class EndlessMap extends AbstractMap{
|
||||||
}
|
}
|
||||||
return groupId;
|
return groupId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initMap(MapManager mapManager, User user) throws Exception {
|
||||||
|
Map<Integer, SCMap> scMap =SCMap.sCMap.get(mapManager.getCurMapId());
|
||||||
|
Map<Integer, Cell> newMap = new HashMap<>();
|
||||||
|
Random random = new Random();
|
||||||
|
boolean alreadHadYunShop = StoreLogic.checkContainsStore(user, StoreType.CLOUD_STORE,true);
|
||||||
|
mapManager.checkSuddenlyBoss();
|
||||||
|
int suddenlyBoss = mapManager.getSuddenlyBoss();
|
||||||
|
boolean canFindsuddenlyBoss = System.currentTimeMillis()> (mapManager.getSuddenlyBossStartTime() + STableManager.getFigureConfig(CommonStaticConfig.class).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();
|
||||||
|
// 必出现的事件点
|
||||||
|
if (scMap1.getIsMustAppear() == 1) {
|
||||||
|
mustAppear(scMap1,newMap);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 随机出现的事件点
|
||||||
|
int randomIndex = random.nextInt(scMap1.getGroups().length);
|
||||||
|
int x = scMap1.getGroups()[randomIndex][0];
|
||||||
|
int y = scMap1.getGroups()[randomIndex][1];
|
||||||
|
int xy = CellUtil.xy2Pos(x, y);
|
||||||
|
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(scMap1.getEvent());
|
||||||
|
if (mapPointConfig == null) {
|
||||||
|
LOGGER.info("====initMap()====mapPointConfig == null======>{}", scMap1.getEvent());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!MapLogic.getInstance().mapPointCanAAppear(mapPointConfig)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (mapPointConfig.getStyle() == EventType.businessman) {
|
||||||
|
if (alreadHadYunShop) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mapPointConfig.getStyle() == EventType.suddenlyBoss && (suddenlyBoss != 0 || !canFindsuddenlyBoss) ){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(initRandomPointMap.get(mapManager.getCurMapId())==null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(initRandomPointMap.get(mapManager.getCurMapId()).get(mapPointConfig.getId())!=null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//无尽本随机点处理
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
initMapMission(user,newMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getXY(MapManager mapManager) {
|
||||||
|
int xy = super.getXY(mapManager);
|
||||||
|
if(mapManager.getEndlessMapInfo().getSeason()!=endlessSeason) {
|
||||||
|
for(Map.Entry<String,Integer> entry:mapManager.getEndlessMapInfo().getEndlessHeroInfo().entrySet()){
|
||||||
|
mapManager.updateEndlessHeroHp(entry.getKey(),10000);
|
||||||
|
}
|
||||||
|
mapManager.updateEndlessLocation(0);
|
||||||
|
}
|
||||||
|
if(mapManager.getEndlessMapInfo().getCurCell()!=0){
|
||||||
|
xy = mapManager.getEndlessMapInfo().getCurCell();
|
||||||
|
}
|
||||||
|
return xy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,46 +1,51 @@
|
||||||
package com.ljsd.jieling.handler.map.mapType;
|
package com.ljsd.jieling.handler.map.mapType;
|
||||||
|
|
||||||
|
|
||||||
import com.ljsd.jieling.handler.map.MapManager;
|
|
||||||
import com.ljsd.jieling.logic.dao.UserManager;
|
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
|
||||||
import config.SChallengeConfig;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
public enum MapEnum {
|
public enum MapEnum {
|
||||||
STORY_MAP(1, new StoryMap()),
|
STORY_MAP(1, StoryMap::new),
|
||||||
TOWER_MAP(2, new TowerMap()),
|
TOWER_MAP(2, TowerMap::new),
|
||||||
DIFFICULTY_MAP(3, new DifficultMap()),
|
DIFFICULTY_MAP(3,DifficultMap::new),
|
||||||
ENDLESS_MAP(4, new EndlessMap()),
|
ENDLESS_MAP(4, EndlessMap::new),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private int type;
|
private int type;
|
||||||
private AbstractMap toAbstractMap;
|
private Function<Integer, AbstractMap> toMapFunction;
|
||||||
private static final HashMap<Integer,MapEnum> MapEnumMap = new HashMap<>();
|
private static final HashMap<Integer,AbstractMap> mapAbstractMap = new HashMap<>();
|
||||||
|
private static final HashMap<Integer,MapEnum> mapEnumMap = new HashMap<>();
|
||||||
static {
|
static {
|
||||||
for (MapEnum map:MapEnum.values()) {
|
for (MapEnum map:MapEnum.values()) {
|
||||||
MapEnumMap.put(map.getType(),map);
|
mapEnumMap.put(map.getType(),map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MapEnum(int type, AbstractMap toAbstractMap) {
|
|
||||||
|
MapEnum(int type, Function<Integer, AbstractMap> toMapFunction) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.toAbstractMap = toAbstractMap;
|
this.toMapFunction = toMapFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
private AbstractMap getToAbstractMap() {
|
public Function<Integer, AbstractMap> getToMapFunction() {
|
||||||
return toAbstractMap;
|
return toMapFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AbstractMap getToAbstractMap(int type) {
|
private static AbstractMap getAbstractMap(int type) {
|
||||||
return MapEnumMap.get(type).getToAbstractMap();
|
if(!mapAbstractMap.containsKey(type)){
|
||||||
|
AbstractMap abstractMap= mapEnumMap.get(type).getToMapFunction().apply(type);
|
||||||
|
mapAbstractMap.put(type,abstractMap);
|
||||||
|
}
|
||||||
|
return mapAbstractMap.get(type);
|
||||||
|
}
|
||||||
|
public static AbstractMap getToAbstractMap(int type) throws Exception {
|
||||||
|
if(mapEnumMap.containsKey(type)){
|
||||||
|
return getAbstractMap(type);
|
||||||
|
}else{
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,9 @@ import com.ljsd.jieling.util.ItemUtil;
|
||||||
*/
|
*/
|
||||||
public class StoryMap extends AbstractMap{
|
public class StoryMap extends AbstractMap{
|
||||||
|
|
||||||
@Override
|
|
||||||
int getType() {
|
public StoryMap(int type){
|
||||||
return 1;
|
super(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -48,7 +48,7 @@ public class StoryMap extends AbstractMap{
|
||||||
mapManager.updatePlayGenMaps(mapId);
|
mapManager.updatePlayGenMaps(mapId);
|
||||||
}
|
}
|
||||||
initMap(mapManager, user);
|
initMap(mapManager, user);
|
||||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,getType(),mapId);
|
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,type,mapId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,8 @@ import java.util.*;
|
||||||
*/
|
*/
|
||||||
public class TowerMap extends AbstractMap {
|
public class TowerMap extends AbstractMap {
|
||||||
|
|
||||||
@Override
|
public TowerMap(int type){
|
||||||
int getType() {
|
super(type);
|
||||||
return 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -88,8 +87,8 @@ public class TowerMap extends AbstractMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
user.getUserMissionManager().onGameEvent(user, GameEvent.COPY_TOWER_TIMES,1);
|
user.getUserMissionManager().onGameEvent(user, GameEvent.COPY_TOWER_TIMES,1);
|
||||||
initTrialMap(user.getMapManager(), user);
|
initMap(user.getMapManager(), user);
|
||||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,getType(),user.getMapManager().getTower());
|
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,type,user.getMapManager().getTower());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +110,7 @@ public class TowerMap extends AbstractMap {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void initTrialMap(MapManager mapManager, User user) throws Exception {
|
public void initMap(MapManager mapManager, User user) throws Exception {
|
||||||
|
|
||||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTower());
|
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTower());
|
||||||
if(mapManager.getTower()>1&&mapManager.getMapIntoFlag()==0){
|
if(mapManager.getTower()>1&&mapManager.getMapIntoFlag()==0){
|
||||||
|
|
Loading…
Reference in New Issue