战斗时间
parent
d84b58ac5b
commit
211c1d325d
|
|
@ -24,6 +24,7 @@ import org.luaj.vm2.LuaValue;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import redis.clients.jedis.Jedis;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
|
@ -821,7 +822,8 @@ public class MapLogic {
|
|||
int seed = (int)(System.currentTimeMillis()/1000);
|
||||
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterTeamList);
|
||||
LuaValue getOptionData = FightDataUtil.getOptionData("");
|
||||
int[] checkResult = CheckFight.getInstance().checkFight(seed, getFightData, getOptionData);
|
||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
|
||||
int[] checkResult = CheckFight.getInstance().checkFight(seed,sChallengeConfig.getMostTime(), getFightData, getOptionData);
|
||||
List<Integer> remainHp = new ArrayList<>(5);
|
||||
for (int i = 1; i < checkResult.length; i++) {
|
||||
if (checkResult[i] <= 0) {
|
||||
|
|
@ -840,7 +842,6 @@ public class MapLogic {
|
|||
int dieCount = user.getMapManager().getDieCount();
|
||||
dieCount++;
|
||||
user.getMapManager().setDieCount(dieCount);
|
||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
|
||||
int[] reviveTime = sChallengeConfig.getReviveTime();
|
||||
long time = (long) (MathUtils.calABX(dieCount, reviveTime) * 1000);
|
||||
user.getMapManager().setCanMoveTime(TimeUtils.now() + time);
|
||||
|
|
@ -951,7 +952,8 @@ public class MapLogic {
|
|||
groupId = option[0];
|
||||
}
|
||||
FightInfoProto.FightStartResponse.Builder fightStartResponse = FightInfoProto.FightStartResponse.newBuilder();
|
||||
BehaviorUtil.getFightInfo(user, groupId, fightStartResponse, pointId);
|
||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
|
||||
BehaviorUtil.getFightInfo(user, groupId, fightStartResponse, pointId,sChallengeConfig.getMostTime());
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightStartResponse.build(), true);
|
||||
}
|
||||
|
||||
|
|
@ -998,8 +1000,8 @@ public class MapLogic {
|
|||
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo,monsterTeamList);
|
||||
// LuaValue getFightData = FightDataUtil.getTestFightData();
|
||||
LuaValue getOptionData = FightDataUtil.getOptionData(frames);
|
||||
|
||||
int[] checkResult = CheckFight.getInstance().checkFight(seed, getFightData, getOptionData);
|
||||
int mostTime = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getMostTime();
|
||||
int[] checkResult = CheckFight.getInstance().checkFight(seed, mostTime,getFightData, getOptionData);
|
||||
|
||||
List<Integer> remainHp = new ArrayList<>(5);
|
||||
for (int i = 1; i < checkResult.length; i++) {
|
||||
|
|
@ -1593,7 +1595,7 @@ public class MapLogic {
|
|||
//扣除预先道具
|
||||
ItemUtil.itemCost(user,sLevelDifficultyConfig.getPreLevelCost());
|
||||
FightInfoProto.FightStartResponse.Builder fightStartResponse = FightInfoProto.FightStartResponse.newBuilder();
|
||||
BehaviorUtil.getLevelDifficultyifficuFightInfo(user,sLevelDifficultyConfig.getMonsterGroup(),teamId,fightStartResponse);
|
||||
BehaviorUtil.getLevelDifficultyifficuFightInfo(user,sLevelDifficultyConfig.getMonsterGroup(),teamId,sLevelDifficultyConfig.getRankTime(),fightStartResponse);
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightStartResponse.build(), true);
|
||||
}
|
||||
|
||||
|
|
@ -1662,7 +1664,7 @@ public class MapLogic {
|
|||
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo,monsterTeamList);
|
||||
LuaValue getOptionData = FightDataUtil.getOptionData(frames);
|
||||
|
||||
int[] checkResult = CheckFight.getInstance().checkFight(seed, getFightData, getOptionData);
|
||||
int[] checkResult = CheckFight.getInstance().checkFight(seed,sLevelDifficultyConfig.getRankTime(),getFightData, getOptionData);
|
||||
|
||||
// List<Integer> remainHp = new ArrayList<>(5);
|
||||
// for (int i = 1; i < checkResult.length; i++) {
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public class BehaviorUtil {
|
|||
* @param fightStartRespons
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void getFightInfo(User user, int groupId, FightInfoProto.FightStartResponse.Builder fightStartRespons, String pointId) throws Exception {
|
||||
public static void getFightInfo(User user, int groupId, FightInfoProto.FightStartResponse.Builder fightStartRespons, String pointId,int maxTime) throws Exception {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
|
||||
int teamId = mapManager.getTeamId();
|
||||
|
|
@ -113,6 +113,7 @@ public class BehaviorUtil {
|
|||
int seed = (int)(System.currentTimeMillis()/1000);
|
||||
// int seed = 1553167956;
|
||||
fightData.setFightSeed(seed);
|
||||
fightData.setFightMaxTime(maxTime);
|
||||
fightStartRespons.setFightData(fightData);
|
||||
|
||||
String key = RedisKey.getKey(RedisKey.FIGHT, user.getId(), false);
|
||||
|
|
@ -238,7 +239,7 @@ public class BehaviorUtil {
|
|||
}
|
||||
}
|
||||
|
||||
public static void getLevelDifficultyifficuFightInfo(User user,int groupId,int teamId, FightInfoProto.FightStartResponse.Builder fightStartRespons) {
|
||||
public static void getLevelDifficultyifficuFightInfo(User user,int groupId,int teamId, int maxTime,FightInfoProto.FightStartResponse.Builder fightStartRespons) {
|
||||
CommonProto.FightData.Builder fightData = CommonProto.FightData.newBuilder();
|
||||
CommonProto.FightTeamInfo fightTeamInfo = getFightTeamInfo(user, teamId);
|
||||
fightData.setHeroFightInfos(fightTeamInfo);
|
||||
|
|
@ -252,6 +253,7 @@ public class BehaviorUtil {
|
|||
//设置战斗随机种子
|
||||
int seed = (int)(System.currentTimeMillis()/1000);
|
||||
fightData.setFightSeed(seed);
|
||||
fightData.setFightMaxTime(maxTime);
|
||||
fightStartRespons.setFightData(fightData);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -75,11 +75,11 @@ public class CheckFight {
|
|||
* @param optionData
|
||||
* @return {战斗结果,单位1剩余血量,单位2剩余血量,单位3剩余血量,单位4剩余血量,单位5剩余血量}
|
||||
*/
|
||||
public synchronized int[] checkFight(int seed, LuaValue fightData, LuaValue optionData){
|
||||
public synchronized int[] checkFight(int seed,int maxTime, LuaValue fightData, LuaValue optionData){
|
||||
LuaValue func = transCoderObj.get(LuaValue.valueOf("Execute"));
|
||||
LuaValue args = new LuaTable();
|
||||
args.set("seed",seed);
|
||||
args.set("maxTime",300);
|
||||
args.set("maxTime",maxTime);
|
||||
LuaValue result = func.call( args,fightData,optionData);
|
||||
int status = result.get("result").toint();
|
||||
int[] resultCache = new int[6];
|
||||
|
|
|
|||
Loading…
Reference in New Issue