增加新行为 10
parent
f768d3552f
commit
d2107490de
|
@ -41,7 +41,10 @@ public class MapManager extends MongoBase {
|
||||||
private Map<String,Map<Integer, Integer>> heroAllAttributeMap = new HashMap<>(5);
|
private Map<String,Map<Integer, Integer>> heroAllAttributeMap = new HashMap<>(5);
|
||||||
|
|
||||||
private MapMission mapMissionProgres;
|
private MapMission mapMissionProgres;
|
||||||
private int energy;
|
|
||||||
|
private int monsterId;
|
||||||
|
|
||||||
|
private int monsterNum;
|
||||||
|
|
||||||
private int lastUpdateEnergyTime;
|
private int lastUpdateEnergyTime;
|
||||||
|
|
||||||
|
@ -208,9 +211,22 @@ public class MapManager extends MongoBase {
|
||||||
this.lastUpdateEnergyTime = lastUpdateEnergyTime;
|
this.lastUpdateEnergyTime = lastUpdateEnergyTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnergy(int energy) {
|
public void setMonsterId(int monsterId) {
|
||||||
updateString("energy", energy);
|
updateString("monsterId", monsterId);
|
||||||
this.energy = energy;
|
this.monsterId = monsterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMonsterId() {
|
||||||
|
return monsterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMonsterNum() {
|
||||||
|
return monsterNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMonsterNum(int monsterNum) {
|
||||||
|
updateString("monsterNum", monsterNum);
|
||||||
|
this.monsterNum = monsterNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLastUpdateEnergyTime() {
|
public int getLastUpdateEnergyTime() {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.handler.map.behavior;
|
||||||
|
|
||||||
import com.ljsd.jieling.handler.map.EventType;
|
import com.ljsd.jieling.handler.map.EventType;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.protocols.FightInfoProto;
|
||||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -15,6 +16,25 @@ public class MonitorMissionBehavior 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 {
|
||||||
boolean b = BehaviorUtil.updateMission(user, eventUpdateResponse);
|
boolean b = BehaviorUtil.updateMission(user, eventUpdateResponse);
|
||||||
|
user.getMapManager().setMonsterId(behaviorTypeValues[0][0]);
|
||||||
|
for (int i = 1; i < behaviorTypeValues.length; i++) {
|
||||||
|
BehaviorUtil.addBehaviorInfo(behaviorTypeValues[i][3], user.getMapManager(), behaviorTypeValues[i][0], behaviorTypeValues[i][1], behaviorTypeValues[i][2]);
|
||||||
|
}
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFightBehavior() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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);
|
||||||
|
BehaviorUtil.updateMissionEndFight(user, fightEndResponse);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue