合并代码1

back_recharge
duhui 2021-09-14 20:11:27 +08:00
parent 18f91727e4
commit def246c407
26 changed files with 325 additions and 412 deletions

View File

@ -90,7 +90,7 @@ public class CheckFight {
* @param seed
* @param fightData
* @param optionData
* @return {,1,2,3,4,5}
* @return {, /1,2,3,4,5}
*/
public long[] checkFight(int seed,int maxTime, LuaValue fightData, LuaValue optionData,FightType fightType){
LuaValue transCoderObj = this.getTransCoderObj();
@ -101,23 +101,21 @@ public class CheckFight {
args.set("type",fightType.getType());
args.set("maxRound",maxTime);
LuaValue result = func.call( args,fightData,optionData);
int status = result.get("result").toint();
long duration = result.get("duration").tolong();
long[] resultCache = new long[8];//对方阵容走配置 Todo 后面结构走配置
resultCache[0]= status;
resultCache[1]= duration;
LOGGER.info(" lua check test fight result : "+ status);
for (int i = 1; i <= result.length(); i++) {
long tolong = result.rawget(i).tolong();
if(tolong>0){
resultCache[i+1]= Math.min(Long.MAX_VALUE,tolong);
long[] resultCache = new long[9];//对方阵容走配置 Todo 后面结构走配置
resultCache[0]= result.get("result").tolong();
resultCache[1]= result.get("duration").tolong();
LOGGER.info(" lua check test fight result : "+ resultCache[0]);
for (int i = resultCache.length; i <= result.length(); i++) {
long talon = result.rawget(i).tolong();
if(talon>0){
resultCache[i]= Math.min(Long.MAX_VALUE,talon);
}else {
resultCache[i+1]= Math.max(Long.MIN_VALUE,tolong);
resultCache[i]= Math.max(Long.MIN_VALUE,talon);
}
resultCache[i+1] = result.rawget(i).tolong();
LOGGER.info(i+" --> 单位剩余血量 : "+ resultCache[i+1]);
resultCache[i] = result.rawget(i).tolong();
LOGGER.info(i+" --> 单位剩余血量 : "+ resultCache[i]);
}
resultCache[8]= result.get("curRound").tolong();
return resultCache;
}

View File

@ -12,6 +12,7 @@ import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
import com.ljsd.fight.DefFightSnapData;
import com.ljsd.jieling.logic.fight.FightUtil;
import com.ljsd.jieling.logic.fight.GameFightType;
import com.ljsd.jieling.logic.fight.result.FightResult;
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
import com.ljsd.jieling.network.session.ISession;
import rpc.protocols.CommonProto;
@ -76,13 +77,8 @@ public class EndConfirmExpeditionBattleRequestHandler extends BaseHandler<Expedi
throw new ErrorCodeException(ErrorCode.CFG_NULL);
}
int maxTime = sExpeditionSetting.getFightTime();
//CommonProto.FightTeamInfo fightTeamInfo = FightUtil.makePersonFightDataWithDouble(user,teamId,user.getExpeditionManager().getHeroHP());
CommonProto.FightTeamInfo fightTeamInfo = ExpeditionLogic.getFightTeamInfoWithDouble(user,teamId,user.getExpeditionManager().getHeroHP());
SnapFightInfo deffightInfo = nodeInfo.getSnapFightInfo();
//添加被动技能
LuaValue getFightData;
CommonProto.FightTeamInfo deffightTeamInfo = FightUtil.makeFightBySnapDataWithDouble(new DefFightSnapData(deffightInfo.getHeroAttribute(),deffightInfo.getHeroSkills(),deffightInfo.getPokenmonSkills(),deffightInfo.getPassiveSkills()),nodeInfo.getBossHP());
@ -90,19 +86,13 @@ public class EndConfirmExpeditionBattleRequestHandler extends BaseHandler<Expedi
LuaValue getOptionData = FightDataUtil.getOptionData(uid+"");
long[] checkResult = CheckFight.getInstance().checkFight(seed, maxTime, getFightData, getOptionData, GameFightType.Expediton.getFightType());
FightResult fight = FightResult.newBuilder().setCheckResult(checkResult).build();
int resultCode = (int) checkResult[0];
int resultCode = fight.getResult();
if (resultCode == -1) {
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
}
List<Long> remainHp = new ArrayList<>(5);
for (int i = 2; i < checkResult.length; i++) {
if (checkResult[i] <= 0) {
remainHp.add((long) 0);
} else {
remainHp.add(checkResult[i]);
}
}
List<Long> remainHp = fight.getRemainHp();
//更新节点状态 节点
final int oldlay = nodeInfo.getLay();

View File

@ -18,6 +18,7 @@ import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
import com.ljsd.fight.DefFightSnapData;
import com.ljsd.jieling.logic.fight.FightUtil;
import com.ljsd.jieling.logic.fight.GameFightType;
import com.ljsd.jieling.logic.fight.result.FightResult;
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
@ -107,19 +108,13 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
LuaValue getOptionData = FightDataUtil.getOptionData(uid+"");
long[] checkResult = CheckFight.getInstance().checkFight(seed, maxTime, getFightData, getOptionData, GameFightType.Expediton.getFightType());
FightResult fight = FightResult.newBuilder().setCheckResult(checkResult).build();
int resultCode = (int) checkResult[0];
int resultCode = fight.getResult();
if (resultCode == -1) {
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
}
List<Long> remainHp = new ArrayList<>(6);
for (int i = 2; i < checkResult.length; i++) {
if (checkResult[i] <= 0) {
remainHp.add((long) 0);
} else {
remainHp.add(checkResult[i]);
}
}
List<Long> remainHp = fight.getRemainHp();
//如果是第三层更新下圣物状态
if(expeditionManager.getExpeditionLeve()>2){
ExpeditionLogic.getInstance().thirdFight(user);

View File

@ -86,10 +86,10 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
int monsterId = STableManager.getConfig(SWorldBossConfig.class).get(GuildFightLogic.carDelayProgressIndication.getBossIndexId()).getMonsterId();
PVEFightEvent pvpFightEvent = new PVEFightEvent(uid,GlobalsDef.CAR_DELAY_TEAM, battleRound,"", GameFightType.CarBossChallenge,monsterId,3);
FightResult fightResult = FightDispatcher.dispatcher(pvpFightEvent);
if(fightResult.getCheckResult()[0]==-1){
if(fightResult.getResult()==-1){
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
}
hurt = (int) fightResult.getCheckResult()[1];
hurt = fightResult.getResult();
fightData = fightResult.getFightData();
gainScore = (int) (hurt*(sWorldBossSetting.getScorePercent()/10000F));
double myscore = gainScore;
@ -106,9 +106,9 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
PVPFightEvent pvpFightEvent = new PVPFightEvent(uid,GlobalsDef.CAR_DELAY_TEAM, battleRound,"", GameFightType.CarPersonChallenge,challeageId,GlobalsDef.CAR_DELAY_TEAM);
FightResult fightResult = FightDispatcher.dispatcher(pvpFightEvent);
fightData = fightResult.getFightData();
int fight = (int) fightResult.getCheckResult()[0];
String content = "";
String challengeContent = "";
int fight = fightResult.getResult();
String content;
String challengeContent;
PlayerManager playerInfoManager = UserManager.getUser(challeageId).getPlayerInfoManager();
String challengeName = playerInfoManager.getNickName();
String challengeNameColor = playerInfoManager.getNameColor();
@ -141,7 +141,7 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
challengeContent = SErrorCodeEerverConfig.getI18NMessage("worldboss_grab_lose",
new Object[]{nameColor,user.getPlayerInfoManager().getNickName(),gainScore});
}
hurt = (int) fightResult.getCheckResult()[1];
hurt = fightResult.getResult();
String key = RedisUtil.getInstence().getKey(RedisKey.CAR_CHALLENGE_RECORD, String.valueOf(uid));
String challenegeKey = RedisUtil.getInstence().getKey(RedisKey.CAR_CHALLENGE_RECORD, String.valueOf(challeageId));
if(hurt!=0){

View File

@ -100,18 +100,13 @@ public class NewGeneralAttackHandler extends BaseHandler<ActivityProto.NewGenera
// 记录战报
FightRecordLogic.getInstance().addRecordMap(user,fightData);
// 战斗结果,第二位是伤害
long[] checkResult = fightResult.getCheckResult();
double lessBlood = 0.0;
// checkResult第一位输赢1赢其他输
if (checkResult[0] == 1){
double lessBlood;
// 赢
if (fightResult.getResult() == 1){
lessBlood = bossBlood;
}else {
// checkResult第三位开始为血量下标0开始
for (int i = 2; i < checkResult.length; i++) {
lessBlood+=checkResult[i];
}
// 输
lessBlood = fightResult.getRemainHp().stream().mapToLong(Long::longValue).sum();
lessBlood = bossBlood - lessBlood;
}

View File

@ -93,7 +93,7 @@ public class TasuilingxiaoHandler extends BaseHandler<ActivityProto.Tasuilingxia
// 战斗结果,{战斗结果,战斗时间单位1剩余血量......}
long[] checkResult = fightResult.getCheckResult();
//输
double lessBlood = 0.0;
double lessBlood;
if(checkResult[0]==-1){
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
@ -101,11 +101,8 @@ public class TasuilingxiaoHandler extends BaseHandler<ActivityProto.Tasuilingxia
lessBlood = bossBlood;
}else {
// 输 checkResult第三位开始为血量下标0开始
for (int i = 2; i < checkResult.length; i++) {
lessBlood+=checkResult[i];
}
lessBlood = fightResult.getRemainHp().stream().mapToLong(Long::longValue).sum();
lessBlood = bossBlood - lessBlood;
//return ActivityProto.TasuilingxiaoResponse.newBuilder().setFightData(fightData).setDrop(drop).setDamageVal((int)lessBlood).build();
}
//取出所有奖励状态

View File

@ -180,7 +180,7 @@ public class GetWorldArenaChallengeRequestHandler extends BaseHandler<WorldProto
int teamId = proto.getTeamId();
CommonProto.FightTeamInfo fightTeamInfo = FightUtil.makePersonFightData(UserManager.getUser(iSession.getUid()), teamId, null, null);
FightResult fightResult = getFightForPVP(iSession.getUid(), proto.getChallengeUid(), fightTeamInfo, teamInfo, FightUtil.getFightSeed(),myForce<defendForce);
builder1.setFightResult((int)fightResult.getCheckResult()[0]);
builder1.setFightResult(fightResult.getResult());
int seed = fightResult.getSeed();
CommonProto.FightData build = CommonProto.FightData.newBuilder()
.setFightMaxTime(SArenaSetting.getSArenaSetting().getMostTime())
@ -191,7 +191,7 @@ public class GetWorldArenaChallengeRequestHandler extends BaseHandler<WorldProto
builder1.setFightData(build);
WorldProto.WroldBattleRecord.Builder builder = WorldProto.WroldBattleRecord.newBuilder();
builder.setFightData(fightResult.getFightData());
builder.setResult((int)fightResult.getCheckResult()[0]);
builder.setResult(fightResult.getResult());
String s = KeyGenUtils.produceIdByModule(UUIDEnum.ARENARECORD, iSession.getUid());
builder.setRecordId(s);
builder.setAttackTime((int)(System.currentTimeMillis()/1000));
@ -201,7 +201,7 @@ public class GetWorldArenaChallengeRequestHandler extends BaseHandler<WorldProto
int[][] reward = new int[1][];
//打赢
if (fightResult.getCheckResult()[0] > 0) {
if (fightResult.getResult() > 0) {
// if (proto.getChallengeUid() < 1000) {
RedisUtil.getInstence().set(RedisKey.WORLD_ARENA_RANK_MY_MATH, String.valueOf(iSession.getUid()), new HashSet<>());

View File

@ -526,23 +526,22 @@ public class JourneyMap {
// 记录战报
FightRecordLogic.getInstance().addRecordMap(user,fightResult.getFightData());
long[] checkResult = fightResult.getCheckResult();
MapInfoProto.JourneyFightResponse.Builder response =MapInfoProto.JourneyFightResponse.newBuilder();
String combat_results = "失败";
if(checkResult[0]==1){
if(fightResult.getResult()==1){
CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[]{monster.getReward()}, 1, 0, BIReason.JOURNEY_FIGHT_REWARD);
response.setDrop(drop);
pathInfo.removeMonster(bossIndex);
// 埋点数据
combat_results = "成功";
}else if(checkResult[0]==0){
}else if(fightResult.getResult()==0){
long allHp = 0;
for(int i = 2;i<checkResult.length;i++){
remainHp.put(i-1,checkResult[i]);
allHp+=checkResult[i];
int i = 1;
for (Long hp : fightResult.getRemainHp()) {
remainHp.put(i,hp);
allHp+=hp;
i++;
}
monster.setRemainHp(remainHp);
CommonProto.JourneyMonsterInfo monsterInfo = CommonProto.JourneyMonsterInfo.newBuilder()

View File

@ -1271,167 +1271,160 @@ public class MapLogic {
* @param session
* @param messageType
*/
public void fastFight(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);
MapManager mapManager = user.getMapManager();
if (mapManager.getMapInfo() == null) {
LOGGER.info("fastFight mapManager.getMapInfo() == null");
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
if (mapManager.getCanMoveTime() > 0) {
long leftTime = mapManager.getCanMoveTime() - TimeUtils.now();
if (leftTime > 0) {
throw new ErrorCodeException(ErrorCode.HERO_LIVE_AGAIN,Collections.singletonList((leftTime / 1000)+""));
}
}
Cell cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
if (cell == null) {
cell = mapManager.getMapInfo().get(mapManager.getCurXY());
if (cell == null) {
LOGGER.info("cell == null xy is wrong =>{} triggerXY=>{}", mapManager.getCurXY(), mapManager.getTriggerXY());
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
int bigEventId = cell.getEventId();
SEventPointConfig sEventPointConfig = STableManager.getConfig(SEventPointConfig.class).get(bigEventId);
if (sEventPointConfig == null) {
LOGGER.info("sEventPointConfig == null");
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
int[] option = sEventPointConfig.getOption();
if (option == null) {
LOGGER.info("option == null sEventPointConfig.getId()=>{}", sEventPointConfig.getId());
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
int groupId = option[0];
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
int mostTime = sChallengeConfig.getMostTime();
PVEFightEvent pveFightEvent = new PVEFightEvent(uid, mapManager.getTeamId(), mostTime, "", GameFightType.MapFastFight, groupId, 3);
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
long[] checkResult = fightResult.getCheckResult();
List<Long> remainHp = new ArrayList<>(5);
for (int i = 2; i < checkResult.length; i++) {
if (checkResult[i] <= 0) {
remainHp.add((long) 0);
} else {
remainHp.add(checkResult[i]);
}
}
//校验结果码 1胜利
int resultCode = (int) checkResult[0];
if (resultCode == -1) {
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
}
int teamId = mapManager.getTeamId();
mapManager.setLastFightResult(resultCode);
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==GlobalsDef.ENDLESS_TEAM){
mapManager.updateEndlessFightCount(1+mapManager.getEndlessMapInfo().getFightCount());
}
if (resultCode == 0) {
//todo 无尽副本不复活记得改回去
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4) {
// //无尽副本复活消耗
reviveConsumeExecution(user);
for(Map.Entry<String, Map<Integer, Long>> entry: mapManager.getHeroAllAttributeMap().entrySet()){
mapManager.updateHeroOneAttribute(entry.getKey(),HeroAttributeEnum.CurHP.getPropertyId(),0);
mapManager.updateEndlessHeroHp(entry.getKey(),0);
}
}else {
// 失败需要等待n秒后复活所有英雄
int dieCount = user.getMapManager().getDieCount();
dieCount++;
user.getMapManager().setDieCount(dieCount);
int[] reviveTime = sChallengeConfig.getReviveTime();
long time = (long) (MathUtils.calABX(dieCount, reviveTime) * 1000);
user.getMapManager().setCanMoveTime(TimeUtils.now() + time);
int leftTime = getLeftTime(user, true);
remainHp.clear();
if (leftTime <= (int) (time / 1000)) {
resetMapInfo(user, false);
} else {
initTeamInfo(mapManager.getTeamId(), uid, user, mapManager, 2);
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
if (hero == null) {
continue;
}
Map<Integer, Long> heroAttributeMap = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, teamId);
remainHp.add(heroAttributeMap.get(HeroAttributeEnum.CurHP.getPropertyId()));
}
}
}
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
FightInfoProto.FastFightResponse build = FightInfoProto.FastFightResponse
.newBuilder()
.setResult(resultCode)
.setEnventDrop(dropBuilder)
// .addAllRemainHpList(remainHp)
.setEssenceValue(mapManager.getTrialInfo().getEnergy())
.setLastXY(mapManager.getLastXY())
.build();
mapManager.setCurXY(mapManager.getLastXY());
MessageUtil.sendMessage(session, 1, messageType.getNumber(), build, true);
return;
}
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==GlobalsDef.ENDLESS_TEAM){
for (int i = 0 ; i <team.size();i++) {
Hero hero = user.getHeroManager().getHero(team.get(i).getHeroId());
Map<Integer, Long> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false,teamId);
int per = (int)(checkResult[i+2] / (double) heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId())*10000);
if(checkResult[i+2]>0&&per<=0){
per = 1;
}
mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),per);
mapManager.updateHeroOneAttribute(team.get(i).getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), (int) checkResult[i+2]);
}
}else{
for (TeamPosHeroInfo teamPosHeroInfo : team) {
mapManager.updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), (int) checkResult[teamPosHeroInfo.getPosition()+1]);
}
}
int destoryXY = mapManager.getTriggerXY();
// if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4) {
// endlessRefreshMonster(session,destoryXY);
// public void fastFight(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
// int uid = session.getUid();
// User user = UserManager.getUser(uid);
// MapManager mapManager = user.getMapManager();
// if (mapManager.getMapInfo() == null) {
// LOGGER.info("fastFight mapManager.getMapInfo() == null");
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
// }
//删点之前进行查找
if (sChallengeConfig.getType() == 2) {
STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTrialInfo().getFloor());
if(cell.getCellId()!=mapManager.getBossXY()){
if(mapManager.getTrialInfo().getEnergy()!=-1){
mapManager.setTrialEnergy(mapManager.getTrialInfo().getEnergy() + sTrialConfig.getNormalEnergy());
}
}
}
BehaviorUtil.destoryApointXY(user, destoryXY);
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(groupId);
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 0, BIReason.MAP_FAST_FIGHT_REWARD);
FightInfoProto.FastFightResponse.Builder fastFightResponse = FightInfoProto.FastFightResponse.newBuilder();
if (mapManager.getMonsterId() > 0) {
BaseBehavior baseBehavior = baseBehaviorMap.get(10);
baseBehavior.afterFastFight(user, groupId, fastFightResponse);
}
fastFightResponse.setEnventDrop(drop.build());
fastFightResponse.setResult(resultCode);
// fastFightResponse.addAllRemainHpList(remainHp);
fastFightResponse.setEssenceValue(mapManager.getTrialInfo().getEnergy());
fastFightResponse.build();
fastFightResponse.setEssenceValue(mapManager.getTrialInfo().getEnergy());
// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
MapMissionManager.updateMapMission(user, EventType.fightEvent, groupId, (int) checkResult[1]);
// LOGGER.info("endFight() uid=>{} sMonsterGroup.getRewardgroup()=>{} misson=>{} eventDrop=>{}, missionDrop=>{}", uid, sMonsterGroup.getRewardgroup(), fastFightResponse.getMission(), fastFightResponse.getEnventDrop(), fastFightResponse.getMissionDrop());
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fastFightResponse.build(), true);
}
// if (mapManager.getCanMoveTime() > 0) {
// long leftTime = mapManager.getCanMoveTime() - TimeUtils.now();
// if (leftTime > 0) {
// throw new ErrorCodeException(ErrorCode.HERO_LIVE_AGAIN,Collections.singletonList((leftTime / 1000)+""));
// }
// }
// Cell cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
// if (cell == null) {
// cell = mapManager.getMapInfo().get(mapManager.getCurXY());
// if (cell == null) {
// LOGGER.info("cell == null xy is wrong =>{} triggerXY=>{}", mapManager.getCurXY(), mapManager.getTriggerXY());
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
// }
// }
// int bigEventId = cell.getEventId();
// SEventPointConfig sEventPointConfig = STableManager.getConfig(SEventPointConfig.class).get(bigEventId);
// if (sEventPointConfig == null) {
// LOGGER.info("sEventPointConfig == null");
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
// }
// int[] option = sEventPointConfig.getOption();
// if (option == null) {
// LOGGER.info("option == null sEventPointConfig.getId()=>{}", sEventPointConfig.getId());
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
// }
// int groupId = option[0];
//
// SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
// int mostTime = sChallengeConfig.getMostTime();
// PVEFightEvent pveFightEvent = new PVEFightEvent(uid, mapManager.getTeamId(), mostTime, "", GameFightType.MapFastFight, groupId, 3);
// FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
// long[] checkResult = fightResult.getCheckResult();
//
// List<Long> remainHp = fightResult.getRemainHp();
// //校验结果码 1胜利
// int resultCode = (int) checkResult[0];
// if (resultCode == -1) {
// throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
// }
// int teamId = mapManager.getTeamId();
// mapManager.setLastFightResult(resultCode);
// if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==GlobalsDef.ENDLESS_TEAM){
// mapManager.updateEndlessFightCount(1+mapManager.getEndlessMapInfo().getFightCount());
// }
// if (resultCode == 0) {
// //todo 无尽副本不复活记得改回去
// if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4) {
//// //无尽副本复活消耗
// reviveConsumeExecution(user);
// for(Map.Entry<String, Map<Integer, Long>> entry: mapManager.getHeroAllAttributeMap().entrySet()){
// mapManager.updateHeroOneAttribute(entry.getKey(),HeroAttributeEnum.CurHP.getPropertyId(),0);
// mapManager.updateEndlessHeroHp(entry.getKey(),0);
// }
// }else {
// // 失败需要等待n秒后复活所有英雄
// int dieCount = user.getMapManager().getDieCount();
// dieCount++;
// user.getMapManager().setDieCount(dieCount);
// int[] reviveTime = sChallengeConfig.getReviveTime();
// long time = (long) (MathUtils.calABX(dieCount, reviveTime) * 1000);
// user.getMapManager().setCanMoveTime(TimeUtils.now() + time);
// int leftTime = getLeftTime(user, true);
// remainHp.clear();
// if (leftTime <= (int) (time / 1000)) {
// resetMapInfo(user, false);
// } else {
// initTeamInfo(mapManager.getTeamId(), uid, user, mapManager, 2);
// List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
// for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
// Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
// if (hero == null) {
// continue;
// }
// Map<Integer, Long> heroAttributeMap = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, teamId);
// remainHp.add(heroAttributeMap.get(HeroAttributeEnum.CurHP.getPropertyId()));
// }
// }
// }
// CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
// FightInfoProto.FastFightResponse build = FightInfoProto.FastFightResponse
// .newBuilder()
// .setResult(resultCode)
// .setEnventDrop(dropBuilder)
//// .addAllRemainHpList(remainHp)
// .setEssenceValue(mapManager.getTrialInfo().getEnergy())
// .setLastXY(mapManager.getLastXY())
// .build();
// mapManager.setCurXY(mapManager.getLastXY());
// MessageUtil.sendMessage(session, 1, messageType.getNumber(), build, true);
// return;
//
// }
// List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
// if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==GlobalsDef.ENDLESS_TEAM){
// for (int i = 0 ; i <team.size();i++) {
// Hero hero = user.getHeroManager().getHero(team.get(i).getHeroId());
// Map<Integer, Long> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false,teamId);
// int per = (int)(checkResult[i+2] / (double) heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId())*10000);
// if(checkResult[i+2]>0&&per<=0){
// per = 1;
// }
// mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),per);
// mapManager.updateHeroOneAttribute(team.get(i).getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), (int) checkResult[i+2]);
// }
//
// }else{
// for (TeamPosHeroInfo teamPosHeroInfo : team) {
// mapManager.updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), (int) checkResult[teamPosHeroInfo.getPosition()+1]);
// }
// }
//
// int destoryXY = mapManager.getTriggerXY();
//// if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4) {
//// endlessRefreshMonster(session,destoryXY);
//// }
// //删点之前进行查找
// if (sChallengeConfig.getType() == 2) {
// STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTrialInfo().getFloor());
// if(cell.getCellId()!=mapManager.getBossXY()){
// if(mapManager.getTrialInfo().getEnergy()!=-1){
// mapManager.setTrialEnergy(mapManager.getTrialInfo().getEnergy() + sTrialConfig.getNormalEnergy());
// }
// }
// }
// BehaviorUtil.destoryApointXY(user, destoryXY);
// SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(groupId);
// CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 0, BIReason.MAP_FAST_FIGHT_REWARD);
// FightInfoProto.FastFightResponse.Builder fastFightResponse = FightInfoProto.FastFightResponse.newBuilder();
//
// if (mapManager.getMonsterId() > 0) {
// BaseBehavior baseBehavior = baseBehaviorMap.get(10);
// baseBehavior.afterFastFight(user, groupId, fastFightResponse);
// }
// fastFightResponse.setEnventDrop(drop.build());
// fastFightResponse.setResult(resultCode);
//// fastFightResponse.addAllRemainHpList(remainHp);
// fastFightResponse.setEssenceValue(mapManager.getTrialInfo().getEnergy());
// fastFightResponse.build();
//
//
// fastFightResponse.setEssenceValue(mapManager.getTrialInfo().getEnergy());
//// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
// MapMissionManager.updateMapMission(user, EventType.fightEvent, groupId, (int) checkResult[1]);
//// LOGGER.info("endFight() uid=>{} sMonsterGroup.getRewardgroup()=>{} misson=>{} eventDrop=>{}, missionDrop=>{}", uid, sMonsterGroup.getRewardgroup(), fastFightResponse.getMission(), fastFightResponse.getEnventDrop(), fastFightResponse.getMissionDrop());
// MessageUtil.sendMessage(session, 1, messageType.getNumber(), fastFightResponse.build(), true);
// }
// /**
// * 开始战斗
@ -2040,16 +2033,13 @@ public class MapLogic {
FightEvent fightEvent = new FightEvent(uid, -1, sChallengeConfig.getMostTime(),frames,GameFightType.EndSuddlenlyFight);
FightResult fightResult = FightDispatcher.dispatcher(fightEvent);
//校验结果码 1胜利
long[] checkResult = fightResult.getCheckResult();
//校验结果码 1胜利
int resultCode = (int) checkResult[0];
if (resultCode == -1) {
if (fightResult.getResult() == -1) {
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
}
FightInfoProto.FightEndResponse.Builder builderResponse = FightInfoProto.FightEndResponse
.newBuilder()
.setResult(resultCode);
if (resultCode == 1) {
.setResult(fightResult.getResult());
if (fightResult.getResult() == 1) {
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(mapManager.getSuddenlyBoss());
CommonProto.Drop.Builder dropBuilder = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1.0f, 0, BIReason.SUDDENLY_REWARD);
builderResponse.setEnventDrop(dropBuilder);
@ -2147,10 +2137,9 @@ public class MapLogic {
FightEvent fightEvent = new FightEvent(uid, -1, sMainLevelConfig.getRankTime(),frames, GameFightType.StoryFight);
FightResult fightResult = FightDispatcher.dispatcher(fightEvent);
//校验结果码 1胜利
int resultCode = (int) fightResult.getCheckResult()[0];
if (resultCode == -1) {
if (fightResult.getResult() == -1) {
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
} else if (resultCode == 0) {
} else if (fightResult.getResult() == 0) {
user.getPlayerInfoManager().getNewRechargeInfo().addMainLineLost();
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null, true);
return;
@ -2159,7 +2148,7 @@ public class MapLogic {
openNextMainLevel(session,user, fightId);
FightInfoProto.FightEndResponse.Builder fightEndResponse = FightInfoProto.FightEndResponse.newBuilder();
fightEndResponse.setEnventDrop(drop);
fightEndResponse.setResult(resultCode);
fightEndResponse.setResult(fightResult.getResult());
fightEndResponse.build();
MainLevelManager mainLevelManager = user.getMainLevelManager();
FightInfoProto.MainLevelFightUpdateIndication build = FightInfoProto.MainLevelFightUpdateIndication.newBuilder().setState(mainLevelManager.getState()).setFightId(mainLevelManager.getFightId()).build();
@ -2282,9 +2271,7 @@ public class MapLogic {
FightEvent fightEvent = new FightEvent(uid, -1, sFloodConfig.getBattleTime(),frames, GameFightType.EndMonsterAttackFight);
FightResult fightResult = FightDispatcher.dispatcher(fightEvent);
//校验结果码 1胜利
long[] checkResult = fightResult.getCheckResult();
//校验结果码 1胜利
int resultCode = (int) checkResult[0];
int resultCode = fightResult.getResult();
if (resultCode == -1) {
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
} else if (resultCode == 0) {
@ -3119,13 +3106,12 @@ public class MapLogic {
.setFightType(GameFightType.DailyChallenge.getFightType().getType())
.setFightId(FightUtil.getFightId(user.getId(),GameFightType.DailyChallenge))
.build();
long[] checkResult = fightResult.getCheckResult();
builder.setFightData(fightData);
// 记录战报
FightRecordLogic.getInstance().addRecordMap(user,fightData);
if(checkResult[0]>0){
if(fightResult.getResult()>0){
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sDailyChallengeConfig.getReward(), 1, 0, 1);
builder.setDrop(drop);
playerInfoManager.addDailyPass(id);

View File

@ -303,12 +303,12 @@ public abstract class AbstractMap implements IMap {
}
}
}
public void refreshHp(User user,int teamId,int[] checkResult){
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
for (TeamPosHeroInfo teamPosHeroInfo : team) {
user.getMapManager().updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[teamPosHeroInfo.getPosition()+1]);
}
}
// public void refreshHp(User user,int teamId,int[] checkResult){
// List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
// for (TeamPosHeroInfo teamPosHeroInfo : team) {
// user.getMapManager().updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[teamPosHeroInfo.getPosition()+1]);
// }
// }
public int monsterGroupChange(int groupId,int level,int mapId){
return groupId;
}

View File

@ -198,18 +198,18 @@ public class EndlessMap extends AbstractMap{
@Override
public void refreshHp(User user, int teamId, int[] checkResult) {
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
MapManager mapManager = user.getMapManager();
for (int i = 0 ; i <team.size();i++) {
Hero hero = user.getHeroManager().getHero(team.get(i).getHeroId());
Map<Integer, Long> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false,teamId);
int per = (int)(checkResult[i+2] / (double) heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId())*10000);
mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),per);
mapManager.updateHeroOneAttribute(team.get(i).getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[i+2]);
}
}
// @Override
// public void refreshHp(User user, int teamId, int[] checkResult) {
// List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
// MapManager mapManager = user.getMapManager();
// for (int i = 0 ; i <team.size();i++) {
// Hero hero = user.getHeroManager().getHero(team.get(i).getHeroId());
// Map<Integer, Long> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false,teamId);
// int per = (int)(checkResult[i+2] / (double) heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId())*10000);
// mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),per);
// mapManager.updateHeroOneAttribute(team.get(i).getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[i+2]);
// }
// }
@Override
public void fastFight(int uid, FightInfoProto.FastFightResponse.Builder fastFightResponseBuilder) throws Exception {
@ -257,13 +257,10 @@ public class EndlessMap extends AbstractMap{
pveFightEvent.setAttackBloodMap(bloodMap);
//怪物剩余血量
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
long[] checkResult = fightResult.getCheckResult();
for(int i = 0 ; i <checkResult.length;i++){
LOGGER.info("战斗返回数据{}",checkResult[i]);
}
LOGGER.info("战斗返回数据{}", Arrays.toString(fightResult.getCheckResult()));
//校验结果码 1胜利
int resultCode = (int) checkResult[0];
int resultCode = fightResult.getResult();
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.ENDLESS_TEAM);
if (resultCode == -1) {
@ -273,19 +270,15 @@ public class EndlessMap extends AbstractMap{
for (int i = 0 ; i <team.size();i++) {
mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),0);
}
List<Long> monsterHp = new ArrayList<>();
for(int i = 2;i<checkResult.length;i++){
monsterHp.add(checkResult[i]);
}
List<Long> monsterHp = fightResult.getRemainHp();
mapManager.updataEndlessMonsterHp(mapManager.getTriggerXY(),monsterHp);
}else{
for (TeamPosHeroInfo info:team) {
int position = info.getPosition();
for (int i = 0; i < team.size(); i++) {
TeamPosHeroInfo info = team.get(0);
Hero hero = user.getHeroManager().getEndlessHeroInfo().get(info.getHeroId());
Map<Integer, Long> heroAttributeMap = SEndlessHeroProp.propsMap.get(hero.getTemplateId());
int per = (int)(checkResult[position+1] *10000d / heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId()));
if(checkResult[position+1]>0&&per<=0){
int per = (int)(fightResult.getRemainHp().get(i) * 10000d / heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId()));
if(fightResult.getRemainHp().get(i)>0&&per<=0){
per = 1;
}
LOGGER.info("生命剩余百分比,{}",per);
@ -557,19 +550,20 @@ public class EndlessMap extends AbstractMap{
* @param responseBuilder
* @throws Exception
*/
public void startFight(int uid,FightInfoProto.FightStartResponse.Builder responseBuilder) throws Exception{
@Override
public void startFight(int uid, FightInfoProto.FightStartResponse.Builder responseBuilder) throws Exception{
User user = UserManager.getUser(uid);
MapManager mapManager = user.getMapManager();
if (mapManager.getMapInfo() == null) {
LOGGER.info("mapManager.getMapInfo() == null");
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
if (mapManager.getCanMoveTime() > 0) {
long leftTime = mapManager.getCanMoveTime() - TimeUtils.now();
if (leftTime > 0) {
// throw new ErrorCodeException(ErrorCode.HERO_LIVE_AGAIN,Collections.singletonList((leftTime / 1000)+""));
}
}
// if (mapManager.getCanMoveTime() > 0) {
// long leftTime = mapManager.getCanMoveTime() - TimeUtils.now();
// if (leftTime > 0) {
//// throw new ErrorCodeException(ErrorCode.HERO_LIVE_AGAIN,Collections.singletonList((leftTime / 1000)+""));
// }
// }
Cell cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
if (cell == null) {
cell = mapManager.getMapInfo().get(mapManager.getCurXY());
@ -636,15 +630,10 @@ public class EndlessMap extends AbstractMap{
int optionId = Integer.parseInt((String) valueMap.get(RedisKey.NEED_VICTORY_AFTER));
int nextEventId = 0;
SOptionConfig sOptionConfig = SOptionConfig.sOptionConfigMap.get(optionId);
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
//校验结果码 1胜利
int resultCode=0;
long[] checkResult = new long[0];
int monsterGroupId=0;
List<Long> remainHp = new ArrayList<>(6);
int seed = Integer.parseInt((String) valueMap.get(RedisKey.FIGHT_SEED));
monsterGroupId = Integer.parseInt((String) valueMap.get(RedisKey.FIGHT_GROUPID));
int monsterGroupId = Integer.parseInt((String) valueMap.get(RedisKey.FIGHT_GROUPID));
CommonProto.FightTeamInfo.Builder fightTeamBuilder = CommonProto.FightTeamInfo.newBuilder();
JsonFormat.merge((String) valueMap.get(RedisKey.FIGHT_HEROES), fightTeamBuilder);
CommonProto.FightTeamInfo fightTeamInfo = fightTeamBuilder.build();
@ -657,8 +646,10 @@ public class EndlessMap extends AbstractMap{
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterTeamList);
LuaValue getOptionData = FightDataUtil.getOptionData(frames);
int mostTime = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getMostTime();
checkResult = CheckFight.getInstance().checkFight(seed, mostTime, getFightData, getOptionData, FightType.MapExploreFight);
resultCode = (int) checkResult[0];
long[] checkResult = CheckFight.getInstance().checkFight(seed, mostTime, getFightData, getOptionData, FightType.MapExploreFight);
FightResult fight = FightResult.newBuilder().setCheckResult(checkResult).build();
int resultCode = fight.getResult();
//校验结果码 1胜利
if (resultCode == -1) {
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
}
@ -697,10 +688,7 @@ public class EndlessMap extends AbstractMap{
mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),0);
}
}
List<Long> monsterHp = new ArrayList<>();
for(int i = 2;i<checkResult.length;i++){
monsterHp.add(checkResult[i]);
}
List<Long> monsterHp = fight.getRemainHp();
mapManager.updataEndlessMonsterHp(mapManager.getTriggerXY(),monsterHp);
return;
}
@ -708,26 +696,17 @@ public class EndlessMap extends AbstractMap{
//无尽本更新血量
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.ENDLESS_TEAM);
for (int i = 0 ; i <team.size();i++) {
int position = team.get(i).getPosition();
Hero hero = user.getHeroManager().getEndlessHeroInfo().get(team.get(i).getHeroId());
Map<Integer, Long> heroAttributeMap = SEndlessHeroProp.propsMap.get(hero.getTemplateId());
int per = (int)(checkResult[position+1] / (double) heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId())*10000);
if(checkResult[i+1]>0&&per<=0){
int per = (int)(fight.getRemainHp().get(i) / (double) heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId())*10000);
if(fight.getRemainHp().get(i)>0&&per<=0){
per = 1;
}
mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),per);
}
for (int i = 2; i < checkResult.length; i++) {
if (checkResult[i] <= 0) {
remainHp.add((long) 0);
} else {
remainHp.add(checkResult[i]);
}
}
remainHp = fight.getRemainHp();
mapManager.removeEndlessOneMonsterHp(mapManager.getCurXY());
//血量更新
// refreshHp(user, mapManager.getTeamId(),checkResult);
@ -767,7 +746,7 @@ public class EndlessMap extends AbstractMap{
}
builder.setEventId(nextEventId);
MapMissionManager.updateMapMission(user, EventType.fightEvent, monsterGroupId, (int) checkResult[1]);
MapMissionManager.updateMapMission(user, EventType.fightEvent, monsterGroupId, (int)fight.getDuration());
if (monsterGroupId == mapManager.getSuddenlyBoss()) {
mapManager.findSuddenlyBoss(0, 0);
}

View File

@ -195,6 +195,7 @@ public class TowerMap extends AbstractMap {
mapManager.setTrialEnergy(mapManager.getTrialInfo().getEnergy() + sTrialConfig.getNormalEnergy());
}
}
@Override
public void initMap(MapManager mapManager, User user) throws Exception {
Map<Integer, Cell> trialMapInfo = mapManager.getTrialInfo().getMapInfo();
if(trialMapInfo !=null&&!trialMapInfo.isEmpty()){
@ -425,19 +426,17 @@ public class TowerMap extends AbstractMap {
pveFightEvent.setMonsterRemainHp(monsterHp.get(cell.getCellId()));
}
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
long[] checkResult = fightResult.getCheckResult();
//校验结果码 1胜利
int resultCode = (int) checkResult[0];
int resultCode = fightResult.getResult();
if (resultCode == -1) {
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
}
mapManager.setLastFightResult(resultCode);
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.TRIAL_TEAM);
if(teamPosHeroInfos==null||teamPosHeroInfos.size()!=1){
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
if(teamPosHeroInfos==null||teamPosHeroInfos.size()<=0){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
TrailHero trailHero = trialInfo.getHeroInfo().get(teamPosHeroInfos.get(0).getHeroId());
@ -448,10 +447,7 @@ public class TowerMap extends AbstractMap {
Cell createCell = null;
if (resultCode == 0) {
//记录怪剩余血量
List<Long> hpList= new ArrayList<>();
for(int i = 2;i<checkResult.length;i++){
hpList.add(checkResult[i]);
}
List<Long> hpList = fightResult.getRemainHp();
if(monsterHp!=null){
monsterHp.put(cell.getCellId(),hpList);
}
@ -469,7 +465,7 @@ public class TowerMap extends AbstractMap {
//如果大于100则生成boss点
createCell=callChief(user);
}
remainHp = checkResult[3];
remainHp = fightResult.getRemainHp().get(1);
BehaviorUtil.destoryApointXY(user, destoryXY);
mapManager.updateTrialKillCount(trialInfo.getKillCount()+1);
@ -477,19 +473,12 @@ public class TowerMap extends AbstractMap {
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 0, BIReason.MAP_FAST_FIGHT_REWARD);
fastFightResponseBuilder.setEnventDrop(drop.build());
}else{
List<Long> hpList= new ArrayList<>();
for(int i = 2;i<checkResult.length;i++){
if(i==3){
hpList.add(checkResult[i]);
}else{
hpList.add((long) 0);
}
}
List<Long> hpList= fightResult.getRemainHp();
if(monsterHp!=null){
monsterHp.put(cell.getCellId(),hpList);
}
mapManager.updateMapMonsterHp(monsterHp);
remainHp = checkResult[2];
remainHp = fightResult.getRemainHp().get(0);
resultCode = 0;
}
//生成传送门,需要在删点之后
@ -519,7 +508,7 @@ public class TowerMap extends AbstractMap {
// 记录战报
FightRecordLogic.getInstance().addRecordMap(user,fightResult.getFightData());
// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
MapMissionManager.updateMapMission(user, EventType.fightEvent, groupId, (int) checkResult[1]);
MapMissionManager.updateMapMission(user, EventType.fightEvent, groupId, fightResult.getDuration());
ReportUtil.onReportEvent(user,ReportEventEnum.CHALLENGE_PANOPTIC_MIRROR_ENEMY.getType(),trialInfo.getFloor(),resultCode==1?"胜利":"失败");
// LOGGER.info("endFight() uid=>{} sMonsterGroup.getRewardgroup()=>{} misson=>{} eventDrop=>{}, missionDrop=>{}", uid, sMonsterGroup.getRewardgroup(), fastFightResponse.getMission(), fastFightResponse.getEnventDrop(), fastFightResponse.getMissionDrop());
}

View File

@ -73,10 +73,9 @@ public class QuickStartMonsterFighter extends BaseHandler<FightInfoProto.QuickSt
int mostTime = sFloodConfig.getBattleTime();
PVEFightEvent pveFightEvent = new PVEFightEvent(uid,teamId, mostTime, "", GameFightType.MonterFight, groupId, 3);
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
long[] checkResult = fightResult.getCheckResult();
//校验结果码 1胜利
int resultCode = (int) checkResult[0];
int resultCode = fightResult.getResult();
if (resultCode == -1) {
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
}

View File

@ -77,9 +77,6 @@ public class Cmd_review_gm extends GmAbstract {
if (defMemberInfo.getType() == 0) {
FamilyFightInfo fightInfo = defMemberInfo.getFightInfo();
//<<<<<<< HEAD
// pvpFightEvent.setDefFightSnapData(new DefFightSnapData(fightInfo.getHeroAttribute(), fightInfo.getHeroSkills(), fightInfo.getPokenmonSkills(), fightInfo.getPassiveSkills()));
//=======
pvpFightEvent.setDefFightSnapData(new DefFightSnapData(fightInfo.getHeroAttribute(), fightInfo.getHeroSkills(), fightInfo.getPokenmonSkills(), fightInfo.getPassiveSkills(), defUid));
defForce = fightInfo.getForce();
} else {
@ -90,9 +87,6 @@ public class Cmd_review_gm extends GmAbstract {
}
if (attackMemberInfo.getType() == 0) {
FamilyFightInfo fightInfo = attackMemberInfo.getFightInfo();
//<<<<<<< HEAD
// pvpFightEvent.setAttackFightSnapData(new DefFightSnapData(fightInfo.getHeroAttribute(), fightInfo.getHeroSkills(), fightInfo.getPokenmonSkills(), fightInfo.getPassiveSkills()));
//=======
pvpFightEvent.setAttackFightSnapData(new DefFightSnapData(fightInfo.getHeroAttribute(), fightInfo.getHeroSkills(), fightInfo.getPokenmonSkills(), fightInfo.getPassiveSkills(), attackId));
minForce = fightInfo.getForce();
} else {
@ -112,7 +106,7 @@ public class Cmd_review_gm extends GmAbstract {
}
CommonProto.FightTeamInfo fightTeamInfo = null;
CommonProto.FightTeamInfo deffightTeamInfo = null;
CommonProto.FightTeamInfo deffightTeamInfo;
if(pvpFightEvent.getAttackFightSnapData()!=null){
fightTeamInfo = FightUtil.makeFightWithSnapData(pvpFightEvent.getAttackFightSnapData());
}
@ -124,16 +118,10 @@ public class Cmd_review_gm extends GmAbstract {
deffightTeamInfo = FightUtil.makePersonFightData(defInMem, pvpFightEvent.getDefTeamId(),null,null);
}else{
deffightTeamInfo = FightUtil. makeRobotFightData(pvpFightEvent.getDefUid());
// deffightTeamInfo = FightUtil. makeRobotFightData(pvpFightEvent.getDefUid());
}
}
if(fightTeamInfo==null){
//<<<<<<< HEAD
// if( pvpFightEvent.getFightType()!= GameFightType.TOPArena2RobotFight){
// if( SArenaRobotConfig.getsArenaRobotConfigById(pvpFightEvent.getAttackUid()) !=null){
// fightTeamInfo = FightUtil. makeRobotFightData(pvpFightEvent.getAttackUid());
//=======
if( pvpFightEvent.getFightType()!=GameFightType.TOPArena2RobotFight){
if( SArenaRobotConfig.getsArenaRobotConfigById(pvpFightEvent.getAttackUid()) !=null){
fightTeamInfo =FightUtil. makeRobotFightData(pvpFightEvent.getAttackUid());

View File

@ -248,7 +248,6 @@ public class SituationLogic {
}
//组装战斗数据
PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), formation, 20, "", GameFightType.DailyChallenge, sRaceTowerConfig.getMonsterId(), 3);
// FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
FightResult fightResult = getFightForSituation(pveFightEvent, buffMap);
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
.setFightMaxTime(20)
@ -258,14 +257,13 @@ public class SituationLogic {
.setFightType(GameFightType.DailyChallenge.getFightType().getType())
.setFightId(FightUtil.getFightId(user.getId(),GameFightType.DailyChallenge))
.build();
long[] checkResult = fightResult.getCheckResult();
builder.setFightData(fightData);
// 记录战报
FightRecordLogic.getInstance().addRecordMap(user,fightData);
//挑战成功
if(checkResult[0]>0){
if(fightResult.getResult()>0){
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sRaceTowerConfig.getFirstReward(), 1, 0, BIReason.SITUATION_CHALLENGE_REWARD);
builder.setDrop(drop);

View File

@ -268,7 +268,7 @@ public class ArenaLogic {
//数据互换
byte[] snapRecord = build.toByteArray();
arenaRecord.setFightData(snapRecord);
return (int) fightResult.getCheckResult()[0];
return fightResult.getResult();
}
@ -291,7 +291,7 @@ public class ArenaLogic {
.setHeroFightInfos(fightTeamInfo)
.addMonsterList(deffightTeamInfo)
.build());
return (int) fightResult.getCheckResult()[0];
return fightResult.getResult();
}
public String checkChallenge(User user,int skipFight, ArenaEnemy enemyInfo) throws Exception {

View File

@ -361,7 +361,7 @@ public class DeathPathLogic {
SGuildWarConfig config = STableManager.getConfig(SGuildWarConfig.class).get(pathId);
PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), GlobalsDef.DEATH_PATH_TEAM, SGuildSetting.sGuildSetting.getWarTime(), "", GameFightType.DeathPathChallenge, config.getMonsterId(), 3);
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
long damage = fightResult.getCheckResult()[1];
long damage = fightResult.getDuration();
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
.setFightMaxTime(SGuildSetting.sGuildSetting.getWarTime())
.setFightSeed(fightResult.getSeed())
@ -508,8 +508,8 @@ public class DeathPathLogic {
for (ZSetOperations.TypedTuple<String> n : allGuild) {
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(Integer.parseInt(n.getValue()));
if(guildInfo!=null){
GuildCache crossGuild = CrossServiceLogic.getCrossGuild(guildInfo.getId());
String name = CrossServiceLogic.simplifyServerName(crossGuild.getServerId());
GuildCache crossGuild = CrossDeathPathLogic.getCrossGuild(guildInfo.getId());
String name = CrossDeathPathLogic.getInstance().getServerNameByDeathPath(crossGuild.getServerId());
String serverName = getGroupId()>0?name:"";
Family.DeathPathInfo info = Family.DeathPathInfo.newBuilder()
.setGuildName(guildInfo.getName()).setGid(currFirstGuildId)

View File

@ -196,19 +196,18 @@ public class GuildChallengeLogic {
List<Long> hp = new ArrayList<>();
for(int i = 0 ; i <6;i++){
if(i==1){
hp.add((long) guildInfo.getBossHpRemain());
hp.add(guildInfo.getBossHpRemain());
}else{
hp.add((long) 0);
hp.add(0L);
}
}
pveFightEvent.setMonsterRemainHp(hp);
}
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
fightData = fightResult.getFightData();
long[] checkResult = fightResult.getCheckResult();
int damageInt = (int) checkResult[1];
int damageInt = fightResult.getDuration();
if(checkResult[0]==1) {
if(fightResult.getResult()==1) {
if(guildInfo.getBossHpRemain()!=-1){
kill = 1;
//重置boss血量
@ -228,10 +227,10 @@ public class GuildChallengeLogic {
guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp());
}
}
}else if(checkResult[0]==0){
}else if(fightResult.getResult()==0){
//怪物保持在第四位
if(guildInfo.getBossHpRemain()!=-1){
guildInfo.setBossHpRemain(checkResult[3]);
guildInfo.setBossHpRemain(fightResult.getRemainHp().get(1));
}
}else{
error = "战斗异常!";

View File

@ -451,33 +451,25 @@ public class GuildFightLogic {
pvpFightEvent.setAttackBloodMap(attackBloodMap);
pvpFightEvent.setDefFightSnapData(new DefFightSnapData(defendInfo.getHeroAttribute(),defendInfo.getHeroSkills(),defendInfo.getPokenmonSkills(),defendInfo.getPassiveSkills()));
FightResult dispatcher = FightDispatcher.dispatcher(pvpFightEvent);
long[] fightResult = dispatcher.getCheckResult();
int aliveCount = 0;
// 战斗之后数据处理
if(fightResult[0]==0) {
for(int i = 2 ; i <fightResult.length;i++){
if(fightResult[i]>0){
aliveCount++;
}
}
}else{
aliveCount=0;
//战斗之后数据处理
if(dispatcher.getResult()==0) {
aliveCount = (int) dispatcher.getRemainHp().stream().filter(v->v>0).count();
}
defendInfo.setHeroAttribute(BloodLogic.getInstance().afterBattleRecord(heroAttribute,fightResult));
defendInfo.setHeroAttribute(BloodLogic.getInstance().afterBattleRecord(heroAttribute,dispatcher.getCheckResult()));
//获得星数
int getStar;
List<TeamPosHeroInfo> teamAttack = userAttack.getTeamPosManager().getTeamPosForHero().get(502);
if (fightResult[0] == 1) {
if (dispatcher.getResult() == 1) {
getStar = defendInfo.getStarCount();
defendInfo.setStarCount(0);
int indexAttack =2;
int indexAttack = 0;
for(TeamPosHeroInfo attack:teamAttack){
Hero hero = userAttack.getHeroManager().getHeroMap().get(attack.getHeroId());
Long hp = dispatcher.getRemainHp().get(indexAttack);
Map<Integer, Long> integerIntegerMap = HeroLogic.getInstance().calHeroNotBufferAttribute(userAttack, hero, false, 502);
long bloodLess = ((integerIntegerMap.get(HeroAttributeEnum.Hp.getPropertyId())-fightResult[indexAttack])) *100/ integerIntegerMap.get(HeroAttributeEnum.Hp.getPropertyId());
long bloodLess = ((integerIntegerMap.get(HeroAttributeEnum.Hp.getPropertyId())-hp) * 100 / integerIntegerMap.get(HeroAttributeEnum.Hp.getPropertyId()));
redisUtil.putMapEntry(RedisKey.FAMILY_ATTACK_BLOOD,String.valueOf(userAttack.getId()),attack.getHeroId(),bloodLess);
indexAttack++;
}
@ -526,7 +518,7 @@ public class GuildFightLogic {
// 记录战报
FightRecordLogic.getInstance().addRecordMap(userAttack,fightData);
Family.FamilyFightAttackResponse response = Family.FamilyFightAttackResponse.newBuilder().setResult((int) fightResult[0]).setStarCount(getStar).setData(fightData).build();
Family.FamilyFightAttackResponse response = Family.FamilyFightAttackResponse.newBuilder().setResult(dispatcher.getResult()).setStarCount(getStar).setData(fightData).build();
userAttack.getUserMissionManager().onGameEvent(userAttack, GameEvent.FAMILY_FIGHT_ATTACK);
MessageUtil.sendMessage(session, 1, messageType.getNumber(), response, true);
}
@ -1095,7 +1087,7 @@ public class GuildFightLogic {
FightResult fightResult = FightDispatcher.dispatcher(fightEvent);
PlayerLogic.getInstance().checkAndUpdate(user, VipPrivilegeType.GUILD_BOSS_CHALLENGE_TIMES, 1);
//校验结果码 1胜利
int myHurt = (int) fightResult.getCheckResult()[1];
int myHurt = fightResult.getDuration();
if(myHurt>user.getGuildMyInfo().getMaxBossHurt()){
user.getGuildMyInfo().setMaxBossHurt(myHurt);
}
@ -1233,7 +1225,7 @@ public class GuildFightLogic {
private static int carProgress=-2 ;
public static Family.CarDelayProgressIndication carDelayProgressIndication;
public static void minuteCheckForCarFight() throws Exception {
public static void minuteCheckForCarFight(){
LOGGER.info("minuteCheckForCarFight 车迟斗法progress={}",carProgress);
int carProgressTmp =carProgress;
int id =1;

View File

@ -13,12 +13,12 @@ public class AreFightPro implements EndFightProcessor {
ArenaRecord arenaRecord;
@Override
public void endfightProcess(FightResult fightResult) {
int result = (int) fightResult.getCheckResult()[0];
int result = fightResult.getResult();
arenaRecord.setFightResult((int) fightResult.getCheckResult()[0]);
arenaRecord.setFightResult(fightResult.getResult());
if(ChampionshipLogic.getSchedule()==2){
String key = String.valueOf(arenaRecord.getAttackId() * 2222 + String.valueOf(arenaRecord.getDefUid()));
String key = arenaRecord.getAttackId() * 2222 + String.valueOf(arenaRecord.getDefUid());
//胜负结果出了之后 选择一局记分
boolean jump=false;
Integer state = RedisUtil.getInstence().getMapValue(RedisKey.CHAMPION_ARENA_RECORD_THREE, "", key, Integer.class);

View File

@ -25,6 +25,7 @@ import com.ljsd.jieling.logic.activity.fourChallenge.FourChallengeLogic;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.passiveSkillCal.PassiveskillCalEnum;
import com.ljsd.jieling.logic.fight.result.FightResult;
import com.ljsd.jieling.logic.help.HelpHero;
import com.ljsd.jieling.logic.help.HelpHeroLogic;
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
@ -524,7 +525,7 @@ public class CombatLogic {
if(!enough){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
bossGroupId = adventureBoss.getBossGroupId();
bossGroupId = adventureBoss.getBossGroupId();
Map<Integer,List<Long>> hps = new HashMap<>(1);
hps.put(0,adventureBoss.getRemainHps());
CommonProto.FightTeamInfo fightTeamInfo = BehaviorUtil.getFightTeamInfo(user, teamId,true);
@ -550,8 +551,9 @@ public class CombatLogic {
.build();
builder.setFightData(build);
long[] checkResult = CheckFight.getInstance().checkFight(seed, sMainLevelConfig.getInvasionBossTime(), getFightData, getOptionData, FightType.InvasionBossFight);
totalHurt+= updateBossAndGetHurtForFight(checkResult, adventureBoss);
fightResult = (int) checkResult[0];
FightResult fight = FightResult.newBuilder().setCheckResult(checkResult).build();
totalHurt += updateBossAndGetHurtForFight(fight, adventureBoss);
fightResult = fight.getResult();
//发送击杀boss奖励和发现者奖励
if(fightResult == 1){
i = i+1;
@ -644,20 +646,19 @@ public class CombatLogic {
return killRewardMail;
}
public int updateBossAndGetHurtForFight(long[] checkResult,AdventureBoss adventureBoss){
public int updateBossAndGetHurtForFight(FightResult fight,AdventureBoss adventureBoss){
int hurt = 0;
List<Long> oldRemainHp = adventureBoss.getRemainHps();
int fightResult = (int) checkResult[0];
int fightResult = fight.getResult();
if(fightResult == 1){
for(Long hp : oldRemainHp){
hurt+=hp;
}
return hurt;
}
List<Long> result =new ArrayList<>(5);
for(int i=2;i<=oldRemainHp.size()+1;i++){
result.add(checkResult[i]);
hurt+=(oldRemainHp.get(i-2)-checkResult[i]);
List<Long> result = fight.getRemainHp();
for (int i = 0; i < oldRemainHp.size(); i++) {
hurt += (oldRemainHp.get(i) - result.get(i));
}
adventureBoss.setRemainHp(adventureBoss.getRemainHp() - hurt);
adventureBoss.setRemainHps(result);

View File

@ -21,27 +21,24 @@ public class FightDispatcher {
}
//gs-fight
public static void dispatcherAsync(FightEvent fightEvent,long id) throws Exception {
ThreadManager.getScheduledExecutor().submit(new Runnable() {
@Override
public void run() {
try {
GameFightType fightType = fightEvent.getFightType();
FightResult fightResult = fightType.getFightEventProcesor().process(fightEvent);
fightResult.setId(id);
FightDispatcher.dispatcherAsyncToGs(fightResult);
} catch (Exception e) {
e.printStackTrace();
}
}
});
public static void dispatcherAsync(FightEvent fightEvent,long id) {
ThreadManager.getScheduledExecutor().submit(() -> {
try {
GameFightType fightType = fightEvent.getFightType();
FightResult fightResult = fightType.getFightEventProcesor().process(fightEvent);
fightResult.setId(id);
FightDispatcher.dispatcherAsyncToGs(fightResult);
} catch (Exception e) {
e.printStackTrace();
}
});
}
private static Map<Long,EndFightProcessor> map = new ConcurrentHashMap<>();
//fight - gs
public static void dispatcherAsyncToGs(FightResult fightResult) throws Exception {
public static void dispatcherAsyncToGs(FightResult fightResult) {
EndFightProcessor remove = map.remove(fightResult.getId());
remove.endfightProcess(fightResult);
}

View File

@ -203,10 +203,9 @@ public class FightUtil {
}
public static FightResult getFightFromRedis(FightEvent fightEvent) throws Exception {
public static FightResult getFightFromRedis(FightEvent fightEvent) throws Exception {
GameFightType fightType = fightEvent.getFightType();
int playerId = fightEvent.getAttackUid();
String frames = fightEvent.getFrames();
int fightTime = fightEvent.getMostTime();
String key = RedisKey.getKey(fightType.getFightTypeOfRedis(), Integer.toString(playerId), false);

View File

@ -52,7 +52,7 @@ public enum GameFightType {
TowerMap(FightType.TowerMap,new DefaultWithoutHandFightHandler(),null),
FourChallenge(FightType.FourChallenge,new DefaultWithoutHandFightHandler(),null),
SEVENWORLD(FightType.QIJIE_FIGHT,new DefaultWithoutHandFightHandler(),null),
SevenWorld(FightType.QIJIE_FIGHT,new DefaultWithoutHandFightHandler(),null),
;

View File

@ -92,13 +92,13 @@ public class FightResult {
public long[] getCheckResult() {
return checkResult;
}
public List<Long> getRemainHp()throws Exception{
public List<Long> getRemainHp(){
//result check
List<Long> remainHp = new ArrayList<>(5);
for (int i = 2; i < checkResult.length; i++) {
for (int i = 2; i < 8; i++) {
if (checkResult[i] <= 0) {
remainHp.add((long) 0);
remainHp.add(0L);
} else {
remainHp.add(checkResult[i]);
}
@ -106,6 +106,18 @@ public class FightResult {
return remainHp;
}
public int getResult(){
return (int) checkResult[0];
}
public long getDuration(){
return checkResult[1];
}
public int getCurRound(){
return (int) checkResult[8];
}
public CommonProto.FightData getFightData() {
return fightData;
}