yx空阵容挑战记录

back_recharge
xuexinpeng 2021-10-19 19:09:43 +08:00
parent 11fb5eb275
commit 3c95660505
2 changed files with 31 additions and 10 deletions

View File

@ -48,10 +48,7 @@ import rpc.protocols.CommonProto;
import rpc.protocols.MessageTypeProto;
import util.TimeUtils;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.CrossYuXuLunDaoChallengeRequest> {
@ -326,7 +323,7 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
arenaRecord.setServerName(defServerName);
for (int i = 0; i < 3; i++) {
//编队为空 判输赢
if (!updateResult(myUser,i, myteamId, defTeamId, result)) {
if (!updateResult(myUser,i, myteamId, defTeamId, result,csPlayer,crossArenaManager,arenaRecord)) {
continue;
}
CommonProto.FightTeamInfo fightTeamInfo = FightUtil.makePersonFightData(myUser, myteamId[i], null, null);
@ -359,7 +356,7 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
return result;
}
public static boolean updateResult(User user,int i, int[] myteamId, int[] defTeamId, int[] result) {
public static boolean updateResult(User user,int i, int[] myteamId, int[] defTeamId, int[] result,CSPlayer csPlayer,CrossArenaManager crossArenaManager, ArenaRecord arenaRecord) throws Exception{
/*if (myteamId[i] == 0 || defTeamId[i] == 0) {
if (myteamId[i] == 0 && defTeamId[i] == 0) {
result[i] = 0;
@ -372,6 +369,24 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
}
return false;
}*/
//没有队伍时候 直接断定对方赢
Map<Integer, List<TeamPosHeroInfo>> teamPosForHero = user.getTeamPosManager().getTeamPosForHero();
if(!teamPosForHero.containsKey(myteamId[i]) || teamPosForHero.get(myteamId[i]).size() == 0){
result[i] = 0;
if (GameApplication.serverId == csPlayer.getServerId()) {
User defuser = UserManager.getUser(csPlayer.getUserId());
int addforce = HeroLogic.getInstance().calTeamTotalForce(defuser, myteamId[i], false);
arenaRecord.getYxldDefForce().add(addforce);
}else{
List<com.ljsd.jieling.thrift.idl.TeamPosHeroInfo> teamPosHeroInfos = crossArenaManager.getTeams().getOrDefault(myteamId[i], new ArrayList<>());
int addforcerpc = crossArenaManager.getTotalForceByTeam().get(myteamId[i]);
arenaRecord.getYxldDefForce().add(addforcerpc);
}
return false;
}
return true;
}
public static boolean updateResult(User user,int i, int[] myteamId, int[] defTeamId, int[] result){
//没有队伍时候 直接断定对方赢
Map<Integer, List<TeamPosHeroInfo>> teamPosForHero = user.getTeamPosManager().getTeamPosForHero();
if(!teamPosForHero.containsKey(myteamId[i]) || teamPosForHero.get(myteamId[i]).size() == 0){
@ -380,7 +395,6 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
}
return true;
}
public int[] getFightResultByPersonToRobot(User myUser, int defUserUid, int[] myteamId, int[] defTeamId, ArenaInfoProto.CrossYuXuLunDaoChallengeResponse.Builder builder) throws Exception {
int[] result = new int[3];//1赢 0输
for (int i = 0; i < 3; i++) {

View File

@ -367,17 +367,23 @@ public class CrossYuxulundaoLogic {
public static CommonProto.crossYxldPlayerRecordInfo getCrossYxldPlayerRecordInfo(int uid,ArenaRecord arenaRecord,boolean isSend) throws Exception {
CommonProto.FightData fightDataProto1 = null;
CommonProto.FightData fightDataProto2 = null;
CommonProto.FightData fightDataProto3 = null;
CommonProto.FightData fightDataProto1 ;
CommonProto.FightData fightDataProto2 ;
CommonProto.FightData fightDataProto3;
if(arenaRecord.getYxldFightData1() != null){
fightDataProto1 = CommonProto.FightData.parseFrom(arenaRecord.getYxldFightData1());
}else{
fightDataProto1 = CommonProto.FightData.newBuilder().build();
}
if(arenaRecord.getYxldFightData2() != null){
fightDataProto2 = CommonProto.FightData.parseFrom(arenaRecord.getYxldFightData2());
}else{
fightDataProto2 = CommonProto.FightData.newBuilder().build();
}
if(arenaRecord.getYxldFightData3() != null){
fightDataProto3 = CommonProto.FightData.parseFrom(arenaRecord.getYxldFightData3());
}else{
fightDataProto3 = CommonProto.FightData.newBuilder().build();
}
List<Integer> result = null;//
if (arenaRecord.getYxldResult() == null) {
@ -389,6 +395,7 @@ public class CrossYuxulundaoLogic {
result = Arrays.stream(arenaRecord.getYxldResult()).boxed().collect(Collectors.toList());
}
if(isSend){
CSPlayer csPlayer = CrossServiceLogic.getPlayerByRedis(uid);
CSPlayer defPlayer = CrossServiceLogic.getPlayerByRedis(arenaRecord.getDefUid());
String myServerName = CrossDeathPathLogic.getInstance().getServerNameByDeathPath(csPlayer.getServerId());