back_recharge
zhangshanxue 2020-07-02 16:17:02 +08:00
commit bcee7dc40f
3 changed files with 27 additions and 15 deletions

View File

@ -3217,6 +3217,7 @@ public class MapLogic {
}
}
List<Cell> deleteCell = new ArrayList<>();
//判断添加buff
for(Cell cell:mapInfo.values()){
if(MapPointConfig.getScMapEventMap().get(cell.getPointId()).getStyle()!=9){//9为地图点buff类型
@ -3224,11 +3225,19 @@ public class MapLogic {
}
int optionId = STableManager.getConfig(SEventPointConfig.class).get(cell.getEventId()).getOption()[0];
SOptionConfig sOptionConfig = SOptionConfig.sOptionConfigMap.get(optionId);
int behaviorType = sOptionConfig.getBehaviorType();
BaseBehavior baseBehavior = baseBehaviorMap.get(behaviorType);
baseBehavior.process(optionId,user,sOptionConfig.getBehaviorTypeValues(),null);
List<Integer> buffIds = mapManager.getTrialInfo().getBuffIds();
for(int[] values:sOptionConfig.getBehaviorTypeValues()){
for(int value:values){
buffIds.add(value);
}
}
deleteCell.add(cell);
mapManager.updateTrialBuffIds(buffIds);
response.addBuffIds(sOptionConfig.getBehaviorTypeValues()[0][0]);
}
for(Cell cell:deleteCell){
BehaviorUtil.destoryApointXY(user,cell.getCellId());
}
}else{
for(int i = 0 ; i<boxPosition.length;i++){
int xyPos = CellUtil.xy2Pos(boxPosition[i][0], boxPosition[i][1]);
@ -3269,7 +3278,7 @@ public class MapLogic {
for(int id:ids){
idList.add(id);
}
// BehaviorUtil.destoryCurPoint(user);
BehaviorUtil.destoryCurPoint(user);
MapInfoProto.MapGameResponse response = MapInfoProto.MapGameResponse.newBuilder().setType(mapGameInfo.getType()).addAllParam(idList).build();
MessageUtil.sendMessage(session,1,messageType.getNumber(),response,true);
}

View File

@ -59,7 +59,7 @@ public class BombGame extends ColorGame {
public MapInfoProto.MapGameUpdateResponse updateGame(User user, Object... params) throws Exception {
MapGameInfo mapGameInfo = user.getMapManager().getTrialInfo().getMapGameInfo();
if(mapGameInfo==null){
return null;
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
Set<Integer> operationInfo = mapGameInfo.getOperationInfo();
if(operationInfo.size()==3){
@ -74,7 +74,7 @@ public class BombGame extends ColorGame {
CommonProto.Drop.Builder drop = null;
//是否抽到炸弹
//是否已经抽取过该位置
if(operationInfo.contains((int)params[0]-1)){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
@ -88,11 +88,11 @@ public class BombGame extends ColorGame {
}else{
user.getMapManager().updateMapGameInfo(null);
}
MapInfoProto.MapGameUpdateResponse response = MapInfoProto.MapGameUpdateResponse.newBuilder().setDrop(drop)
.setGameStatus(gameStatus)
.setResultId(resultId).build();
return response;
MapInfoProto.MapGameUpdateResponse.Builder response = MapInfoProto.MapGameUpdateResponse.newBuilder().setGameStatus(gameStatus).setResultId(resultId);
if(drop!=null){
response.setDrop(drop);
}
return response.build();
}
//乱序数组
private int [] shuffle(int [] arr) {

View File

@ -20,6 +20,7 @@ import java.util.concurrent.TimeUnit;
* @discribe
*/
public class ForceCurrRank extends AbstractRank implements IEventHandler{
private static int TRANSPORT_SIZE = 100;
public ForceCurrRank(int type, String redisKey) {
super(type, redisKey);
@ -62,11 +63,13 @@ public class ForceCurrRank extends AbstractRank implements IEventHandler{
int size = infoQueue.size();
List<UserMainTeamForceEvent> eventList = new ArrayList<>(size);
if(size<100){
for(int i = 0 ; i < size;i++){
eventList.add(infoQueue.poll());
}
//看队列长度和每次最多传输多少比较,找最小
int transport = Math.min(size,TRANSPORT_SIZE);
for(int i = 0 ; i < transport;i++){
eventList.add(infoQueue.poll());
}
Set<Integer> changeId = new HashSet<>();
eventList.forEach(n->changeId.add(n.getUid()));
changeId.forEach(i-> {