先后手
parent
7958bb7fa3
commit
8b01414491
|
@ -70,6 +70,7 @@ public class ArenaChallengeHandler extends BaseHandler<ArenaInfoProto.ArenaChall
|
|||
}
|
||||
user.getTeamPosManager().setCurTeamPosId(teamId);
|
||||
ArenaInfoProto.ArenaChallengeResponse.Builder builder = ArenaInfoProto.ArenaChallengeResponse.newBuilder();
|
||||
|
||||
User defUser = null;
|
||||
if( enemyType == GlobalsDef.ARENA_PLAYER_TYPE){
|
||||
ArenaRecord arenaRecord = new ArenaRecord();
|
||||
|
@ -87,7 +88,6 @@ public class ArenaChallengeHandler extends BaseHandler<ArenaInfoProto.ArenaChall
|
|||
if(defUser.getArenaManager().getCount()!=0 && defUser.getArenaManager().getSeason() == curSeason){
|
||||
arenaRecord.setAttackId(uid);
|
||||
arenaRecord.setDefScore(defScoreChange);
|
||||
arenaRecord.setAttackForce( HeroLogic.getInstance().calTeamTotalForce(user, GlobalsDef.TEAM_ARENA_DEFENSE,false));
|
||||
arenaRecord.setCreateTime((int)(System.currentTimeMillis()/1000));
|
||||
arenaRecord.setId(KeyGenUtils.produceIdByModule(UUIDEnum.ARENARECORD,uid));
|
||||
arenaRecord.setFightResult(fightResult^1);
|
||||
|
|
|
@ -161,6 +161,12 @@ public class ArenaLogic {
|
|||
|
||||
public static int getFightResultByPersonToPerson(User mine, int myteamId, User defUser, int defTeamId, ArenaRecord arenaRecord, ArenaInfoProto.ArenaChallengeResponse.Builder builder) throws Exception {
|
||||
PVPFightEvent pvpFightEvent = new PVPFightEvent(mine.getId(),myteamId,SArenaSetting.getSArenaSetting().getMostTime(),"", GameFightType.ArenaPersonFight,defUser.getId(),defTeamId);
|
||||
int myforce = HeroLogic.getInstance().calTeamTotalForce(mine, GlobalsDef.TEAM_ARENA_DEFENSE, false);
|
||||
int defForce = HeroLogic.getInstance().calTeamTotalForce(defUser, GlobalsDef.TEAM_ARENA_DEFENSE, false);
|
||||
arenaRecord.setAttackForce(myforce);
|
||||
if(myforce<defForce){
|
||||
pvpFightEvent.setRever(true);
|
||||
}
|
||||
FightResult fightResult = FightDispatcher.dispatcher(pvpFightEvent);
|
||||
CommonProto.FightTeamInfo fightTeamInfo =fightResult.getFightTeamInfo();
|
||||
CommonProto.FightTeamInfo deffightTeamInfo = fightResult.getDefFightTeamInfo();
|
||||
|
@ -183,6 +189,11 @@ public class ArenaLogic {
|
|||
|
||||
public int getFightResultByPersonToRobot(User mine, int myteamId, int challengeUid,ArenaInfoProto.ArenaChallengeResponse.Builder builder) throws Exception {
|
||||
PVPFightEvent pvpFightEvent = new PVPFightEvent(mine.getId(),myteamId,SArenaSetting.getSArenaSetting().getMostTime(),"", GameFightType.ArenaRobotFight,challengeUid,-1);
|
||||
int myforce = HeroLogic.getInstance().calTeamTotalForce(mine, GlobalsDef.TEAM_ARENA_DEFENSE, false);
|
||||
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(myteamId);
|
||||
if(sArenaRobotConfig!=null&&myforce<sArenaRobotConfig.getTotalForce()){
|
||||
pvpFightEvent.setRever(true);
|
||||
}
|
||||
FightResult fightResult = FightDispatcher.dispatcher(pvpFightEvent);
|
||||
CommonProto.FightTeamInfo fightTeamInfo =fightResult.getFightTeamInfo();
|
||||
CommonProto.FightTeamInfo deffightTeamInfo = fightResult.getDefFightTeamInfo();
|
||||
|
@ -517,8 +528,15 @@ public class ArenaLogic {
|
|||
throw new ErrorCodeException(ErrorCode.newDefineCode("对方未设置阵容"));
|
||||
}
|
||||
|
||||
int myforce = HeroLogic.getInstance().calTeamTotalForce(mine, myteamId, false);
|
||||
int deforce = HeroLogic.getInstance().calTeamTotalForce(defUser, 1, false);
|
||||
CommonProto.FightTeamInfo fightTeamInfo = BehaviorUtil.getFightTeamInfo(mine,myteamId,true);
|
||||
CommonProto.FightTeamInfo deffightTeamInfo = BehaviorUtil.getFightTeamInfo(defUser,1,false);
|
||||
|
||||
if(myforce<deforce){
|
||||
deffightTeamInfo = CommonProto.FightTeamInfo.newBuilder().mergeFrom(deffightTeamInfo).setFirstCamp(1).build();
|
||||
}
|
||||
|
||||
//设置战斗随机种子
|
||||
int seed = (int)(System.currentTimeMillis()/1000);
|
||||
CommonProto.FightData build = CommonProto.FightData.newBuilder()
|
||||
|
|
|
@ -620,18 +620,39 @@ public class ChampionshipLogic {
|
|||
|
||||
MemberInfo attackMemberInfo = memberInfoMap.get(attackId);
|
||||
MemberInfo defMemberInfo = memberInfoMap.get(defUid);
|
||||
int minForce = 0;
|
||||
int defForce = 0;
|
||||
|
||||
if (defMemberInfo.getType() == 0) {
|
||||
FamilyFightInfo fightInfo = defMemberInfo.getFightInfo();
|
||||
pvpFightEvent.setDefFightSnapData(new DefFightSnapData(fightInfo.getHeroAttribute(), fightInfo.getHeroSkills(), fightInfo.getPokenmonSkills(), fightInfo.getPassiveSkills()));
|
||||
defForce = fightInfo.getForce();
|
||||
}else {
|
||||
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(defUid);
|
||||
if(sArenaRobotConfig!=null){
|
||||
defForce = sArenaRobotConfig.getTotalForce();
|
||||
}
|
||||
}
|
||||
if (attackMemberInfo.getType() == 0) {
|
||||
FamilyFightInfo fightInfo = attackMemberInfo.getFightInfo();
|
||||
pvpFightEvent.setAttackFightSnapData(new DefFightSnapData(fightInfo.getHeroAttribute(), fightInfo.getHeroSkills(), fightInfo.getPokenmonSkills(), fightInfo.getPassiveSkills()));
|
||||
minForce = fightInfo.getForce();
|
||||
}else {
|
||||
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(attackId);
|
||||
if(sArenaRobotConfig!=null){
|
||||
minForce = sArenaRobotConfig.getTotalForce();
|
||||
}
|
||||
}
|
||||
if(minForce>defForce){
|
||||
if(arenaRecord.getTurn()==2){
|
||||
pvpFightEvent.setRever(true);
|
||||
}
|
||||
}else {
|
||||
if(arenaRecord.getTurn()==1||arenaRecord.getTurn()==3){
|
||||
pvpFightEvent.setRever(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(arenaRecord.getTurn()==2){
|
||||
pvpFightEvent.setRever(true);
|
||||
}
|
||||
FightDispatcher.dispatcherAsync(pvpFightEvent, id);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue