行为10 支持 快速战斗
parent
e4c1867bae
commit
b229e02637
|
@ -805,6 +805,9 @@ public class MapLogic {
|
|||
mapManager.setTriggerXY(0);
|
||||
mapManager.setDieCount(0);
|
||||
mapManager.setCanMoveTime(0);
|
||||
mapManager.setMonsterId(0);
|
||||
mapManager.setDoneKillNum(0);
|
||||
mapManager.setNeedKillNum(0);
|
||||
mapManager.setStars(null);
|
||||
TemporaryItems temporaryItems = mapManager.getTemporaryItems();
|
||||
mapManager.setMission(null);
|
||||
|
@ -930,10 +933,15 @@ public class MapLogic {
|
|||
}
|
||||
|
||||
BehaviorUtil.destoryApointXY(user, destoryXY);
|
||||
|
||||
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(groupId);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 1,BIReason.MAP_FAST_FIGHT_REWARD);
|
||||
FightInfoProto.FastFightResponse.Builder fastFightResponse = FightInfoProto.FastFightResponse.newBuilder();
|
||||
|
||||
if (mapManager.getMonsterId() > 0) {
|
||||
BaseBehavior baseBehavior = baseBehaviorMap.get(10);
|
||||
baseBehavior.afterFastFight(user, groupId, fastFightResponse);
|
||||
}
|
||||
|
||||
fastFightResponse.setEnventDrop(drop.build());
|
||||
fastFightResponse.setResult(resultCode);
|
||||
fastFightResponse.addAllRemainHpList(remainHp);
|
||||
|
|
|
@ -44,7 +44,9 @@ public class MapManager extends MongoBase {
|
|||
|
||||
private int monsterId;
|
||||
|
||||
private int monsterNum;
|
||||
private int needKillNum;
|
||||
|
||||
private int doneKillNum;
|
||||
|
||||
private int lastUpdateEnergyTime;
|
||||
|
||||
|
@ -243,13 +245,22 @@ public class MapManager extends MongoBase {
|
|||
return monsterId;
|
||||
}
|
||||
|
||||
public int getMonsterNum() {
|
||||
return monsterNum;
|
||||
public int getNeedKillNum() {
|
||||
return needKillNum;
|
||||
}
|
||||
|
||||
public void setMonsterNum(int monsterNum) {
|
||||
updateString("monsterNum", monsterNum);
|
||||
this.monsterNum = monsterNum;
|
||||
public void setNeedKillNum(int needKillNum) {
|
||||
updateString("needKillNum", needKillNum);
|
||||
this.needKillNum = needKillNum;
|
||||
}
|
||||
|
||||
public int getDoneKillNum() {
|
||||
return doneKillNum;
|
||||
}
|
||||
|
||||
public void setDoneKillNum(int doneKillNum) {
|
||||
updateString("doneKillNum", doneKillNum);
|
||||
this.doneKillNum = doneKillNum;
|
||||
}
|
||||
|
||||
public int getLastUpdateEnergyTime() {
|
||||
|
|
|
@ -17,6 +17,10 @@ public abstract class BaseBehavior {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean afterFastFight(User user, int monsterId, FightInfoProto.FastFightResponse.Builder fastFightResponse) throws Exception {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isFightBehavior() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -255,6 +255,25 @@ public class BehaviorUtil {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 快速战斗结束更新任务
|
||||
*/
|
||||
public static boolean updateMissionFastFight(User user, FightInfoProto.FastFightResponse.Builder fastFightResponse) throws Exception {
|
||||
Mission mission = user.getMapManager().getMission();
|
||||
if (mission == null) {
|
||||
return false;
|
||||
}
|
||||
CheckMissionReturn checkMissionReturn = MapLogic.getInstance().checkMission(user);
|
||||
if (checkMissionReturn != null) {
|
||||
CommonProto.Mission missionProto = MapLogic.getInstance().getMission(checkMissionReturn.mission);
|
||||
fastFightResponse.setMission(missionProto);
|
||||
if (checkMissionReturn.drop != null) {
|
||||
fastFightResponse.setMissionDrop(checkMissionReturn.drop);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 销毁当前点
|
||||
* @param user
|
||||
|
|
|
@ -17,6 +17,7 @@ public class MonitorMissionBehavior extends BaseBehavior {
|
|||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||
boolean b = BehaviorUtil.updateMission(user, eventUpdateResponse);
|
||||
user.getMapManager().setMonsterId(behaviorTypeValues[0][0]);
|
||||
user.getMapManager().setNeedKillNum(behaviorTypeValues[0][1]);
|
||||
for (int i = 1; i < behaviorTypeValues.length; i++) {
|
||||
BehaviorUtil.addBehaviorInfo(user, behaviorTypeValues[i][3], user.getMapManager(), behaviorTypeValues[i][0], behaviorTypeValues[i][1], behaviorTypeValues[i][2]);
|
||||
}
|
||||
|
@ -30,11 +31,23 @@ public class MonitorMissionBehavior extends BaseBehavior {
|
|||
|
||||
@Override
|
||||
public boolean afterFight(User user, int[][] behaviorTypeValues, FightInfoProto.FightEndResponse.Builder fightEndResponse) throws Exception {
|
||||
int monsterNum = user.getMapManager().getMonsterNum();
|
||||
if (behaviorTypeValues[0][0] == user.getMapManager().getMonsterId() && monsterNum < behaviorTypeValues[0][1]) {
|
||||
user.getMapManager().setMonsterNum(monsterNum + 1);
|
||||
int doneKillNum = user.getMapManager().getDoneKillNum();
|
||||
int needKillNum = user.getMapManager().getNeedKillNum();
|
||||
if (behaviorTypeValues[0][0] == user.getMapManager().getMonsterId() && doneKillNum < needKillNum) {
|
||||
user.getMapManager().setDoneKillNum(doneKillNum + 1);
|
||||
BehaviorUtil.updateMissionEndFight(user, fightEndResponse);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean afterFastFight(User user, int monsterId, FightInfoProto.FastFightResponse.Builder fastFightResponse) throws Exception {
|
||||
int doneKillNum = user.getMapManager().getDoneKillNum();
|
||||
int needKillNum = user.getMapManager().getNeedKillNum();
|
||||
if (monsterId == user.getMapManager().getMonsterId() && doneKillNum < needKillNum) {
|
||||
user.getMapManager().setDoneKillNum(doneKillNum + 1);
|
||||
BehaviorUtil.updateMissionFastFight(user, fastFightResponse);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue