森罗环境 小怪计血量
parent
a8087e7b84
commit
20a0adb7fe
|
@ -817,9 +817,14 @@ public class MapManager extends MongoBase {
|
|||
trialInfo.setMapGameInfo(info);
|
||||
updateString("trialInfo.mapGameInfo",info);
|
||||
}
|
||||
public void updateBombUseCount(int bombUseCount){
|
||||
|
||||
public void updateBombUseCount(int bombUseCount) {
|
||||
trialInfo.setBombUseTimes(bombUseCount);
|
||||
updateString("trialInfo.bombUseTimes",bombUseCount);
|
||||
updateString("trialInfo.bombUseTimes", bombUseCount);
|
||||
}
|
||||
public void updateMapMonsterHp(Map<Integer,List<Integer>> monsterHp){
|
||||
trialInfo.setMonsterHp(monsterHp);
|
||||
updateString("trialInfo.monsterHp",monsterHp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,12 @@ public class TrialInfo {
|
|||
|
||||
private MapGameInfo mapGameInfo = new MapGameInfo();
|
||||
|
||||
|
||||
private int bombUseTimes;
|
||||
|
||||
private Map<Integer,List<Integer>> monsterHp = new HashMap<>();
|
||||
|
||||
|
||||
public Set<Integer> getTowerReceivedReward() {
|
||||
return towerReceivedReward;
|
||||
}
|
||||
|
@ -141,11 +145,20 @@ public class TrialInfo {
|
|||
this.mapGameInfo = mapGameInfo;
|
||||
}
|
||||
|
||||
|
||||
public int getBombUseTimes() {
|
||||
return bombUseTimes;
|
||||
}
|
||||
|
||||
public void setBombUseTimes(int bombUseTimes) {
|
||||
this.bombUseTimes = bombUseTimes;
|
||||
|
||||
}
|
||||
public Map<Integer, List<Integer>> getMonsterHp() {
|
||||
return monsterHp;
|
||||
}
|
||||
|
||||
public void setMonsterHp(Map<Integer, List<Integer>> monsterHp) {
|
||||
this.monsterHp = monsterHp;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -366,7 +366,15 @@ public class TowerMap extends AbstractMap {
|
|||
int groupId = option[0];
|
||||
int destoryXY = mapManager.getTriggerXY();
|
||||
|
||||
//更新血量
|
||||
TrialInfo trialInfo = mapManager.getTrialInfo();
|
||||
Map<Integer, List<Integer>> monsterHp = trialInfo.getMonsterHp();
|
||||
|
||||
PVEFightEvent pveFightEvent = new PVEFightEvent(uid, mapManager.getTeamId(), 10, "", GameFightType.MapFastFight, groupId, 3);
|
||||
//怪物剩余血量
|
||||
if(monsterHp!=null&&!monsterHp.isEmpty()&&monsterHp.containsKey(cell.getCellId())){
|
||||
pveFightEvent.setMonsterRemainHp(monsterHp.get(cell.getCellId()));
|
||||
}
|
||||
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||
int[] checkResult = fightResult.getCheckResult();
|
||||
|
||||
|
@ -374,11 +382,10 @@ public class TowerMap extends AbstractMap {
|
|||
//校验结果码 1:胜利
|
||||
int resultCode = checkResult[0];
|
||||
if (resultCode == -1) {
|
||||
// throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||
}
|
||||
mapManager.setLastFightResult(resultCode);
|
||||
//更新血量
|
||||
TrialInfo trialInfo = mapManager.getTrialInfo();
|
||||
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
|
||||
if(teamPosHeroInfos==null||teamPosHeroInfos.size()!=1){
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
|
@ -391,6 +398,15 @@ public class TowerMap extends AbstractMap {
|
|||
Map<Integer, Integer> property = trailHero.getProperty();
|
||||
Cell createCell = null;
|
||||
if (resultCode == 0) {
|
||||
//记录怪剩余血量
|
||||
List<Integer> hpList= new ArrayList<>();
|
||||
for(int i = 2;i<checkResult.length;i++){
|
||||
hpList.add(checkResult[i]);
|
||||
}
|
||||
if(monsterHp!=null){
|
||||
monsterHp.put(cell.getCellId(),hpList);
|
||||
}
|
||||
mapManager.updateMapMonsterHp(monsterHp);
|
||||
remainHp = 0;
|
||||
}else{
|
||||
//判断是否是打败的boss
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ljsd.jieling.logic.fight;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class FightEvent {
|
||||
|
@ -10,6 +11,7 @@ public class FightEvent {
|
|||
private String frames;
|
||||
private GameFightType fightType;
|
||||
private Map<String, Integer> attackBloodMap;
|
||||
private List<Integer> monsterRemainHp;
|
||||
|
||||
public FightEvent(int attackUid, int teamId,int mostTime,String frams, GameFightType fightType) {
|
||||
this.attackUid = attackUid;
|
||||
|
@ -50,4 +52,12 @@ public class FightEvent {
|
|||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public List<Integer> getMonsterRemainHp() {
|
||||
return monsterRemainHp;
|
||||
}
|
||||
|
||||
public void setMonsterRemainHp(List<Integer> monsterRemainHp) {
|
||||
this.monsterRemainHp = monsterRemainHp;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,9 @@ public class FightUtil {
|
|||
|
||||
|
||||
public static Map<Integer, List<CommonProto.FightUnitInfo>> makeMonsterGroup(int bossGroupId,Map<Integer,List<Integer>> hps){
|
||||
if(hps==null||hps.get(0)==null){
|
||||
return makeMonsterGroup(bossGroupId);
|
||||
}
|
||||
return MonsterUtil.getMonsterByGroup(bossGroupId,hps);
|
||||
}
|
||||
|
||||
|
@ -70,8 +73,8 @@ public class FightUtil {
|
|||
}
|
||||
|
||||
//防守方是怪物
|
||||
public static List<CommonProto.FightTeamInfo> makeMonsterFightData(int bossGroupId,int nums){
|
||||
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = makeMonsterGroup(bossGroupId);
|
||||
public static List<CommonProto.FightTeamInfo> makeMonsterFightData(int bossGroupId,int nums,Map<Integer,List<Integer>> monsterHp){
|
||||
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = makeMonsterGroup(bossGroupId,monsterHp);
|
||||
List<CommonProto.FightTeamInfo> monsterTeamList = new ArrayList<>(nums);
|
||||
for(int i=0;i<nums;i++){
|
||||
List<CommonProto.FightTeamInfo> monsterGroupList = BehaviorUtil.getFightTeamInfos(bossGroupId, monsterByGroup, i);
|
||||
|
@ -90,7 +93,11 @@ public class FightUtil {
|
|||
User userInMem = UserManager.getUserInMem(pveFightEvent.getAttackUid());
|
||||
CommonProto.FightTeamInfo fightTeamInfo = makePersonFightData(userInMem, pveFightEvent.getTeamId(),pveFightEvent.getAttackBloodMap());
|
||||
int fightSeed =getFightSeed();
|
||||
List<CommonProto.FightTeamInfo> monsterfightTeamInfos = makeMonsterFightData(pveFightEvent.getMonsterGroupId(), pveFightEvent.getNums());
|
||||
//怪物剩余血量
|
||||
List<Integer> monsterRemainHp = pveFightEvent.getMonsterRemainHp();
|
||||
Map<Integer,List<Integer>> remainHp = new HashMap<>();
|
||||
remainHp.put(0,monsterRemainHp);
|
||||
List<CommonProto.FightTeamInfo> monsterfightTeamInfos = makeMonsterFightData(pveFightEvent.getMonsterGroupId(), pveFightEvent.getNums(),remainHp);
|
||||
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterfightTeamInfos);
|
||||
LuaValue getOptionData = FightDataUtil.getOptionData(pveFightEvent.getAttackUid()+"");
|
||||
int[] fightResult = CheckFight.getInstance().checkFight(fightSeed, fightEvent.getMostTime(), getFightData, getOptionData, fightEvent.getFightType().getFightType());
|
||||
|
|
Loading…
Reference in New Issue