巅峰赛提交
parent
e505a2e773
commit
cd176b3418
|
@ -106,10 +106,10 @@ public class CheckFight {
|
|||
int[] resultCache = new int[8];//对方阵容走配置 Todo 后面结构走配置
|
||||
resultCache[0]=status;
|
||||
resultCache[1]=duration;
|
||||
LOGGER.info(" lua check test fight result : "+ status);
|
||||
// LOGGER.info(" lua check test fight result : "+ status);
|
||||
for (int i = 1; i <= result.length(); i++) {
|
||||
resultCache[i+1] = result.rawget(i).toint();
|
||||
LOGGER.info(i+" --> 单位剩余血量 : "+ resultCache[i+1]);
|
||||
// LOGGER.info(i+" --> 单位剩余血量 : "+ resultCache[i+1]);
|
||||
}
|
||||
|
||||
return resultCache;
|
||||
|
|
|
@ -84,6 +84,20 @@ function BattleLogic.Init(data, optionData, maxRound)
|
|||
BattleLogManager.Init(fightData)
|
||||
end
|
||||
|
||||
-- 检测先手阵营
|
||||
function BattleLogic.CheckFirstCamp()
|
||||
-- 默认我方先手
|
||||
BattleLogic.FirstCamp = 0
|
||||
-- 数据不存在时,兼容老战斗数据
|
||||
if not fightData.playerData.firstCamp and not fightData.enemyData[BattleLogic.CurOrder].firstCamp then
|
||||
return
|
||||
end
|
||||
-- 敌方先手
|
||||
if fightData.playerData.firstCamp == 0 and fightData.enemyData[BattleLogic.CurOrder].firstCamp == 1 then
|
||||
BattleLogic.FirstCamp = 1
|
||||
end
|
||||
end
|
||||
|
||||
function BattleLogic.StartOrder()
|
||||
--
|
||||
BattleLogic.CurOrder = BattleLogic.CurOrder + 1
|
||||
|
@ -104,7 +118,8 @@ function BattleLogic.StartOrder()
|
|||
RoleManager.AddRole(orderList[i], orderList[i].position)
|
||||
end
|
||||
end
|
||||
|
||||
-- 检测先后手
|
||||
BattleLogic.CheckFirstCamp()
|
||||
-- 开始战斗,延时一帧执行,避免战斗还没开始就释放了技能
|
||||
BattleLogic.TurnRoundNextFrame()
|
||||
end
|
||||
|
@ -156,7 +171,7 @@ function BattleLogic.TurnRound(debugTurn)
|
|||
-- 第一次进入 或者 本轮结束 初始化流程状态
|
||||
if CurRound == 0 or (CurSkillPos[0] == 6 and CurSkillPos[1] == 6) then
|
||||
CurRound = CurRound + 1
|
||||
CurCamp = 0
|
||||
CurCamp = BattleLogic.FirstCamp -- 判断先手阵营
|
||||
CurSkillPos[0] = 0
|
||||
CurSkillPos[1] = 0
|
||||
--
|
||||
|
|
|
@ -92,6 +92,7 @@ public interface GlobalsDef {
|
|||
int EXPEDITION_TEAM =1001; //
|
||||
int CAR_DELAY_TEAM =1101; //车迟斗法
|
||||
int DEATH_PATH_TEAM = 1201;//十绝阵
|
||||
int CHAMPION_TEAM = 1301; //巅峰赛
|
||||
|
||||
//特权解锁类型
|
||||
int LEVEL_UNLOCK_PRIVILEGE = 1;
|
||||
|
|
|
@ -77,11 +77,9 @@ public class ChampinGetHandler extends BaseHandler {
|
|||
List<String> strings = RedisUtil.getInstence().lGet(RedisKey.CHAMPION_MY_BATTLLE_IDS, Integer.toString(uid), 0, -1);
|
||||
|
||||
int state = -1;
|
||||
Gson gson = new Gson();
|
||||
for (String redisId : strings) {
|
||||
ArenaRecord record = RedisUtil.getInstence().getMapValue(RedisKey.CHAMPION_ARENA_RECORD, "", redisId, ArenaRecord.class);
|
||||
if ((!record.getId().equals(arenaRecord.getId())) && record.getRoundTims() == roundTims) {
|
||||
// System.out.println("record = " +gson.toJson(record));
|
||||
if (record.getFightResult() == 1) {
|
||||
if (state == -1) {
|
||||
state = 2;
|
||||
|
@ -99,24 +97,37 @@ public class ChampinGetHandler extends BaseHandler {
|
|||
state = record.getFightResult();
|
||||
}
|
||||
}
|
||||
System.out.println(state+"record = " +gson.toJson(record));
|
||||
}
|
||||
}
|
||||
if(schedule==2){
|
||||
if( realTimes < 6 && roundTims - 7 != realTimes) {
|
||||
builder.setLoser(true);
|
||||
if(ChampionshipLogic.getProgress()==-2){
|
||||
if(arenaRecord.getRoundTims()-7==5){
|
||||
if(state==0&&attackId==uid){
|
||||
builder.setLoser(true);
|
||||
}else {
|
||||
builder.setLoser(false);
|
||||
}
|
||||
}else {
|
||||
builder.setLoser(false);
|
||||
}
|
||||
}else if(schedule==1){
|
||||
if(roundTims!=roundTimes){
|
||||
builder.setLoser(true);
|
||||
}else {
|
||||
builder.setLoser(false);
|
||||
}
|
||||
}else {
|
||||
if(schedule==2){
|
||||
if( roundTims - 7 != realTimes) {
|
||||
builder.setLoser(true);
|
||||
}else {
|
||||
builder.setLoser(false);
|
||||
}
|
||||
}else if(schedule==1){
|
||||
if(roundTims!=roundTimes){
|
||||
builder.setLoser(true);
|
||||
}else {
|
||||
builder.setLoser(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
builder.setProcess(state);
|
||||
builder.setChampionBattleInfo(builder1
|
||||
.setMyInfo(ChampionshipLogic.getChampionBattleInfo(attackId))
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.ljsd.jieling.util.MessageUtil;
|
|||
import util.StringUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 获取竞猜信息
|
||||
|
@ -55,11 +56,25 @@ public class ChampionBetInfoHandler extends BaseHandler<ArenaInfoProto.ChampionG
|
|||
|
||||
int myGuessID = 0;
|
||||
Integer mineBetCoins = 0;
|
||||
List<String> strings = RedisUtil.getInstence().lGet(RedisKey.CHAMPION_MY_BATTLLE_IDS, Integer.toString(arenaRecord.getAttackId()), 0,-1);
|
||||
|
||||
// Map<String, Integer> states = RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_ARENA_RECORD_THREE, "", String.class, Integer.class);
|
||||
// String key = String.valueOf(v.getAttackId() * 2222 + String.valueOf(v.getDefUid()));
|
||||
int state =-1;
|
||||
// Integer stateInteger = states.get(key);
|
||||
// if (null!=stateInteger) {
|
||||
// state =stateInteger
|
||||
// }
|
||||
//
|
||||
List<String> strings = RedisUtil.getInstence().lGet(RedisKey.CHAMPION_MY_BATTLLE_IDS, Integer.toString(arenaRecord.getAttackId()), 0,-1);
|
||||
//
|
||||
|
||||
|
||||
for (String redisId:strings) {
|
||||
ArenaRecord record = RedisUtil.getInstence().getMapValue(RedisKey.CHAMPION_ARENA_RECORD, "", redisId, ArenaRecord.class);
|
||||
|
||||
if(record.getTurn()==-1){
|
||||
continue;
|
||||
}
|
||||
if((!record.getId().equals(arenaRecord.getId()))&&record.getRoundTims()==(arenaRecord.getRoundTims())){
|
||||
if(record.getFightResult()==0){
|
||||
if(state==-1){
|
||||
|
|
|
@ -42,6 +42,10 @@ public class ChampionGetMyHistoryHandler extends BaseHandler {
|
|||
List<ArenaRecord> myArenaRecordInfos = RedisUtil.getInstence().getMapEntrys(RedisKey.CHAMPION_ARENA_RECORD, "", ids, ArenaRecord.class);
|
||||
Map<Integer, SArenaRobotConfig> robotConfigMap = STableManager.getConfig(SArenaRobotConfig.class);
|
||||
for (ArenaRecord arenaRecord : myArenaRecordInfos) {
|
||||
if(arenaRecord.getTurn()==-1){
|
||||
//3局两胜 跳过
|
||||
continue;
|
||||
}
|
||||
int attackUid = arenaRecord.getAttackId();
|
||||
int enemyId = arenaRecord.getDefUid();
|
||||
int fightResult = arenaRecord.getFightResult();
|
||||
|
|
|
@ -69,6 +69,9 @@ public class ChampionViewFinalHandler extends BaseHandler<ArenaInfoProto.Champio
|
|||
|
||||
for (ArenaRecord arenaRecord : arenaRecords) {
|
||||
|
||||
if(arenaRecord.getTurn()==-1){
|
||||
continue;
|
||||
}
|
||||
int attackId = arenaRecord.getAttackId();
|
||||
int defUid = arenaRecord.getDefUid();
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ public class BloodLogic {
|
|||
.setUnitId(Integer.toString(entry.getValue().getTempleteId()))
|
||||
.setUnitSkillIds(heroSkill)//.substring(0, heroSkill.length() - 1)
|
||||
.setProperty(property.substring(0, property.length() - 1))
|
||||
.setPosition(++index)
|
||||
.setPosition(entry.getValue().getPosition())
|
||||
.setStar(entry.getValue().getStar())
|
||||
.build();
|
||||
heroDefendFightInfos.add(heroFightInfo);
|
||||
|
|
|
@ -209,8 +209,7 @@ public class ChampionshipLogic {
|
|||
if(schedule==2){
|
||||
String key = String.valueOf(v.getAttackId() * 2222 + String.valueOf(v.getDefUid()));
|
||||
Integer state = states.get(key);
|
||||
System.out.println("scoe state = " + state);
|
||||
if (state == 0) {
|
||||
if (null!=state&&state == 0) {
|
||||
winnerUid = v.getDefUid();
|
||||
failerUid = v.getAttackId();
|
||||
}
|
||||
|
@ -488,7 +487,7 @@ public class ChampionshipLogic {
|
|||
MemberInfo memberInfo = RedisUtil.getInstence().getMapEntry(RedisKey.CHAMPION_JOIN, "", Integer.toString(uid), MemberInfo.class);
|
||||
FamilyFightInfo fightInfo = memberInfo.getFightInfo();
|
||||
if(fightInfo == null){
|
||||
return PlayerLogic.getInstance().getUserTeamOneInfo(uid,GlobalsDef.TEAM_ARENA_DEFENSE);
|
||||
return PlayerLogic.getInstance().getUserTeamOneInfo(uid,GlobalsDef.CHAMPION_TEAM);
|
||||
}
|
||||
//fix 整个过程都不能调整编队
|
||||
|
||||
|
@ -630,7 +629,7 @@ public class ChampionshipLogic {
|
|||
|
||||
|
||||
public static void snapOneFightInfo(int uid, Map<Integer, MemberInfo> joinMembers) throws Exception {
|
||||
int snapTeamId = GlobalsDef.TEAM_ARENA_DEFENSE;
|
||||
int snapTeamId = GlobalsDef.CHAMPION_TEAM;
|
||||
|
||||
Map<Integer, SArenaRobotConfig> config = STableManager.getConfig(SArenaRobotConfig.class);
|
||||
if (config.containsKey(uid)) {
|
||||
|
@ -755,6 +754,7 @@ public class ChampionshipLogic {
|
|||
delKeys.add(RedisUtil.getInstence().getKey(RedisKey.CHAMPION_RANK, ""));
|
||||
delKeys.add(RedisUtil.getInstence().getKey(RedisKey.CHAMPION_FINAL_RECODED_IDS, ""));
|
||||
delKeys.add(RedisUtil.getInstence().getKey(RedisKey.CHAMPION_GUESSS_UIDS, ""));
|
||||
delKeys.add(RedisUtil.getInstence().getKey(RedisKey.CHAMPION_ARENA_RECORD_THREE, ""));
|
||||
|
||||
//我的历史结果
|
||||
joinUids.forEach(uid -> {
|
||||
|
@ -1114,9 +1114,9 @@ public class ChampionshipLogic {
|
|||
if (null == user) {
|
||||
return null;
|
||||
}
|
||||
int totalForce = HeroLogic.getInstance().calTeamTotalForce(user, GlobalsDef.TEAM_ARENA_DEFENSE, false);
|
||||
int totalForce = HeroLogic.getInstance().calTeamTotalForce(user, GlobalsDef.CHAMPION_TEAM, false);
|
||||
if (type == 0) {
|
||||
List<TeamPosHeroInfo> teamPosHeroInfoList = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.TEAM_ARENA_DEFENSE);
|
||||
List<TeamPosHeroInfo> teamPosHeroInfoList = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.CHAMPION_TEAM);
|
||||
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
|
||||
List<Integer> heroTids = new ArrayList<>(teamPosHeroInfoList.size());
|
||||
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfoList) {
|
||||
|
@ -1242,7 +1242,6 @@ public class ChampionshipLogic {
|
|||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
|
||||
snapPlayFightInfo(true);
|
||||
|
||||
List<String> curArenaRecordIds = RedisUtil.getInstence().lGet(RedisKey.CHAMPION_CUR_JOIN_IDS, "", 0, -1);
|
||||
|
|
|
@ -15,55 +15,44 @@ public class AreFightPro implements EndFightProcessor {
|
|||
public void endfightProcess(FightResult fightResult) {
|
||||
int result = fightResult.getCheckResult()[0];
|
||||
arenaRecord.setFightResult(fightResult.getCheckResult()[0]);
|
||||
int winnerUid = arenaRecord.getAttackId();
|
||||
int failerUid = arenaRecord.getDefUid();
|
||||
if(result == 0){
|
||||
winnerUid = arenaRecord.getDefUid();
|
||||
failerUid = arenaRecord.getAttackId();
|
||||
}
|
||||
String key = String.valueOf(arenaRecord.getAttackId() * 2222 + String.valueOf(arenaRecord.getDefUid()));
|
||||
|
||||
//胜负结果出了之后 选择一局记分
|
||||
Integer state = RedisUtil.getInstence().getMapValue(RedisKey.CHAMPION_ARENA_RECORD_THREE, "", key, Integer.class);
|
||||
boolean jump=false;
|
||||
if(null == state){
|
||||
state=0;
|
||||
}else if(state<2){
|
||||
jump=true;
|
||||
}
|
||||
if(ChampionshipLogic.getSchedule()==2){
|
||||
if(result==1){
|
||||
if(state==0){
|
||||
state=2;
|
||||
}else if(state==3){
|
||||
state=5;
|
||||
}else {
|
||||
state=result;
|
||||
String key = String.valueOf(arenaRecord.getAttackId() * 2222 + String.valueOf(arenaRecord.getDefUid()));
|
||||
//胜负结果出了之后 选择一局记分
|
||||
boolean jump=false;
|
||||
Integer state = RedisUtil.getInstence().getMapValue(RedisKey.CHAMPION_ARENA_RECORD_THREE, "", key, Integer.class);
|
||||
if(null ==state){
|
||||
state=0;
|
||||
}else if(state<2){
|
||||
if(arenaRecord.getTurn()==3){
|
||||
arenaRecord.setTurn(-1);
|
||||
}
|
||||
}else {
|
||||
if(state==0){
|
||||
state=3;
|
||||
}else if(state==2){
|
||||
state=4;
|
||||
}else{
|
||||
state=result;}
|
||||
jump =true;
|
||||
}
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_ARENA_RECORD_THREE,"",key,state);
|
||||
if(!jump){
|
||||
if(result==1){
|
||||
if(state==0){
|
||||
state=2;
|
||||
}else if(state==3){
|
||||
state=5;
|
||||
}else {
|
||||
state=result;
|
||||
}
|
||||
}else {
|
||||
if(state==0){
|
||||
state=3;
|
||||
}else if(state==2){
|
||||
state=4;
|
||||
}else{
|
||||
state=result;}
|
||||
}
|
||||
System.out.println("keykeykeykeykeykeykey"+key+": "+arenaRecord.getId()+": "+arenaRecord.getTurn()+" : "+arenaRecord.getAttackId()+"AreFightPro state = " + state);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_ARENA_RECORD_THREE,"",key,state);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!jump) {
|
||||
if (ChampionshipLogic.getSchedule() == 2&&state<2) {
|
||||
if (state == 0) {
|
||||
winnerUid = arenaRecord.getDefUid();
|
||||
failerUid = arenaRecord.getAttackId();
|
||||
} else {
|
||||
winnerUid = arenaRecord.getAttackId();
|
||||
failerUid = arenaRecord.getDefUid();
|
||||
}
|
||||
}
|
||||
System.out.println(arenaRecord.getId()+": "+arenaRecord.getTurn()+" : "+arenaRecord.getAttackId()+"AreFightPro state = " + state);
|
||||
// ChampionshipLogic.setScoreForSuccess(winnerUid,failerUid,state<2);
|
||||
}
|
||||
|
||||
int warTime = STableManager.getFigureConfig(CommonStaticConfig.class).getsChampionshipSetting().getWarTime();
|
||||
CommonProto.FightData build = CommonProto.FightData.newBuilder().setFightType(9).setHeroFightInfos(fightResult.getFightTeamInfo()).addMonsterList(fightResult.getDefFightTeamInfo()).setFightSeed(fightResult.getSeed()).setFightMaxTime(warTime).build();
|
||||
arenaRecord.setFightData(build.toByteArray());
|
||||
|
|
|
@ -141,6 +141,7 @@ public class FightUtil {
|
|||
|
||||
LuaValue getFightData ;
|
||||
if(((PVPFightEvent) fightEvent).isRever()){
|
||||
deffightTeamInfo = CommonProto.FightTeamInfo.newBuilder().mergeFrom(deffightTeamInfo).setFirstCamp(1).build();
|
||||
getFightData = FightDataUtil.getFinalPlayerFightData(fightTeamInfo, deffightTeamInfo,true);//对方先手
|
||||
}else {
|
||||
getFightData = FightDataUtil.getFinalPlayerFightData(fightTeamInfo, deffightTeamInfo);
|
||||
|
|
|
@ -173,7 +173,7 @@ public class FightDataUtil {
|
|||
}
|
||||
|
||||
public static LuaValue getPlayerData(CommonProto.FightTeamInfo heroTeam,int position) {
|
||||
return getPlayerData(heroTeam, position);
|
||||
return getPlayerData(heroTeam, position,false);
|
||||
}
|
||||
|
||||
public static LuaValue getPlayerData(CommonProto.FightTeamInfo heroTeam,int position,boolean first) {
|
||||
|
|
Loading…
Reference in New Issue