试炼最高层处理
parent
e88a8fd3b5
commit
3b2ebae2c5
|
@ -816,6 +816,10 @@ public class MapLogic {
|
|||
LOGGER.info("退出地图");
|
||||
if(challengeConfig.getType()==2){
|
||||
if(mapManager.getTower()>=1){
|
||||
mapManager.setHighestTower(mapManager.getTower());
|
||||
if(TowerRankUtil.getRankNumber(mapManager.getTower(),(int)(mapManager.getCurrTowerTime()/1000))>RedisUtil.getInstence().getZSetScore(RedisKey.TOWER_RANK, "", String.valueOf(user.getId()))){
|
||||
RedisUtil.getInstence().zsetAddOne(RedisKey.getKey(RedisKey.TOWER_RANK,"",false),String.valueOf(user.getId()),TowerRankUtil.getRankNumber(mapManager.getTower(),(int)(mapManager.getCurrTowerTime()/1000)));
|
||||
}
|
||||
mapManager.setMapIntoFlag(1);
|
||||
}
|
||||
}
|
||||
|
@ -1262,7 +1266,9 @@ public class MapLogic {
|
|||
}
|
||||
// if(mapManager.getBossType()==1)
|
||||
if(mapManager.getTower()==STrialConfig.getHighestTower()&&mapManager.getBossType()!=0){
|
||||
|
||||
int time = (int)((TimeUtils.now()-mapManager.getTowerStartTime())/1000);
|
||||
mapManager.setCurrTowerTime(time*1000);
|
||||
LOGGER.info("此层为最后一层,使用时间为{}",time);
|
||||
fightEndResponse.setLastTowerTime(time);
|
||||
}else{
|
||||
|
@ -2113,7 +2119,7 @@ public class MapLogic {
|
|||
* @param messageType
|
||||
*/
|
||||
public void callChief(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
LOGGER.info("进入召唤boss");
|
||||
// LOGGER.info("进入召唤boss");
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
MapManager mapManager = user.getMapManager();
|
||||
|
@ -2138,7 +2144,7 @@ public class MapLogic {
|
|||
int mapId = config.getMapId();
|
||||
SChallengeMapConfig challengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(mapId);
|
||||
int[] mapSize = challengeMapConfig.getSize();
|
||||
LOGGER.info("width:{},height:{},当前:{}==={}",String.valueOf(mapSize[0]),String.valueOf(mapSize[1]),CellUtil.pos2XY(mapManager.getCurXY())[0],CellUtil.pos2XY(mapManager.getCurXY())[1]);
|
||||
// LOGGER.info("width:{},height:{},当前:{}==={}",String.valueOf(mapSize[0]),String.valueOf(mapSize[1]),CellUtil.pos2XY(mapManager.getCurXY())[0],CellUtil.pos2XY(mapManager.getCurXY())[1]);
|
||||
Set<Integer> xySet = CellUtil.getSurroundPos(mapSize[0],mapSize[1],mapManager.getCurXY());
|
||||
LOGGER.info(xySet.toString());
|
||||
Map<Integer, Cell> mapInfo = mapManager.getMapInfo();
|
||||
|
@ -2148,7 +2154,7 @@ public class MapLogic {
|
|||
Map<Integer, MapPointConfig> pointConfig = MapPointConfig.scMapEventMap;
|
||||
while (it.hasNext()){
|
||||
Integer n = it.next();
|
||||
LOGGER.info("遍历{},{}",CellUtil.pos2XY(n)[0],CellUtil.pos2XY(n)[1]);
|
||||
// LOGGER.info("遍历{},{}",CellUtil.pos2XY(n)[0],CellUtil.pos2XY(n)[1]);
|
||||
for(Map.Entry<Integer,Cell> cellEntry:mapInfo.entrySet()){
|
||||
if(cellEntry.getKey().equals(n)) {
|
||||
if (pointConfig.get(cellEntry.getValue().getPointId()).getStyle() != 0) {
|
||||
|
@ -2158,13 +2164,13 @@ public class MapLogic {
|
|||
}
|
||||
}
|
||||
}
|
||||
LOGGER.info("怪物可出现格子数量{}",String.valueOf(xySet.size()));
|
||||
// LOGGER.info("怪物可出现格子数量{}",String.valueOf(xySet.size()));
|
||||
int random = MathUtils.randomInt(xySet.size());
|
||||
LOGGER.info("random"+String.valueOf(random));
|
||||
// LOGGER.info("random"+String.valueOf(random));
|
||||
int i = 0;
|
||||
int xyResult = 0;
|
||||
for(Integer xy:xySet){
|
||||
LOGGER.info("怪物位置:{},{}",String.valueOf(CellUtil.pos2XY(xy)[0]),String.valueOf(CellUtil.pos2XY(xy)[1]));
|
||||
// LOGGER.info("怪物位置:{},{}",String.valueOf(CellUtil.pos2XY(xy)[0]),String.valueOf(CellUtil.pos2XY(xy)[1]));
|
||||
if(random==i){
|
||||
xyResult = xy;
|
||||
break;
|
||||
|
@ -2175,7 +2181,7 @@ public class MapLogic {
|
|||
// xyResult
|
||||
mapManager.setBossXY(xyResult);
|
||||
int randomPoint = MathUtils.randomFromWeight(pointId[type-1]);
|
||||
LOGGER.info("随机事件id:==>{}",randomPoint);
|
||||
// LOGGER.info("随机事件id:==>{}",randomPoint);
|
||||
MapInfoProto.MapTowerCallChiefResponse.Builder response = MapInfoProto.MapTowerCallChiefResponse.newBuilder();
|
||||
Cell cell = BehaviorUtil.addBehaviorInfo(user,randomPoint,mapManager,mapManager.getCurMapId(),CellUtil.pos2XY(xyResult)[0],CellUtil.pos2XY(xyResult)[1]);
|
||||
CommonProto.Cell protoCell =CBean2Proto.getCell(cell);
|
||||
|
|
|
@ -26,19 +26,19 @@ public class FightBehavior extends BaseBehavior {
|
|||
|
||||
@Override
|
||||
public boolean afterFight(User user, int[][] behaviorTypeValues, FightInfoProto.FightEndResponse.Builder fightEndResponse) throws Exception {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
|
||||
if (sChallengeConfig.getType() == 2) {
|
||||
int triggerXY = mapManager.getTriggerXY();
|
||||
Cell cell = mapManager.getMapInfo().get(triggerXY);
|
||||
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTower());
|
||||
int[][] randomMonsterType = sTrialConfig.getRandomMonsterType();
|
||||
if (randomMonsterType[0][1] == cell.getPointId()) {
|
||||
mapManager.setEssenceValue(mapManager.getEssenceValue() + sTrialConfig.getNormalEnergy());
|
||||
} else {
|
||||
mapManager.setEssenceValue(mapManager.getEssenceValue() + sTrialConfig.getEliteEnergy());
|
||||
}
|
||||
}
|
||||
// MapManager mapManager = user.getMapManager();
|
||||
// SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
|
||||
// if (sChallengeConfig.getType() == 2) {
|
||||
// int triggerXY = mapManager.getTriggerXY();
|
||||
// Cell cell = mapManager.getMapInfo().get(triggerXY);
|
||||
// STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTower());
|
||||
// int[][] randomMonsterType = sTrialConfig.getRandomMonsterType();
|
||||
// if (randomMonsterType[0][1] == cell.getPointId()) {
|
||||
// mapManager.setEssenceValue(mapManager.getEssenceValue() + sTrialConfig.getNormalEnergy());
|
||||
// } else {
|
||||
// mapManager.setEssenceValue(mapManager.getEssenceValue() + sTrialConfig.getEliteEnergy());
|
||||
// }
|
||||
// }
|
||||
BehaviorUtil.destoryCurPoint(user);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ public class CellUtil {
|
|||
if(x1 == x && y1 == y){
|
||||
continue;
|
||||
}
|
||||
System.out.println("x ->" + x1 + " y->" + y1);
|
||||
// System.out.println("x ->" + x1 + " y->" + y1);
|
||||
poses.add(xy2Pos(x1,y1));
|
||||
}
|
||||
y1=y-1;
|
||||
|
|
|
@ -29,7 +29,7 @@ public class MessageUtil {
|
|||
backMessage = new byte[0];
|
||||
} else {
|
||||
backMessage = generatedMessage.toByteArray();
|
||||
LOGGER.info(JsonFormat.printToString(generatedMessage));
|
||||
// LOGGER.info(JsonFormat.printToString(generatedMessage));
|
||||
}
|
||||
|
||||
int length = PackageConstant.UID_FIELD_LEN + PackageConstant.TOKEN_LEN
|
||||
|
|
Loading…
Reference in New Issue