试炼重置修改

back_recharge
lvxinran 2019-07-03 11:17:41 +08:00
parent 2252704adf
commit 3e3de9e38d
2 changed files with 39 additions and 18 deletions

View File

@ -1204,7 +1204,7 @@ public class MapLogic {
fightEndResponse.setEnventDrop(dropBuilder);
fightEndResponse.addAllRemainHpList(remainHp);
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==2&&mapManager.getTower()==STrialConfig.getHighestTower()){
fightEndResponse.setLastTowerTime((int)mapManager.getCurrTowerTime());
fightEndResponse.setLastTowerTime((int)mapManager.getCurrTowerTime()/1000);
}
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
return;
@ -1260,7 +1260,7 @@ public class MapLogic {
}
// if(mapManager.getBossType()==1)
if(mapManager.getTower()==STrialConfig.getHighestTower()&&mapManager.getBossType()!=0){
fightEndResponse.setLastTowerTime((int)(TimeUtils.now()-mapManager.getTowerStartTime())/1000);
fightEndResponse.setLastTowerTime((int)(mapManager.getTowerStartTime()/1000));
}else{
fightEndResponse.setLastTowerTime(0);
}
@ -2085,7 +2085,7 @@ public class MapLogic {
return "";
}
/**ouou
/**
*
*
* @param session
@ -2109,12 +2109,12 @@ public class MapLogic {
int[][] bossType = config.getRandomBossType();
type = MathUtils.randomFromWeight(bossType);
if(mapManager.getTower()<=3){
type = 3;
}
// if(mapManager.getTower()<=4){
// type = 2;
// }
// }else if(mapManager.getTower()==2){
// type = 3;
clearNormalMonster(user);
int[][][] pointId = config.getRandomMapPointId();
int mapId = config.getMapId();
SChallengeMapConfig challengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(mapId);
@ -2193,13 +2193,13 @@ public class MapLogic {
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"无炸弹");
return;
}
Map<Integer, Cell> mapInfo = mapManager.getMapInfo();
Map<Integer,SEventPointConfig> sEventPointConfig = SEventPointConfig.sEventPointConfigMap;
Set<Integer> destoryCell = new HashSet<>();
Map<Integer, MapPointConfig> configMap = MapPointConfig.scMapEventMap;
Map<int[],Float> rewardMap = new HashMap<>();
List<Integer> rewardRevert = new ArrayList<>();
int mosterAmount = 0;
Map<Integer, Cell> mapInfo = mapManager.getMapInfo();
for(Map.Entry<Integer,Cell> entry:mapInfo.entrySet()){
int monsterType = configMap.get(entry.getValue().getPointId()).getStyle();
if(monsterType==1||monsterType==11){
@ -2215,11 +2215,14 @@ public class MapLogic {
for(int i = 0 ; i <sMonsterGroup.getRewardgroup().length;i++){
rewardRevert.add(sMonsterGroup.getRewardgroup()[i]);
}
// rewardMap.put(,1f);
}
destoryCell.add(entry.getValue().getPointId());
}
}
LOGGER.info("几种:{}",mapInfo.size());
int[] x = Arrays.stream(destoryCell.toArray(new Integer[destoryCell.size()])).mapToInt(Integer::valueOf).toArray();
BehaviorUtil.destoryPoints(user,x);
int[] y = new int[rewardRevert.size()];
for(int i = 0 ; i <rewardRevert.size();i++){
y[i] = rewardRevert.get(i);
@ -2227,10 +2230,7 @@ public class MapLogic {
rewardMap.put(y,1f);
LOGGER.info("怪物数量:{}",mosterAmount);
CommonProto.Drop.Builder drop = ItemUtil.drop(user, rewardMap, BIReason.BOMB_REWARD);
LOGGER.info("几种:{}",mapInfo.size());
int[] x = Arrays.stream(destoryCell.toArray(new Integer[destoryCell.size()])).mapToInt(Integer::valueOf).toArray();
BehaviorUtil.destoryPoints(user,x);
mapManager.setEssenceValue(100);
MapInfoProto.MapTowerUseBombResponse.Builder response = MapInfoProto.MapTowerUseBombResponse.newBuilder();
@ -2239,6 +2239,25 @@ public class MapLogic {
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
}
public void clearNormalMonster(User user) throws Exception {
LOGGER.info("删除当前地图小怪!!");
Map<Integer, MapPointConfig> configMap = MapPointConfig.scMapEventMap;
Set<Integer> destoryCell = new HashSet<>();
Map<Integer, Cell> mapInfo = user.getMapManager().getMapInfo();
for(Map.Entry<Integer,Cell> entry:mapInfo.entrySet()){
int monsterType = configMap.get(entry.getValue().getPointId()).getStyle();
if(monsterType==1||monsterType==11){
if(entry.getValue().getEventId() == -1){
continue;
}
destoryCell.add(entry.getValue().getPointId());
}
}
LOGGER.info("几种:{}",mapInfo.size());
int[] x = Arrays.stream(destoryCell.toArray(new Integer[destoryCell.size()])).mapToInt(Integer::valueOf).toArray();
BehaviorUtil.destoryPoints(user,x);
}
/**
*
* @param iSession
@ -2260,9 +2279,13 @@ public class MapLogic {
return;
}
playerInfoManager.updateVipPrivilage(VipPrivilegeType.TOWER_RESRT_NUM,1);
int afterResetTower = mapManager.getTower()-(mapManager.getTower()%5);
if(mapManager.getHighestTower()==0){
MessageUtil.sendErrorResponse(iSession,0,messageType.getNumber(),"最高层数为0无需重置。");
return;
}
int afterResetTower = mapManager.getHighestTower()-(mapManager.getHighestTower()%5);
LOGGER.info("重置当前层,当前层为{},重置为{}",mapManager.getTower(),afterResetTower);
if(mapManager.getTower()>5){
if(mapManager.getTower()>=5){
mapManager.setTower(afterResetTower);
}else{
mapManager.setTower(1);

View File

@ -9,10 +9,7 @@ import com.ljsd.jieling.handler.mission.Mission;
import com.ljsd.jieling.logic.dao.Item;
import com.ljsd.jieling.logic.dao.PlayerManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.MathUtils;
import com.ljsd.jieling.util.StringUtil;
import com.ljsd.jieling.util.TimeUtils;
import com.ljsd.jieling.util.*;
import java.util.HashMap;
import java.util.HashSet;
@ -122,6 +119,7 @@ public class MapManager extends MongoBase {
}
public void setCurXY(int curXY) throws Exception {
System.out.println("设置位置!!!==============坐标"+ CellUtil.pos2XY(curXY)[0]+","+CellUtil.pos2XY(curXY)[1]);
updateString("curXY", curXY);
this.curXY = curXY;
}