区分战斗行为

back_recharge
jiahuiwen 2019-04-29 16:15:26 +08:00
parent 6992512d3b
commit 519679a116
7 changed files with 37 additions and 9 deletions

View File

@ -469,11 +469,10 @@ public class MapLogic {
} }
int nextEventId = 0; int nextEventId = 0;
// 战斗事件需要放到战斗胜利 // 战斗事件需要放到战斗胜利
if (behaviorType != EventType.fight && behaviorType != EventType.fightAndDestroyPoint if (baseBehavior == null || !baseBehavior.isFightBehavior()) {
&& behaviorType != EventType.thirtyTwo && behaviorType != EventType.destroyPointAnd) {
// 检测该事件点是否已被销毁 // 检测该事件点是否已被销毁
nextEventId = getNextEventId(user, cell, sOptionConfig);
if (cell != null && nextEventId != 0) { if (cell != null && nextEventId != 0) {
nextEventId = getNextEventId(user, cell, sOptionConfig);
cell.setEventId(nextEventId); cell.setEventId(nextEventId);
mapManager.addOrUpdateCell(cell.getCellId(), cell); mapManager.addOrUpdateCell(cell.getCellId(), cell);
} }

View File

@ -16,4 +16,8 @@ public abstract class BaseBehavior {
public boolean afterFight(User user, int[][] behaviorTypeValues, FightInfoProto.FightEndResponse.Builder fightEndResponse) throws Exception { public boolean afterFight(User user, int[][] behaviorTypeValues, FightInfoProto.FightEndResponse.Builder fightEndResponse) throws Exception {
return false; return false;
} }
public boolean isFightBehavior() {
return false;
}
} }

View File

@ -15,8 +15,8 @@ public class DestroyPointAndBehavior extends BaseBehavior {
@Override @Override
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception { public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
// readyInfo: optionId // readyInfo: groupId#optionId
String readyInfo = Integer.toString(optionId); String readyInfo = behaviorTypeValues[0][0] + "#" + Integer.toString(optionId);
BehaviorUtil.fightReady(user.getId(), readyInfo); BehaviorUtil.fightReady(user.getId(), readyInfo);
return true; return true;
} }
@ -26,4 +26,9 @@ public class DestroyPointAndBehavior extends BaseBehavior {
BehaviorUtil.destoryPoint(user, user.getMapManager().getCurMapId(), behaviorTypeValues[0][1]); BehaviorUtil.destoryPoint(user, user.getMapManager().getCurMapId(), behaviorTypeValues[0][1]);
return true; return true;
} }
@Override
public boolean isFightBehavior() {
return true;
}
} }

View File

@ -16,7 +16,7 @@ public class FightAndDestroyPointBehavior extends BaseBehavior {
@Override @Override
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception { public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
// optionId // optionId
String readyInfo = Integer.toString(optionId); String readyInfo = behaviorTypeValues[0][1] + "#" + Integer.toString(optionId);
BehaviorUtil.fightReady(user.getId(), readyInfo); BehaviorUtil.fightReady(user.getId(), readyInfo);
return true; return true;
} }
@ -27,4 +27,9 @@ public class FightAndDestroyPointBehavior extends BaseBehavior {
BehaviorUtil.destoryPoint(user, 0, behaviorTypeValues[0][2]); BehaviorUtil.destoryPoint(user, 0, behaviorTypeValues[0][2]);
return true; return true;
} }
@Override
public boolean isFightBehavior() {
return true;
}
} }

View File

@ -15,7 +15,7 @@ public class FightBehavior extends BaseBehavior {
@Override @Override
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception { public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
BehaviorUtil.fightReady(user.getId(), Integer.toString(optionId)); BehaviorUtil.fightReady(user.getId(), behaviorTypeValues[0][0] + "#" + Integer.toString(optionId));
return true; return true;
} }
@ -24,4 +24,9 @@ public class FightBehavior extends BaseBehavior {
BehaviorUtil.destoryCurPoint(user); BehaviorUtil.destoryCurPoint(user);
return true; return true;
} }
@Override
public boolean isFightBehavior() {
return true;
}
} }

View File

@ -14,7 +14,7 @@ public class ThirtyThreeBehavior extends BaseBehavior {
@Override @Override
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception { public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
// readyInfo: 怪物组id#任务id#需要销毁事件id => 怪物组id#optionId // readyInfo: 怪物组id#任务id#需要销毁事件id => 怪物组id#optionId
String readyInfo = Integer.toString(optionId); String readyInfo = behaviorTypeValues[0][0] + "#" + Integer.toString(optionId);
BehaviorUtil.fightReady(user.getId(), readyInfo); BehaviorUtil.fightReady(user.getId(), readyInfo);
return true; return true;
} }
@ -27,4 +27,9 @@ public class ThirtyThreeBehavior extends BaseBehavior {
} }
return true; return true;
} }
@Override
public boolean isFightBehavior() {
return true;
}
} }

View File

@ -16,7 +16,7 @@ public class ThirtyTwoBehavior extends BaseBehavior {
@Override @Override
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception { public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
// readyInfo: 怪物组id#任务id#需要销毁事件id => 怪物组id#optionId // readyInfo: 怪物组id#任务id#需要销毁事件id => 怪物组id#optionId
String readyInfo = Integer.toString(optionId); String readyInfo = behaviorTypeValues[0][0] + "#" + Integer.toString(optionId);
BehaviorUtil.fightReady(user.getId(), readyInfo); BehaviorUtil.fightReady(user.getId(), readyInfo);
return true; return true;
} }
@ -30,4 +30,9 @@ public class ThirtyTwoBehavior extends BaseBehavior {
} }
return true; return true;
} }
@Override
public boolean isFightBehavior() {
return true;
}
} }