back_recharge
jiahuiwen 2019-03-27 19:59:14 +08:00
commit 3c51f87439
3 changed files with 46 additions and 9 deletions

View File

@ -243,9 +243,43 @@ public class MapLogic {
initMapMission(mapManager);
}
public boolean updateMapByOnlyConsumeActionPower(ISession session, int curXY,int triggerXY, List<Integer> cells,MessageTypeProto.MessageType messageType) throws Exception {
if(triggerXY == -1){
int uid = session.getUid();
User user = UserManager.getUser(uid);
MapManager mapManager = user.getMapManager();
SCMapConfig scMapConfig = SCMapConfig.getsCMapSize().get(mapManager.getCurMapId());
int moveConfused = scMapConfig.getMoveConfused();
if (moveConfused > 0) {
int leftStep = mapManager.getTotalStep() - cells.size() * moveConfused;
if (leftStep <0) {
leftStep = 0;
resetMapInfo(user, false);
LOGGER.info("updateMap() uid=>{}, leftStep=>{}", uid, leftStep);
MapInfoProto.MapUpdateResponse mapUpdateResponse = MapInfoProto.MapUpdateResponse.newBuilder().build();
MessageUtil.sendMessage(session, 0, messageType.getNumber(), mapUpdateResponse, true);
}
updateMapMission(mapManager,EventType.updateEvent,MapMissionType.CONSUME_ACTION_POWER_EVENT.getMissionTypeValue(),cells.size() * moveConfused);
mapManager.setTotalStep(leftStep);
mapManager.addWalkCells(new HashSet<>(cells));
mapManager.setCurXY(curXY);
MapInfoProto.MapUpdateResponse mapUpdateResponse = MapInfoProto.MapUpdateResponse.newBuilder()
.setLeftStep(mapManager.getTotalStep())
.build();
MessageUtil.sendMessage(session, 1, messageType.getNumber(), mapUpdateResponse, true);
}
return true;
}
return false;
}
public void updateMap(ISession session, int curXY, int triggerXY, List<Integer> cells, MessageTypeProto.MessageType messageType) throws Exception {
// LOGGER.info("updateMap() curXY=>{},triggerXY=>{}", curXY, triggerXY);
if(updateMapByOnlyConsumeActionPower(session,curXY,triggerXY,cells,messageType)){
return;
}
if (triggerXY != curXY) {
boolean isConnect = CellUtil.checkIsNextCell(curXY, triggerXY);
if (!isConnect) {
@ -278,6 +312,7 @@ public class MapLogic {
int leftStep = mapManager.getTotalStep() - cells.size() * moveConfused;
if (leftStep <= 0) {
leftStep = 0;
updateMapMission(mapManager,EventType.updateEvent,MapMissionType.CONSUME_ACTION_POWER_EVENT.getMissionTypeValue(),cells.size() * moveConfused);
resetMapInfo(user, false);
LOGGER.info("updateMap() uid=>{}, leftStep=>{}", uid, leftStep);
MapInfoProto.MapUpdateResponse mapUpdateResponse = MapInfoProto.MapUpdateResponse.newBuilder().build();
@ -485,7 +520,7 @@ public class MapLogic {
// LOGGER.info("updateEvent =====>success<====== xy=>{}, getPointId=>{} eventId={}, mission=>{}, nextEventId=>{}, eventBehaviorCommon=>{}", mapManager.getCurXY(), cell == null ? 0 : cell.getPointId(),
// cell == null ? 0 : cell.getEventId(), eventUpdateResponse.getMissionList(), nextEventId, eventBehaviorCommon);
saveRefreshInfo(pointId, mapManager, mapPointConfig, nextEventId);
updateMapMission(mapManager,EventType.updateEvent,eventId,0);
updateMapMission(mapManager,EventType.updateEvent,pointId,0);
MessageUtil.sendMessage(session, 1, messageType.getNumber(), eventUpdateResponse.build(), true);
}
@ -920,9 +955,11 @@ public class MapLogic {
if(eventType == EventType.updateEvent){
if(logic == eventId){
if(missionValue<targetEventValue){
allMissionProgress.put(missionId,missionValue+bossIdOrItemId);
int source = missionValue + bossIdOrItemId;
int result = MathUtils.setBetweenWithMax(source, 0, targetEventValue);
allMissionProgress.put(missionId,result);
needUpdate = true;
if(missionValue+bossIdOrItemId == targetEventValue){
if(result== targetEventValue){
addScore+=score;
}
}

View File

@ -6,10 +6,10 @@ public enum MapMissionType {
VICTORY_EVENT(3), //本次地图获得战斗胜利次数
BUY_GOODS_ID_EVENT(4), //在本图行脚商人购买某物
DIGGER_EVENT(5), //本地图采矿都少次
COLLECT_GOODS_ID_EVENT(6), //在收集商人那边兑换出来物品
CONSUME_ACTION_POWER_EVENT(7), //在本次地图内消耗多少行动力
OPEN_BOX(8), //在本次地图内消耗多少行动力
BUY_GOODS_TYPE_EVENT(9); //在本图行脚商人购买某类物品
// COLLECT_GOODS_ID_EVENT(6), //在收集商人那边兑换出来物品
CONSUME_ACTION_POWER_EVENT(6), //在本次地图内消耗多少行动力
OPEN_BOX(7), //在本次地图内消耗多少行动力
BUY_GOODS_TYPE_EVENT(8); //在本图行脚商人购买某类物品
private int missionType;

View File

@ -408,7 +408,7 @@ public class HeroLogic {
}else{
hero.setBreakId(breakId);
}
Map<Integer, Integer> heroAllAttribute = calHeroAllAttribute(hero);
Map<Integer, Integer> heroAllAttribute = calHeroFinalAttribute(user,hero);
for(Map.Entry<Integer,Integer> item : heroAllAttribute.entrySet() ){
LOGGER.info("the heroTdd={},the heroLevel={},the attID is={},attValue={}",hero.getTemplateId(),hero.getLevel(),item.getKey(),item.getValue() );
}
@ -767,7 +767,7 @@ public class HeroLogic {
private void combinedAttribute(int[][] otherAttriMap,Map<Integer,Integer> heroAttributeMap){
for(int[] item : otherAttriMap){
int propertyId = item[0];
int propertyValue = item[0];
int propertyValue = item[1];
if(heroAttributeMap.containsKey(propertyId)){
propertyValue += heroAttributeMap.get(propertyId);
}