没小怪时不能使用炸弹

back_recharge
lvxinran 2021-08-02 10:55:37 +08:00
parent 9797af171b
commit 5c0a4802b9
1 changed files with 8 additions and 4 deletions

View File

@ -627,10 +627,6 @@ public class TowerMap extends AbstractMap {
if(mapManager.getTrialInfo().getEnergy()==-1){ if(mapManager.getTrialInfo().getEnergy()==-1){
throw new ErrorCodeException(ErrorCode.USE_BOMB_BOSS); throw new ErrorCodeException(ErrorCode.USE_BOMB_BOSS);
} }
boolean isUse = ItemUtil.itemCost(user,bomb,BIReason.BOMB_CONSUME,mapManager.getCurMapId());
if(!isUse){
throw new ErrorCodeException(ErrorCode.USE_BOMB_NO_BOSS);
}
Map<Integer,SEventPointConfig> sEventPointConfig = STableManager.getConfig(SEventPointConfig.class); Map<Integer,SEventPointConfig> sEventPointConfig = STableManager.getConfig(SEventPointConfig.class);
Set<Integer> destoryCell = new HashSet<>(); Set<Integer> destoryCell = new HashSet<>();
Map<Integer, MapPointConfig> configMap = MapPointConfig.scMapEventMap; Map<Integer, MapPointConfig> configMap = MapPointConfig.scMapEventMap;
@ -656,6 +652,14 @@ public class TowerMap extends AbstractMap {
destoryCell.add(entry.getValue().getPointId()); destoryCell.add(entry.getValue().getPointId());
} }
} }
if(monsterAmount==0){
//没有小怪,无需使用炸弹
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
boolean isUse = ItemUtil.itemCost(user,bomb,BIReason.BOMB_CONSUME,mapManager.getCurMapId());
if(!isUse){
throw new ErrorCodeException(ErrorCode.USE_BOMB_NO_BOSS);
}
LOGGER.info("几种:{}",mapInfo.size()); LOGGER.info("几种:{}",mapInfo.size());
int[] x = Arrays.stream(destoryCell.toArray(new Integer[destoryCell.size()])).mapToInt(Integer::valueOf).toArray(); int[] x = Arrays.stream(destoryCell.toArray(new Integer[destoryCell.size()])).mapToInt(Integer::valueOf).toArray();
BehaviorUtil.destoryPoints(user,x); BehaviorUtil.destoryPoints(user,x);