地图优化
parent
521edb1bfe
commit
44f726aaa7
|
@ -1111,13 +1111,12 @@ local effectList = {
|
|||
end
|
||||
end)
|
||||
end,
|
||||
--造成[a]%的[b]伤害,自身每种/每层增益状态会提高此技能[c]%的伤害。
|
||||
--造成[a]%的[b]伤害,自身每种/每层增益状态会提高此技能[c]%的伤害。【aoe】
|
||||
--a[float],b[伤害类型],c[float]
|
||||
[64] = function(caster, target, args, interval)
|
||||
local f1 = args[1]
|
||||
local dt = args[2]
|
||||
local f2 = args[3]
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local factor = 0
|
||||
BattleLogic.BuffMgr:QueryBuff(caster, function (buff)
|
||||
|
@ -1163,7 +1162,7 @@ local effectList = {
|
|||
end
|
||||
end)
|
||||
end,
|
||||
--造成[a]%的[b]伤害,[c]的概率附加一层增伤印记,最大[d]层。目标身上每层印记增加此技能[e]%的伤害。
|
||||
--造成[a]%的[b]伤害,[c]的概率附加一层增伤印记,最大[d]层。目标身上每层印记增加此技能[e]%的伤害。【aoe】
|
||||
--a[float],b[伤害类型],c[float],d[int],e[float]
|
||||
[66] = function(caster, target, args, interval)
|
||||
local f1 = args[1]
|
||||
|
@ -1171,7 +1170,6 @@ local effectList = {
|
|||
local f2 = args[3]
|
||||
local i1 = args[4]
|
||||
local f3 = args[5]
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local brand = Buff.Create(caster, BuffName.Brand, 0, "zengshang")
|
||||
brand.maxLayer = i1
|
||||
|
@ -1222,14 +1220,13 @@ local effectList = {
|
|||
end)
|
||||
end
|
||||
end,
|
||||
--造成[a]%的[b]伤害,附带持续伤害,每秒造成目标最大生命值[c]%的真实伤害,持续[d]秒。(目标最大生命值伤害总上限为施法者2.5倍攻击)
|
||||
--造成[a]%的[b]伤害,附带持续伤害,每秒造成目标最大生命值[c]%的真实伤害,持续[d]秒。(目标最大生命值伤害总上限为施法者2.5倍攻击)【aoe】
|
||||
--a[float],b[伤害类型],c[float],d[int]
|
||||
[68] = function(caster, target, args, interval)
|
||||
local f1 = args[1]
|
||||
local dt = args[2]
|
||||
local f2 = args[3]
|
||||
local f3 = args[4]
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
local dot = Buff.Create(caster, BuffName.DOT, f3, 1, 0, min(floor(target:GetRoleData(RoleDataName.MaxHp)*f2), floor(caster:GetRoleData(RoleDataName.Attack)*2.5)), 1)
|
||||
|
@ -1247,13 +1244,12 @@ local effectList = {
|
|||
target.data:SubValue(RoleDataName.Hp, hp)
|
||||
end)
|
||||
end,
|
||||
--造成[a]%的[b]伤害,每损失[c]%的生命,增加本技能[d]%的伤害。
|
||||
--造成[a]%的[b]伤害,每损失[c]%的生命,增加本技能[d]%的伤害。【aoe】
|
||||
--a[float],b[伤害类型],c[float],d[float]
|
||||
[70] = function(caster, target, args, interval)
|
||||
local f1 = args[1]
|
||||
local dt = args[2]
|
||||
local f2 = args[3]
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local factor = 1 - BattleUtil.GetHPPencent(caster)
|
||||
local OnPassiveDamaging = function(damagingFunc, defRole, damage)
|
||||
|
@ -1306,12 +1302,11 @@ local effectList = {
|
|||
buffRandomAction(f3, target, Buff.Create(caster, BuffName.DOT, f2, 1, d1, dt, f1))
|
||||
end)
|
||||
end,
|
||||
--造成[a]%的[b]伤害,立即结算目标身上所有dot的剩余伤害。
|
||||
--造成[a]%的[b]伤害,立即结算目标身上所有dot的剩余伤害。【aoe】
|
||||
--a[float],b[伤害类型]
|
||||
[73] = function(caster, target, args, interval)
|
||||
local f1 = args[1]
|
||||
local dt = args[2]
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff)
|
||||
|
@ -1752,7 +1747,7 @@ local effectList = {
|
|||
end
|
||||
end)
|
||||
end,
|
||||
--造成[a]%的[b]伤害,若暴击,[c]概率驱散[d]个(0表示所有)[e]状态。
|
||||
--造成[a]%的[b]伤害,若暴击,[c]概率驱散[d]个(0表示所有)[e]状态。【aoe】
|
||||
--a[float],b[伤害类型],c[float],d[int],e[状态类型]
|
||||
[93] = function(caster, target, args, interval)
|
||||
local f1 = args[1]
|
||||
|
@ -1760,7 +1755,6 @@ local effectList = {
|
|||
local f2 = args[3]
|
||||
local i1 = args[4]
|
||||
local ct = args[5]
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local dmg, crit = BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
if crit then
|
||||
|
|
|
@ -1281,7 +1281,6 @@ local passivityList = {
|
|||
end
|
||||
role.Event:AddEvent(BattleEventName.RoleKill, OnKill)
|
||||
end,
|
||||
|
||||
--受击后,[a]对攻击者造成自身[c]%的[d]伤害。
|
||||
--a[float],c[float],d[伤害类型]
|
||||
[71] = function(role, args)
|
||||
|
@ -1305,5 +1304,18 @@ local passivityList = {
|
|||
end
|
||||
role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
|
||||
end,
|
||||
--造成的伤害暴击时,有[a]概率在计算伤害时额外计算[b]的暴击伤害。
|
||||
--a[float],b[float]
|
||||
[72] = function(role, args)
|
||||
local f1 = args[1]
|
||||
local f2 = args[2]
|
||||
|
||||
local OnPassiveCriting = function(crit)
|
||||
BattleUtil.RandomAction(f1, function ()
|
||||
crit(role:GetRoleData(RoleDataName.CritDamageFactor)+f2)
|
||||
end)
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.PassiveCriting, OnPassiveCriting)
|
||||
end,
|
||||
}
|
||||
return passivityList
|
|
@ -28,7 +28,7 @@ local record
|
|||
local optionRecord
|
||||
|
||||
--是否开启战斗日志
|
||||
BattleLogic.IsOpenBattleRecord = true
|
||||
BattleLogic.IsOpenBattleRecord = false
|
||||
--逻辑帧频
|
||||
BattleLogic.GameFrameRate = 30
|
||||
BattleLogic.GameDeltaTime = 1 / BattleLogic.GameFrameRate
|
||||
|
|
|
@ -99,118 +99,9 @@ public class MapLogic {
|
|||
// }
|
||||
}
|
||||
|
||||
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();
|
||||
StoreManager storeManager = user.getStoreManager();
|
||||
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) {
|
||||
for (int i = 0; i < scMap1.getGroups().length; i++) {
|
||||
int x = scMap1.getGroups()[i][0];
|
||||
int y = scMap1.getGroups()[i][1];
|
||||
int xy = CellUtil.xy2Pos(x, y);
|
||||
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(scMap1.getEvent());
|
||||
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
||||
newMap.put(xy, cellValue);
|
||||
}
|
||||
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 (!mapPointCanAAppear(mapPointConfig)) {
|
||||
continue;
|
||||
}
|
||||
if (mapPointConfig.getStyle() == EventType.businessman) {
|
||||
if (alreadHadYunShop) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (mapPointConfig.getStyle() == EventType.suddenlyBoss && (suddenlyBoss != 0 || !canFindsuddenlyBoss) ){
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
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);
|
||||
initMapMission(mapManager);
|
||||
}
|
||||
|
||||
private boolean mapPointCanAAppear(MapPointConfig mapPointConfig) {
|
||||
public boolean mapPointCanAAppear(MapPointConfig mapPointConfig) {
|
||||
int[][] randomProbability = mapPointConfig.getRandomProbability();
|
||||
if (randomProbability == null || randomProbability.length == 0) {
|
||||
return true;
|
||||
|
@ -374,6 +265,9 @@ public class MapLogic {
|
|||
}
|
||||
|
||||
|
||||
public void initTrialMap(){
|
||||
|
||||
}
|
||||
/**
|
||||
* 更新事件点
|
||||
* optionConfig Id
|
||||
|
@ -783,12 +677,18 @@ public class MapLogic {
|
|||
mapManager.setTemporaryItems(null);
|
||||
}
|
||||
}
|
||||
public static AbstractMap curMapType(ISession session) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
int curMapId = user.getMapManager().getCurMapId();
|
||||
int type = SChallengeConfig.sChallengeConfigs.get(curMapId).getType();
|
||||
return MapEnum.getAbstractMap(type);
|
||||
private static int getMapTypeByMapId(int mapId){
|
||||
int type = SChallengeConfig.sChallengeConfigs.get(mapId).getType();
|
||||
return type;
|
||||
}
|
||||
public static AbstractMap getAbstractMap(User user){
|
||||
MapManager mapManager = user.getMapManager();
|
||||
return MapEnum.getToAbstractMap(getMapTypeByMapId(mapManager.getCurMapId()));
|
||||
}
|
||||
public static AbstractMap getAbstractMap(int mapId){
|
||||
return MapEnum.getToAbstractMap(getMapTypeByMapId(mapId));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param teamId
|
||||
|
@ -1615,133 +1515,7 @@ public class MapLogic {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化爬塔副本
|
||||
* @param mapManager
|
||||
* @param user
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String initTrialMap(MapManager mapManager, User user) throws Exception {
|
||||
|
||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTower());
|
||||
if(mapManager.getTower()>1&&mapManager.getMapIntoFlag()==0){
|
||||
for(int i = 1 ; i <mapManager.getTower();i++){
|
||||
ItemUtil.drop(user,STrialConfig.sTrialConfigMap.get(i).getReward(),1.0f,1,BIReason.TOWER_SWEEP_REWARD);
|
||||
int type = MathUtils.randomFromWeight(STrialConfig.sTrialConfigMap.get(i).getRandomBossType());
|
||||
if(type == 3){
|
||||
STrialConfig config = STrialConfig.sTrialConfigMap.get(i);
|
||||
int[][][] randomMapPointId = config.getRandomMapPointId();
|
||||
int randomPoint = MathUtils.randomFromWeight(randomMapPointId[type-1]);
|
||||
int initialEventId = MapPointConfig.getScMapEventMap().get(randomPoint).getInitialEventId();
|
||||
mapManager.addTowerUnusedBuffer(i,initialEventId);
|
||||
}
|
||||
if(type == 4){
|
||||
int storeIndex = MathUtils.randomFromWeight(STrialConfig.sTrialConfigMap.get(mapManager.getTower()).getRandomStore());
|
||||
StoreLogic.initOrUpdateOneStore(user,8,storeIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sTrialConfig == null) {
|
||||
LOGGER.info("initTrialMap() uid=>{} sTrialConfig == null =>{} ", user.getId(), mapManager.getTower());
|
||||
return "";
|
||||
}
|
||||
SChallengeMapConfig scMapConfig = STableManager.getConfig(SChallengeMapConfig.class).get(sTrialConfig.getMapId());
|
||||
if (scMapConfig == null) {
|
||||
LOGGER.info("initTrialMap() uid=>{} sChallengeConfig == null =>{} ", user.getId(), sTrialConfig.getMapId());
|
||||
return "该地图不存在";
|
||||
}
|
||||
Map<Integer, Cell> newMap = new HashMap<>();
|
||||
Random random = new Random();
|
||||
Map<Integer, SCMap> scMap = SCMap.sCMap.get(sTrialConfig.getMapId());
|
||||
Map<Integer, Cell> cellMap1 = new HashMap<>(sTrialConfig.getMonsterCount()[0]);
|
||||
Map<Integer, Cell> cellMap2 = new HashMap<>(sTrialConfig.getMonsterCount()[1]);
|
||||
|
||||
/* if(mapManager.getTowerStartTime()!=0){
|
||||
mapManager.setCurrTowerTime((TimeUtils.now()-mapManager.getTowerStartTime())/1000);
|
||||
}*/
|
||||
mapManager.setTowerStartTime(TimeUtils.now());
|
||||
|
||||
for (Map.Entry<Integer, SCMap> entry : scMap.entrySet()) {
|
||||
SCMap scMap1 = entry.getValue();
|
||||
// 必出现的事件点
|
||||
if (scMap1.getIsMustAppear() == 1) {
|
||||
for (int i = 0; i < scMap1.getGroups().length; i++) {
|
||||
int x = scMap1.getGroups()[i][0];
|
||||
int y = scMap1.getGroups()[i][1];
|
||||
int xy = CellUtil.xy2Pos(x, y);
|
||||
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(scMap1.getEvent());
|
||||
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
||||
newMap.put(xy, cellValue);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (scMap1.getEvent() == 1) {
|
||||
int i = 0;
|
||||
while (cellMap1.size() < sTrialConfig.getMonsterCount()[0]) {
|
||||
i++;
|
||||
if (i >= 10000) {
|
||||
break;
|
||||
}
|
||||
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(sTrialConfig.getRandomMonsterType()[0][1]);
|
||||
if (mapPointConfig == null) {
|
||||
LOGGER.info("====initTrialMap()====mapPointConfig == null======>{}", scMap1.getEvent());
|
||||
continue;
|
||||
}
|
||||
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
||||
cellMap1.put(xy, cellValue);
|
||||
}
|
||||
} else if (scMap1.getEvent() == 2) {
|
||||
int i = 0;
|
||||
while (cellMap2.size() < sTrialConfig.getMonsterCount()[1]) {
|
||||
i++;
|
||||
if (i >= 10000) {
|
||||
break;
|
||||
}
|
||||
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(sTrialConfig.getRandomMonsterType()[1][1]);
|
||||
if (mapPointConfig == null) {
|
||||
LOGGER.info("====initTrialMap()====mapPointConfig == null======>{}", scMap1.getEvent());
|
||||
continue;
|
||||
}
|
||||
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
||||
cellMap2.put(xy, cellValue);
|
||||
}
|
||||
} else {
|
||||
// 随机出现的事件点
|
||||
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("====initTrialMap()====mapPointConfig == null======>{}", scMap1.getEvent());
|
||||
continue;
|
||||
}
|
||||
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
||||
newMap.put(xy, cellValue);
|
||||
}
|
||||
newMap.putAll(cellMap1);
|
||||
newMap.putAll(cellMap2);
|
||||
}
|
||||
SChallengeMapConfig challengeMapConfig = STableManager.getConfig(SChallengeMapConfig.class).get(sTrialConfig.getMapId());
|
||||
int xy = CellUtil.xy2Pos(challengeMapConfig.getPosition()[0], challengeMapConfig.getPosition()[1]);
|
||||
mapManager.setCurXY(xy);
|
||||
mapManager.setMapInfo(newMap);
|
||||
mapManager.setEssenceValue(0);
|
||||
// mapManager.setHeroAllAttributeMap(mapManager.getHeroAllAttributeMap());
|
||||
if(mapManager.getTowerUnusedBuffer()==null){
|
||||
mapManager.setTowerUnusedBuffer(new HashMap<>());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 召唤首领
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.ljsd.jieling.handler.map.behavior;
|
||||
|
||||
import com.ljsd.jieling.handler.map.mapType.AbstractMap;
|
||||
import com.ljsd.jieling.handler.map.mapType.MapEnum;
|
||||
import config.SChallengeConfig;
|
||||
import config.STrialConfig;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
|
@ -57,7 +59,7 @@ public class FourtyTwoBehavior extends BaseBehavior {
|
|||
mapManager.setStartExporeTime(0);
|
||||
mapManager.setMapIntoFlag(2);
|
||||
|
||||
MapLogic.getInstance().initTrialMap(mapManager, user);
|
||||
MapLogic.getAbstractMap(user).initMap(mapManager, user);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.ljsd.jieling.handler.map.behavior;
|
|||
|
||||
import com.ljsd.jieling.handler.map.EventType;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.handler.map.mapType.MapEnum;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -18,7 +20,7 @@ public class JumpBehavior extends BaseBehavior {
|
|||
if (behaviorTypeValues[0][0] != 0) {
|
||||
user.getMapManager().setCurMapId(behaviorTypeValues[0][0]);
|
||||
user.getPlayerInfoManager().setMapId(behaviorTypeValues[0][0]);
|
||||
MapLogic.getInstance().initMap(user.getMapManager(), user);
|
||||
MapLogic.getAbstractMap(user).initMap(user.getMapManager(), user);
|
||||
return true;
|
||||
} else {
|
||||
MapLogic.getInstance().resetMapInfo(user, true);
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.ljsd.jieling.exception.ErrorCode;
|
|||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.FightInfoProto;
|
||||
|
@ -31,7 +32,7 @@ public class FightEndRequestHandler extends BaseHandler {
|
|||
}else if(type == 2){
|
||||
int dropout = fightEndRequest.getDropout();
|
||||
FightInfoProto.FightEndResponse.Builder builder = FightInfoProto.FightEndResponse.newBuilder();
|
||||
MapLogic.curMapType(iSession).endFight(iSession.getUid(), frames, builder,dropout);
|
||||
MapLogic.getAbstractMap(UserManager.getUser(iSession.getUid())).endFight(iSession.getUid(), frames, builder,dropout);
|
||||
MessageUtil.sendMessage(iSession,1,MessageTypeProto.MessageType.FIGHT_END_RESPONSE_VALUE,builder.build(),true );
|
||||
}else if(type == 3){
|
||||
MapLogic.getInstance().endSuddlenlyFight(iSession, frames, MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.ljsd.jieling.handler.BaseHandler;
|
|||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.handler.map.mapType.IMap;
|
||||
import com.ljsd.jieling.handler.map.mapType.MapEnum;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
|
@ -28,7 +29,7 @@ public class MapEnterRequestHandler extends BaseHandler{
|
|||
int teamId = mapEnterRequest.getTeamId();
|
||||
// MapLogic.getInstance().enterMap();
|
||||
MapInfoProto.MapEnterResponse.Builder builder = MapInfoProto.MapEnterResponse.newBuilder();
|
||||
MapEnum.getAbstractMap(SChallengeConfig.sChallengeConfigs.get(mapEnterRequest.getMapId()).getType()).enterMap(iSession.getUid(), mapEnterRequest.getMapId(), teamId,builder);
|
||||
MapLogic.getAbstractMap(mapEnterRequest.getMapId()).enterMap(iSession.getUid(), mapEnterRequest.getMapId(), teamId,builder);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.MAP_ENTER_RESPONSE.getNumber(), builder.build(), true);
|
||||
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class MapFastFightRequestHandler extends BaseHandler {
|
|||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
FightInfoProto.FastFightResponse.Builder builder = FightInfoProto.FastFightResponse.newBuilder();
|
||||
MapLogic.curMapType(iSession).fastFight(iSession.getUid(), builder);
|
||||
MapLogic.getAbstractMap(UserManager.getUser(iSession.getUid())).fastFight(iSession.getUid(), builder);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.MAP_FAST_FIGHT_RESPONSE.getNumber(), builder.build(), true);
|
||||
|
||||
}
|
||||
|
|
|
@ -26,8 +26,7 @@ public class MapOutRequestHandler extends BaseHandler{
|
|||
MapInfoProto.MapOutRequest mapOutRequest = MapInfoProto.MapOutRequest.parseFrom(bytes);
|
||||
int outType = mapOutRequest.getOutType();
|
||||
int curXY = mapOutRequest.getCurXY();
|
||||
int curMapId = UserManager.getUser(iSession.getUid()).getMapManager().getCurMapId();
|
||||
AbstractMap abstractMap = MapEnum.getAbstractMap(SChallengeConfig.sChallengeConfigs.get(curMapId).getType());
|
||||
AbstractMap abstractMap = MapLogic.getAbstractMap(UserManager.getUser(iSession.getUid()));
|
||||
MapInfoProto.MapOutResponse.Builder builder = MapInfoProto.MapOutResponse.newBuilder();
|
||||
abstractMap.outMap(iSession.getUid(),outType,curXY,builder);
|
||||
MessageUtil.sendMessage(iSession,1,MessageTypeProto.MessageType.MAP_OUT_RESPONSE_VALUE,builder.build());
|
||||
|
|
|
@ -70,7 +70,7 @@ public class StartFightRequestHandler extends BaseHandler<FightInfoProto.FightSt
|
|||
// MapLogic.getInstance().startLevelDifficultyFight(iSession,fightId,teamId,type, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
|
||||
}else if(type == 2){
|
||||
FightInfoProto.FightStartResponse.Builder responseBuilder = FightInfoProto.FightStartResponse.newBuilder();
|
||||
MapLogic.curMapType(iSession).startFight(iSession.getUid(),responseBuilder);
|
||||
MapLogic.getAbstractMap(UserManager.getUser(iSession.getUid())).startFight(iSession.getUid(),responseBuilder);
|
||||
MessageUtil.sendMessage(iSession,1,MessageTypeProto.MessageType.FIGHT_START_RESPONSE_VALUE,responseBuilder.build(),true);
|
||||
}else if(type == 3){
|
||||
MapLogic.getInstance().startSuddlenlyFight(iSession,teamId, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.handler.map.mapType;
|
|||
|
||||
|
||||
import com.googlecode.protobuf.format.JsonFormat;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.MapStaticConfig;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
|
@ -14,9 +15,11 @@ import com.ljsd.jieling.handler.map.*;
|
|||
|
||||
import com.ljsd.jieling.handler.map.behavior.BaseBehavior;
|
||||
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
||||
import com.ljsd.jieling.handler.mission.Mission;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.StoryEvent;
|
||||
import com.ljsd.jieling.logic.dao.Hero;
|
||||
import com.ljsd.jieling.logic.dao.StoreManager;
|
||||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
@ -25,6 +28,8 @@ import com.ljsd.jieling.logic.fight.FightType;
|
|||
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
import com.ljsd.jieling.logic.store.StoreType;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.FightInfoProto;
|
||||
|
@ -49,9 +54,9 @@ import java.util.*;
|
|||
* @discribe
|
||||
*/
|
||||
public abstract class AbstractMap implements IMap {
|
||||
abstract int getType();
|
||||
static final Logger LOGGER = LoggerFactory.getLogger(AbstractMap.class);
|
||||
private Map<Integer, BaseBehavior> baseBehaviorMap = new HashMap<>();
|
||||
int type;
|
||||
public void init(ConfigurableApplicationContext configurableApplicationContext) {
|
||||
Map<String, BaseBehavior> beansOfType = configurableApplicationContext.getBeansOfType(BaseBehavior.class);
|
||||
for (BaseBehavior baseBehavior : beansOfType.values()) {
|
||||
|
@ -155,9 +160,9 @@ public abstract class AbstractMap implements IMap {
|
|||
}
|
||||
}
|
||||
|
||||
public AbstractMap(int type){
|
||||
this.type = type;
|
||||
}
|
||||
// public AbstractMap(int type){
|
||||
// this.type = type;
|
||||
// }
|
||||
|
||||
public void enterNewMap(User user,int mapId,int teamId,MapInfoProto.MapEnterResponse.Builder mapEnterResponse)throws Exception{
|
||||
MapManager mapManager = user.getMapManager();
|
||||
|
@ -548,4 +553,118 @@ public abstract class AbstractMap implements IMap {
|
|||
return groupId;
|
||||
}
|
||||
|
||||
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();
|
||||
StoreManager storeManager = user.getStoreManager();
|
||||
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;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
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){
|
||||
for (int i = 0; i < scMap.getGroups().length; i++) {
|
||||
int x = scMap.getGroups()[i][0];
|
||||
int y = scMap.getGroups()[i][1];
|
||||
int xy = CellUtil.xy2Pos(x, y);
|
||||
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(scMap.getEvent());
|
||||
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
||||
newMap.put(xy, cellValue);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ import java.util.Map;
|
|||
* @discribe
|
||||
*/
|
||||
public class DifficultMap extends AbstractMap {
|
||||
int type = 3;
|
||||
@Override
|
||||
public void outMap(int uid,int outType, int curXY,MapInfoProto.MapOutResponse.Builder builder) throws Exception{
|
||||
super.outMap(uid,outType,curXY,builder);
|
||||
|
@ -49,6 +48,11 @@ public class DifficultMap extends AbstractMap {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
int getType() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enterMap(int uid, int mapId, int teamId, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception {
|
||||
super.enterMap(uid, mapId, teamId, mapEnterResponse);
|
||||
|
@ -65,10 +69,7 @@ public class DifficultMap extends AbstractMap {
|
|||
if(!enough){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("no ticket"));
|
||||
}
|
||||
MapLogic.getInstance().initMap(user.getMapManager(), user);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,type,mapId);
|
||||
}
|
||||
public DifficultMap(int type){
|
||||
super();
|
||||
initMap(user.getMapManager(), user);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,getType(),mapId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,12 @@ import java.util.*;
|
|||
* @discribe
|
||||
*/
|
||||
public class EndlessMap extends AbstractMap{
|
||||
int type=4;
|
||||
|
||||
@Override
|
||||
int getType() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
int endlessMapId = 4001;
|
||||
@Override
|
||||
public void enterMap(int uid, int mapId, int teamId, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception {
|
||||
|
@ -117,8 +122,8 @@ public class EndlessMap extends AbstractMap{
|
|||
@Override
|
||||
public void enterNewMap(User user, int mapId,int teamId, MapInfoProto.MapEnterResponse.Builder mapEnterResponse) throws Exception {
|
||||
super.enterNewMap(user, mapId,teamId, mapEnterResponse);
|
||||
MapLogic.getInstance().initMap(user.getMapManager(), user);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,type,mapId);
|
||||
initMap(user.getMapManager(), user);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,getType(),mapId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
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;
|
||||
|
||||
public enum MapEnum {
|
||||
|
@ -27,11 +33,14 @@ public enum MapEnum {
|
|||
return type;
|
||||
}
|
||||
|
||||
public AbstractMap getToAbstractMap() {
|
||||
private AbstractMap getToAbstractMap() {
|
||||
return toAbstractMap;
|
||||
}
|
||||
|
||||
public static AbstractMap getAbstractMap(int type) {
|
||||
public static AbstractMap getToAbstractMap(int type) {
|
||||
return MapEnumMap.get(type).getToAbstractMap();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -19,8 +19,10 @@ import com.ljsd.jieling.util.ItemUtil;
|
|||
* @discribe
|
||||
*/
|
||||
public class StoryMap extends AbstractMap{
|
||||
int type = 1;
|
||||
public StoryMap() {
|
||||
|
||||
@Override
|
||||
int getType() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,8 +47,8 @@ public class StoryMap extends AbstractMap{
|
|||
}else{
|
||||
mapManager.updatePlayGenMaps(mapId);
|
||||
}
|
||||
MapLogic.getInstance().initMap(mapManager, user);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,type,mapId);
|
||||
initMap(mapManager, user);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,getType(),mapId);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -14,17 +14,18 @@ import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
|
|||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.TowerRankUtil;
|
||||
import config.STrialConfig;
|
||||
import config.STrialSetting;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import util.CellUtil;
|
||||
import util.MathUtils;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
|
@ -32,7 +33,12 @@ import java.util.Map;
|
|||
* @discribe
|
||||
*/
|
||||
public class TowerMap extends AbstractMap {
|
||||
int type = 2;
|
||||
|
||||
@Override
|
||||
int getType() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void outMap(int uid,int outType, int curXY,MapInfoProto.MapOutResponse.Builder builder) throws Exception{
|
||||
super.outMap(uid,outType,curXY,builder);
|
||||
|
@ -82,8 +88,8 @@ public class TowerMap extends AbstractMap {
|
|||
}
|
||||
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.COPY_TOWER_TIMES,1);
|
||||
MapLogic.getInstance().initTrialMap(user.getMapManager(), user);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,type,user.getMapManager().getTower());
|
||||
initTrialMap(user.getMapManager(), user);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,getType(),user.getMapManager().getTower());
|
||||
|
||||
}
|
||||
|
||||
|
@ -105,4 +111,116 @@ public class TowerMap extends AbstractMap {
|
|||
}
|
||||
}
|
||||
}
|
||||
public void initTrialMap(MapManager mapManager, User user) throws Exception {
|
||||
|
||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTower());
|
||||
if(mapManager.getTower()>1&&mapManager.getMapIntoFlag()==0){
|
||||
for(int i = 1 ; i <mapManager.getTower();i++){
|
||||
ItemUtil.drop(user,STrialConfig.sTrialConfigMap.get(i).getReward(),1.0f,1,BIReason.TOWER_SWEEP_REWARD);
|
||||
int type = MathUtils.randomFromWeight(STrialConfig.sTrialConfigMap.get(i).getRandomBossType());
|
||||
if(type == 3){
|
||||
STrialConfig config = STrialConfig.sTrialConfigMap.get(i);
|
||||
int[][][] randomMapPointId = config.getRandomMapPointId();
|
||||
int randomPoint = MathUtils.randomFromWeight(randomMapPointId[type-1]);
|
||||
int initialEventId = MapPointConfig.getScMapEventMap().get(randomPoint).getInitialEventId();
|
||||
mapManager.addTowerUnusedBuffer(i,initialEventId);
|
||||
}
|
||||
if(type == 4){
|
||||
int storeIndex = MathUtils.randomFromWeight(STrialConfig.sTrialConfigMap.get(mapManager.getTower()).getRandomStore());
|
||||
StoreLogic.initOrUpdateOneStore(user,8,storeIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sTrialConfig == null) {
|
||||
LOGGER.info("initTrialMap() uid=>{} sTrialConfig == null =>{} ", user.getId(), mapManager.getTower());
|
||||
return;
|
||||
}
|
||||
SChallengeMapConfig scMapConfig = STableManager.getConfig(SChallengeMapConfig.class).get(sTrialConfig.getMapId());
|
||||
if (scMapConfig == null) {
|
||||
LOGGER.info("initTrialMap() uid=>{} sChallengeConfig == null =>{} ", user.getId(), sTrialConfig.getMapId());
|
||||
return;
|
||||
}
|
||||
Map<Integer, Cell> newMap = new HashMap<>();
|
||||
Random random = new Random();
|
||||
Map<Integer, SCMap> scMap = SCMap.sCMap.get(sTrialConfig.getMapId());
|
||||
Map<Integer, Cell> cellMap1 = new HashMap<>(sTrialConfig.getMonsterCount()[0]);
|
||||
Map<Integer, Cell> cellMap2 = new HashMap<>(sTrialConfig.getMonsterCount()[1]);
|
||||
|
||||
/* if(mapManager.getTowerStartTime()!=0){
|
||||
mapManager.setCurrTowerTime((TimeUtils.now()-mapManager.getTowerStartTime())/1000);
|
||||
}*/
|
||||
mapManager.setTowerStartTime(TimeUtils.now());
|
||||
|
||||
for (Map.Entry<Integer, SCMap> entry : scMap.entrySet()) {
|
||||
SCMap scMap1 = entry.getValue();
|
||||
// 必出现的事件点
|
||||
if (scMap1.getIsMustAppear() == 1) {
|
||||
mustAppear(scMap1,newMap);
|
||||
continue;
|
||||
}
|
||||
if (scMap1.getEvent() == 1) {
|
||||
int i = 0;
|
||||
while (cellMap1.size() < sTrialConfig.getMonsterCount()[0]) {
|
||||
i++;
|
||||
if (i >= 10000) {
|
||||
break;
|
||||
}
|
||||
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(sTrialConfig.getRandomMonsterType()[0][1]);
|
||||
if (mapPointConfig == null) {
|
||||
LOGGER.info("====initTrialMap()====mapPointConfig == null======>{}", scMap1.getEvent());
|
||||
continue;
|
||||
}
|
||||
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
||||
cellMap1.put(xy, cellValue);
|
||||
}
|
||||
} else if (scMap1.getEvent() == 2) {
|
||||
int i = 0;
|
||||
while (cellMap2.size() < sTrialConfig.getMonsterCount()[1]) {
|
||||
i++;
|
||||
if (i >= 10000) {
|
||||
break;
|
||||
}
|
||||
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(sTrialConfig.getRandomMonsterType()[1][1]);
|
||||
if (mapPointConfig == null) {
|
||||
LOGGER.info("====initTrialMap()====mapPointConfig == null======>{}", scMap1.getEvent());
|
||||
continue;
|
||||
}
|
||||
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
||||
cellMap2.put(xy, cellValue);
|
||||
}
|
||||
} else {
|
||||
// 随机出现的事件点
|
||||
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("====initTrialMap()====mapPointConfig == null======>{}", scMap1.getEvent());
|
||||
continue;
|
||||
}
|
||||
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
|
||||
newMap.put(xy, cellValue);
|
||||
}
|
||||
newMap.putAll(cellMap1);
|
||||
newMap.putAll(cellMap2);
|
||||
}
|
||||
SChallengeMapConfig challengeMapConfig = STableManager.getConfig(SChallengeMapConfig.class).get(sTrialConfig.getMapId());
|
||||
int xy = CellUtil.xy2Pos(challengeMapConfig.getPosition()[0], challengeMapConfig.getPosition()[1]);
|
||||
mapManager.setCurXY(xy);
|
||||
mapManager.setMapInfo(newMap);
|
||||
mapManager.setEssenceValue(0);
|
||||
// mapManager.setHeroAllAttributeMap(mapManager.getHeroAllAttributeMap());
|
||||
if(mapManager.getTowerUnusedBuffer()==null){
|
||||
mapManager.setTowerUnusedBuffer(new HashMap<>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue