合并代码1
parent
18f91727e4
commit
def246c407
|
|
@ -90,7 +90,7 @@ public class CheckFight {
|
||||||
* @param seed
|
* @param seed
|
||||||
* @param fightData
|
* @param fightData
|
||||||
* @param optionData
|
* @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){
|
public long[] checkFight(int seed,int maxTime, LuaValue fightData, LuaValue optionData,FightType fightType){
|
||||||
LuaValue transCoderObj = this.getTransCoderObj();
|
LuaValue transCoderObj = this.getTransCoderObj();
|
||||||
|
|
@ -101,23 +101,21 @@ public class CheckFight {
|
||||||
args.set("type",fightType.getType());
|
args.set("type",fightType.getType());
|
||||||
args.set("maxRound",maxTime);
|
args.set("maxRound",maxTime);
|
||||||
LuaValue result = func.call( args,fightData,optionData);
|
LuaValue result = func.call( args,fightData,optionData);
|
||||||
int status = result.get("result").toint();
|
long[] resultCache = new long[9];//对方阵容走配置 Todo 后面结构走配置
|
||||||
long duration = result.get("duration").tolong();
|
resultCache[0]= result.get("result").tolong();
|
||||||
long[] resultCache = new long[8];//对方阵容走配置 Todo 后面结构走配置
|
resultCache[1]= result.get("duration").tolong();
|
||||||
resultCache[0]= status;
|
LOGGER.info(" lua check test fight result : "+ resultCache[0]);
|
||||||
resultCache[1]= duration;
|
for (int i = resultCache.length; i <= result.length(); i++) {
|
||||||
LOGGER.info(" lua check test fight result : "+ status);
|
long talon = result.rawget(i).tolong();
|
||||||
for (int i = 1; i <= result.length(); i++) {
|
if(talon>0){
|
||||||
long tolong = result.rawget(i).tolong();
|
resultCache[i]= Math.min(Long.MAX_VALUE,talon);
|
||||||
if(tolong>0){
|
|
||||||
resultCache[i+1]= Math.min(Long.MAX_VALUE,tolong);
|
|
||||||
}else {
|
}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();
|
resultCache[i] = result.rawget(i).tolong();
|
||||||
LOGGER.info(i+" --> 单位剩余血量 : "+ resultCache[i+1]);
|
LOGGER.info(i+" --> 单位剩余血量 : "+ resultCache[i]);
|
||||||
}
|
}
|
||||||
|
resultCache[8]= result.get("curRound").tolong();
|
||||||
return resultCache;
|
return resultCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
|
||||||
import com.ljsd.fight.DefFightSnapData;
|
import com.ljsd.fight.DefFightSnapData;
|
||||||
import com.ljsd.jieling.logic.fight.FightUtil;
|
import com.ljsd.jieling.logic.fight.FightUtil;
|
||||||
import com.ljsd.jieling.logic.fight.GameFightType;
|
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.HeroAttributeEnum;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
import rpc.protocols.CommonProto;
|
import rpc.protocols.CommonProto;
|
||||||
|
|
@ -76,13 +77,8 @@ public class EndConfirmExpeditionBattleRequestHandler extends BaseHandler<Expedi
|
||||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
}
|
}
|
||||||
int maxTime = sExpeditionSetting.getFightTime();
|
int maxTime = sExpeditionSetting.getFightTime();
|
||||||
//CommonProto.FightTeamInfo fightTeamInfo = FightUtil.makePersonFightDataWithDouble(user,teamId,user.getExpeditionManager().getHeroHP());
|
|
||||||
CommonProto.FightTeamInfo fightTeamInfo = ExpeditionLogic.getFightTeamInfoWithDouble(user,teamId,user.getExpeditionManager().getHeroHP());
|
CommonProto.FightTeamInfo fightTeamInfo = ExpeditionLogic.getFightTeamInfoWithDouble(user,teamId,user.getExpeditionManager().getHeroHP());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SnapFightInfo deffightInfo = nodeInfo.getSnapFightInfo();
|
SnapFightInfo deffightInfo = nodeInfo.getSnapFightInfo();
|
||||||
|
|
||||||
//添加被动技能
|
//添加被动技能
|
||||||
LuaValue getFightData;
|
LuaValue getFightData;
|
||||||
CommonProto.FightTeamInfo deffightTeamInfo = FightUtil.makeFightBySnapDataWithDouble(new DefFightSnapData(deffightInfo.getHeroAttribute(),deffightInfo.getHeroSkills(),deffightInfo.getPokenmonSkills(),deffightInfo.getPassiveSkills()),nodeInfo.getBossHP());
|
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+"");
|
LuaValue getOptionData = FightDataUtil.getOptionData(uid+"");
|
||||||
long[] checkResult = CheckFight.getInstance().checkFight(seed, maxTime, getFightData, getOptionData, GameFightType.Expediton.getFightType());
|
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) {
|
if (resultCode == -1) {
|
||||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||||
}
|
}
|
||||||
List<Long> remainHp = new ArrayList<>(5);
|
List<Long> remainHp = fight.getRemainHp();
|
||||||
for (int i = 2; i < checkResult.length; i++) {
|
|
||||||
if (checkResult[i] <= 0) {
|
|
||||||
remainHp.add((long) 0);
|
|
||||||
} else {
|
|
||||||
remainHp.add(checkResult[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//更新节点状态 节点
|
//更新节点状态 节点
|
||||||
final int oldlay = nodeInfo.getLay();
|
final int oldlay = nodeInfo.getLay();
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
|
||||||
import com.ljsd.fight.DefFightSnapData;
|
import com.ljsd.fight.DefFightSnapData;
|
||||||
import com.ljsd.jieling.logic.fight.FightUtil;
|
import com.ljsd.jieling.logic.fight.FightUtil;
|
||||||
import com.ljsd.jieling.logic.fight.GameFightType;
|
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.HeroAttributeEnum;
|
||||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||||
|
|
@ -107,19 +108,13 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
|
||||||
|
|
||||||
LuaValue getOptionData = FightDataUtil.getOptionData(uid+"");
|
LuaValue getOptionData = FightDataUtil.getOptionData(uid+"");
|
||||||
long[] checkResult = CheckFight.getInstance().checkFight(seed, maxTime, getFightData, getOptionData, GameFightType.Expediton.getFightType());
|
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) {
|
if (resultCode == -1) {
|
||||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||||
}
|
}
|
||||||
List<Long> remainHp = new ArrayList<>(6);
|
List<Long> remainHp = fight.getRemainHp();
|
||||||
for (int i = 2; i < checkResult.length; i++) {
|
|
||||||
if (checkResult[i] <= 0) {
|
|
||||||
remainHp.add((long) 0);
|
|
||||||
} else {
|
|
||||||
remainHp.add(checkResult[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//如果是第三层更新下圣物状态
|
//如果是第三层更新下圣物状态
|
||||||
if(expeditionManager.getExpeditionLeve()>2){
|
if(expeditionManager.getExpeditionLeve()>2){
|
||||||
ExpeditionLogic.getInstance().thirdFight(user);
|
ExpeditionLogic.getInstance().thirdFight(user);
|
||||||
|
|
|
||||||
|
|
@ -86,10 +86,10 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
|
||||||
int monsterId = STableManager.getConfig(SWorldBossConfig.class).get(GuildFightLogic.carDelayProgressIndication.getBossIndexId()).getMonsterId();
|
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);
|
PVEFightEvent pvpFightEvent = new PVEFightEvent(uid,GlobalsDef.CAR_DELAY_TEAM, battleRound,"", GameFightType.CarBossChallenge,monsterId,3);
|
||||||
FightResult fightResult = FightDispatcher.dispatcher(pvpFightEvent);
|
FightResult fightResult = FightDispatcher.dispatcher(pvpFightEvent);
|
||||||
if(fightResult.getCheckResult()[0]==-1){
|
if(fightResult.getResult()==-1){
|
||||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||||
}
|
}
|
||||||
hurt = (int) fightResult.getCheckResult()[1];
|
hurt = fightResult.getResult();
|
||||||
fightData = fightResult.getFightData();
|
fightData = fightResult.getFightData();
|
||||||
gainScore = (int) (hurt*(sWorldBossSetting.getScorePercent()/10000F));
|
gainScore = (int) (hurt*(sWorldBossSetting.getScorePercent()/10000F));
|
||||||
double myscore = gainScore;
|
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);
|
PVPFightEvent pvpFightEvent = new PVPFightEvent(uid,GlobalsDef.CAR_DELAY_TEAM, battleRound,"", GameFightType.CarPersonChallenge,challeageId,GlobalsDef.CAR_DELAY_TEAM);
|
||||||
FightResult fightResult = FightDispatcher.dispatcher(pvpFightEvent);
|
FightResult fightResult = FightDispatcher.dispatcher(pvpFightEvent);
|
||||||
fightData = fightResult.getFightData();
|
fightData = fightResult.getFightData();
|
||||||
int fight = (int) fightResult.getCheckResult()[0];
|
int fight = fightResult.getResult();
|
||||||
String content = "";
|
String content;
|
||||||
String challengeContent = "";
|
String challengeContent;
|
||||||
PlayerManager playerInfoManager = UserManager.getUser(challeageId).getPlayerInfoManager();
|
PlayerManager playerInfoManager = UserManager.getUser(challeageId).getPlayerInfoManager();
|
||||||
String challengeName = playerInfoManager.getNickName();
|
String challengeName = playerInfoManager.getNickName();
|
||||||
String challengeNameColor = playerInfoManager.getNameColor();
|
String challengeNameColor = playerInfoManager.getNameColor();
|
||||||
|
|
@ -141,7 +141,7 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
|
||||||
challengeContent = SErrorCodeEerverConfig.getI18NMessage("worldboss_grab_lose",
|
challengeContent = SErrorCodeEerverConfig.getI18NMessage("worldboss_grab_lose",
|
||||||
new Object[]{nameColor,user.getPlayerInfoManager().getNickName(),gainScore});
|
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 key = RedisUtil.getInstence().getKey(RedisKey.CAR_CHALLENGE_RECORD, String.valueOf(uid));
|
||||||
String challenegeKey = RedisUtil.getInstence().getKey(RedisKey.CAR_CHALLENGE_RECORD, String.valueOf(challeageId));
|
String challenegeKey = RedisUtil.getInstence().getKey(RedisKey.CAR_CHALLENGE_RECORD, String.valueOf(challeageId));
|
||||||
if(hurt!=0){
|
if(hurt!=0){
|
||||||
|
|
|
||||||
|
|
@ -100,18 +100,13 @@ public class NewGeneralAttackHandler extends BaseHandler<ActivityProto.NewGenera
|
||||||
// 记录战报
|
// 记录战报
|
||||||
FightRecordLogic.getInstance().addRecordMap(user,fightData);
|
FightRecordLogic.getInstance().addRecordMap(user,fightData);
|
||||||
|
|
||||||
// 战斗结果,第二位是伤害
|
double lessBlood;
|
||||||
long[] checkResult = fightResult.getCheckResult();
|
// 赢
|
||||||
|
if (fightResult.getResult() == 1){
|
||||||
double lessBlood = 0.0;
|
|
||||||
// checkResult第一位输赢,1赢,其他输
|
|
||||||
if (checkResult[0] == 1){
|
|
||||||
lessBlood = bossBlood;
|
lessBlood = bossBlood;
|
||||||
}else {
|
}else {
|
||||||
// checkResult第三位开始为血量,下标0开始
|
// 输
|
||||||
for (int i = 2; i < checkResult.length; i++) {
|
lessBlood = fightResult.getRemainHp().stream().mapToLong(Long::longValue).sum();
|
||||||
lessBlood+=checkResult[i];
|
|
||||||
}
|
|
||||||
lessBlood = bossBlood - lessBlood;
|
lessBlood = bossBlood - lessBlood;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ public class TasuilingxiaoHandler extends BaseHandler<ActivityProto.Tasuilingxia
|
||||||
// 战斗结果,{战斗结果,战斗时间,单位1剩余血量......}
|
// 战斗结果,{战斗结果,战斗时间,单位1剩余血量......}
|
||||||
long[] checkResult = fightResult.getCheckResult();
|
long[] checkResult = fightResult.getCheckResult();
|
||||||
//输
|
//输
|
||||||
double lessBlood = 0.0;
|
double lessBlood;
|
||||||
|
|
||||||
if(checkResult[0]==-1){
|
if(checkResult[0]==-1){
|
||||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||||
|
|
@ -101,11 +101,8 @@ public class TasuilingxiaoHandler extends BaseHandler<ActivityProto.Tasuilingxia
|
||||||
lessBlood = bossBlood;
|
lessBlood = bossBlood;
|
||||||
}else {
|
}else {
|
||||||
// 输 checkResult第三位开始为血量,下标0开始
|
// 输 checkResult第三位开始为血量,下标0开始
|
||||||
for (int i = 2; i < checkResult.length; i++) {
|
lessBlood = fightResult.getRemainHp().stream().mapToLong(Long::longValue).sum();
|
||||||
lessBlood+=checkResult[i];
|
|
||||||
}
|
|
||||||
lessBlood = bossBlood - lessBlood;
|
lessBlood = bossBlood - lessBlood;
|
||||||
//return ActivityProto.TasuilingxiaoResponse.newBuilder().setFightData(fightData).setDrop(drop).setDamageVal((int)lessBlood).build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//取出所有奖励状态
|
//取出所有奖励状态
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ public class GetWorldArenaChallengeRequestHandler extends BaseHandler<WorldProto
|
||||||
int teamId = proto.getTeamId();
|
int teamId = proto.getTeamId();
|
||||||
CommonProto.FightTeamInfo fightTeamInfo = FightUtil.makePersonFightData(UserManager.getUser(iSession.getUid()), teamId, null, null);
|
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);
|
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();
|
int seed = fightResult.getSeed();
|
||||||
CommonProto.FightData build = CommonProto.FightData.newBuilder()
|
CommonProto.FightData build = CommonProto.FightData.newBuilder()
|
||||||
.setFightMaxTime(SArenaSetting.getSArenaSetting().getMostTime())
|
.setFightMaxTime(SArenaSetting.getSArenaSetting().getMostTime())
|
||||||
|
|
@ -191,7 +191,7 @@ public class GetWorldArenaChallengeRequestHandler extends BaseHandler<WorldProto
|
||||||
builder1.setFightData(build);
|
builder1.setFightData(build);
|
||||||
WorldProto.WroldBattleRecord.Builder builder = WorldProto.WroldBattleRecord.newBuilder();
|
WorldProto.WroldBattleRecord.Builder builder = WorldProto.WroldBattleRecord.newBuilder();
|
||||||
builder.setFightData(fightResult.getFightData());
|
builder.setFightData(fightResult.getFightData());
|
||||||
builder.setResult((int)fightResult.getCheckResult()[0]);
|
builder.setResult(fightResult.getResult());
|
||||||
String s = KeyGenUtils.produceIdByModule(UUIDEnum.ARENARECORD, iSession.getUid());
|
String s = KeyGenUtils.produceIdByModule(UUIDEnum.ARENARECORD, iSession.getUid());
|
||||||
builder.setRecordId(s);
|
builder.setRecordId(s);
|
||||||
builder.setAttackTime((int)(System.currentTimeMillis()/1000));
|
builder.setAttackTime((int)(System.currentTimeMillis()/1000));
|
||||||
|
|
@ -201,7 +201,7 @@ public class GetWorldArenaChallengeRequestHandler extends BaseHandler<WorldProto
|
||||||
|
|
||||||
int[][] reward = new int[1][];
|
int[][] reward = new int[1][];
|
||||||
//打赢
|
//打赢
|
||||||
if (fightResult.getCheckResult()[0] > 0) {
|
if (fightResult.getResult() > 0) {
|
||||||
// if (proto.getChallengeUid() < 1000) {
|
// if (proto.getChallengeUid() < 1000) {
|
||||||
RedisUtil.getInstence().set(RedisKey.WORLD_ARENA_RANK_MY_MATH, String.valueOf(iSession.getUid()), new HashSet<>());
|
RedisUtil.getInstence().set(RedisKey.WORLD_ARENA_RANK_MY_MATH, String.valueOf(iSession.getUid()), new HashSet<>());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -526,23 +526,22 @@ public class JourneyMap {
|
||||||
// 记录战报
|
// 记录战报
|
||||||
FightRecordLogic.getInstance().addRecordMap(user,fightResult.getFightData());
|
FightRecordLogic.getInstance().addRecordMap(user,fightResult.getFightData());
|
||||||
|
|
||||||
long[] checkResult = fightResult.getCheckResult();
|
|
||||||
MapInfoProto.JourneyFightResponse.Builder response =MapInfoProto.JourneyFightResponse.newBuilder();
|
MapInfoProto.JourneyFightResponse.Builder response =MapInfoProto.JourneyFightResponse.newBuilder();
|
||||||
|
|
||||||
String combat_results = "失败";
|
String combat_results = "失败";
|
||||||
|
if(fightResult.getResult()==1){
|
||||||
if(checkResult[0]==1){
|
|
||||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[]{monster.getReward()}, 1, 0, BIReason.JOURNEY_FIGHT_REWARD);
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[]{monster.getReward()}, 1, 0, BIReason.JOURNEY_FIGHT_REWARD);
|
||||||
response.setDrop(drop);
|
response.setDrop(drop);
|
||||||
pathInfo.removeMonster(bossIndex);
|
pathInfo.removeMonster(bossIndex);
|
||||||
|
|
||||||
// 埋点数据
|
// 埋点数据
|
||||||
combat_results = "成功";
|
combat_results = "成功";
|
||||||
}else if(checkResult[0]==0){
|
}else if(fightResult.getResult()==0){
|
||||||
long allHp = 0;
|
long allHp = 0;
|
||||||
for(int i = 2;i<checkResult.length;i++){
|
int i = 1;
|
||||||
remainHp.put(i-1,checkResult[i]);
|
for (Long hp : fightResult.getRemainHp()) {
|
||||||
allHp+=checkResult[i];
|
remainHp.put(i,hp);
|
||||||
|
allHp+=hp;
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
monster.setRemainHp(remainHp);
|
monster.setRemainHp(remainHp);
|
||||||
CommonProto.JourneyMonsterInfo monsterInfo = CommonProto.JourneyMonsterInfo.newBuilder()
|
CommonProto.JourneyMonsterInfo monsterInfo = CommonProto.JourneyMonsterInfo.newBuilder()
|
||||||
|
|
|
||||||
|
|
@ -1271,167 +1271,160 @@ public class MapLogic {
|
||||||
* @param session
|
* @param session
|
||||||
* @param messageType
|
* @param messageType
|
||||||
*/
|
*/
|
||||||
public void fastFight(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
// public void fastFight(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
int uid = session.getUid();
|
// int uid = session.getUid();
|
||||||
User user = UserManager.getUser(uid);
|
// User user = UserManager.getUser(uid);
|
||||||
MapManager mapManager = user.getMapManager();
|
// MapManager mapManager = user.getMapManager();
|
||||||
if (mapManager.getMapInfo() == null) {
|
// if (mapManager.getMapInfo() == null) {
|
||||||
LOGGER.info("fastFight mapManager.getMapInfo() == null");
|
// LOGGER.info("fastFight mapManager.getMapInfo() == null");
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
// }
|
||||||
if (mapManager.getCanMoveTime() > 0) {
|
// if (mapManager.getCanMoveTime() > 0) {
|
||||||
long leftTime = mapManager.getCanMoveTime() - TimeUtils.now();
|
// long leftTime = mapManager.getCanMoveTime() - TimeUtils.now();
|
||||||
if (leftTime > 0) {
|
// if (leftTime > 0) {
|
||||||
throw new ErrorCodeException(ErrorCode.HERO_LIVE_AGAIN,Collections.singletonList((leftTime / 1000)+""));
|
// throw new ErrorCodeException(ErrorCode.HERO_LIVE_AGAIN,Collections.singletonList((leftTime / 1000)+""));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
Cell cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
|
// Cell cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
|
||||||
if (cell == null) {
|
// if (cell == null) {
|
||||||
cell = mapManager.getMapInfo().get(mapManager.getCurXY());
|
// cell = mapManager.getMapInfo().get(mapManager.getCurXY());
|
||||||
if (cell == null) {
|
// if (cell == null) {
|
||||||
LOGGER.info("cell == null xy is wrong =>{} triggerXY=>{}", mapManager.getCurXY(), mapManager.getTriggerXY());
|
// LOGGER.info("cell == null xy is wrong =>{} triggerXY=>{}", mapManager.getCurXY(), mapManager.getTriggerXY());
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
int bigEventId = cell.getEventId();
|
// int bigEventId = cell.getEventId();
|
||||||
SEventPointConfig sEventPointConfig = STableManager.getConfig(SEventPointConfig.class).get(bigEventId);
|
// SEventPointConfig sEventPointConfig = STableManager.getConfig(SEventPointConfig.class).get(bigEventId);
|
||||||
if (sEventPointConfig == null) {
|
// if (sEventPointConfig == null) {
|
||||||
LOGGER.info("sEventPointConfig == null");
|
// LOGGER.info("sEventPointConfig == null");
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
// }
|
||||||
int[] option = sEventPointConfig.getOption();
|
// int[] option = sEventPointConfig.getOption();
|
||||||
if (option == null) {
|
// if (option == null) {
|
||||||
LOGGER.info("option == null sEventPointConfig.getId()=>{}", sEventPointConfig.getId());
|
// LOGGER.info("option == null sEventPointConfig.getId()=>{}", sEventPointConfig.getId());
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
// }
|
||||||
int groupId = option[0];
|
// int groupId = option[0];
|
||||||
|
//
|
||||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
|
// SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(user.getMapManager().getCurMapId());
|
||||||
int mostTime = sChallengeConfig.getMostTime();
|
// int mostTime = sChallengeConfig.getMostTime();
|
||||||
PVEFightEvent pveFightEvent = new PVEFightEvent(uid, mapManager.getTeamId(), mostTime, "", GameFightType.MapFastFight, groupId, 3);
|
// PVEFightEvent pveFightEvent = new PVEFightEvent(uid, mapManager.getTeamId(), mostTime, "", GameFightType.MapFastFight, groupId, 3);
|
||||||
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
// FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||||
long[] checkResult = fightResult.getCheckResult();
|
// long[] checkResult = fightResult.getCheckResult();
|
||||||
|
//
|
||||||
List<Long> remainHp = new ArrayList<>(5);
|
// List<Long> remainHp = fightResult.getRemainHp();
|
||||||
for (int i = 2; i < checkResult.length; i++) {
|
// //校验结果码 1:胜利
|
||||||
if (checkResult[i] <= 0) {
|
// int resultCode = (int) checkResult[0];
|
||||||
remainHp.add((long) 0);
|
// if (resultCode == -1) {
|
||||||
} else {
|
// throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||||
remainHp.add(checkResult[i]);
|
// }
|
||||||
}
|
// int teamId = mapManager.getTeamId();
|
||||||
}
|
// mapManager.setLastFightResult(resultCode);
|
||||||
//校验结果码 1:胜利
|
// if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==GlobalsDef.ENDLESS_TEAM){
|
||||||
int resultCode = (int) checkResult[0];
|
// mapManager.updateEndlessFightCount(1+mapManager.getEndlessMapInfo().getFightCount());
|
||||||
if (resultCode == -1) {
|
// }
|
||||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
// if (resultCode == 0) {
|
||||||
}
|
// //todo 无尽副本不复活记得改回去
|
||||||
int teamId = mapManager.getTeamId();
|
// if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4) {
|
||||||
mapManager.setLastFightResult(resultCode);
|
//// //无尽副本复活消耗
|
||||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==GlobalsDef.ENDLESS_TEAM){
|
// reviveConsumeExecution(user);
|
||||||
mapManager.updateEndlessFightCount(1+mapManager.getEndlessMapInfo().getFightCount());
|
// for(Map.Entry<String, Map<Integer, Long>> entry: mapManager.getHeroAllAttributeMap().entrySet()){
|
||||||
}
|
// mapManager.updateHeroOneAttribute(entry.getKey(),HeroAttributeEnum.CurHP.getPropertyId(),0);
|
||||||
if (resultCode == 0) {
|
// mapManager.updateEndlessHeroHp(entry.getKey(),0);
|
||||||
//todo 无尽副本不复活记得改回去
|
// }
|
||||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4) {
|
// }else {
|
||||||
// //无尽副本复活消耗
|
// // 失败需要等待n秒后复活所有英雄
|
||||||
reviveConsumeExecution(user);
|
// int dieCount = user.getMapManager().getDieCount();
|
||||||
for(Map.Entry<String, Map<Integer, Long>> entry: mapManager.getHeroAllAttributeMap().entrySet()){
|
// dieCount++;
|
||||||
mapManager.updateHeroOneAttribute(entry.getKey(),HeroAttributeEnum.CurHP.getPropertyId(),0);
|
// user.getMapManager().setDieCount(dieCount);
|
||||||
mapManager.updateEndlessHeroHp(entry.getKey(),0);
|
// int[] reviveTime = sChallengeConfig.getReviveTime();
|
||||||
}
|
// long time = (long) (MathUtils.calABX(dieCount, reviveTime) * 1000);
|
||||||
}else {
|
// user.getMapManager().setCanMoveTime(TimeUtils.now() + time);
|
||||||
// 失败需要等待n秒后复活所有英雄
|
// int leftTime = getLeftTime(user, true);
|
||||||
int dieCount = user.getMapManager().getDieCount();
|
// remainHp.clear();
|
||||||
dieCount++;
|
// if (leftTime <= (int) (time / 1000)) {
|
||||||
user.getMapManager().setDieCount(dieCount);
|
// resetMapInfo(user, false);
|
||||||
int[] reviveTime = sChallengeConfig.getReviveTime();
|
// } else {
|
||||||
long time = (long) (MathUtils.calABX(dieCount, reviveTime) * 1000);
|
// initTeamInfo(mapManager.getTeamId(), uid, user, mapManager, 2);
|
||||||
user.getMapManager().setCanMoveTime(TimeUtils.now() + time);
|
// List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
|
||||||
int leftTime = getLeftTime(user, true);
|
// for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
||||||
remainHp.clear();
|
// Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
||||||
if (leftTime <= (int) (time / 1000)) {
|
// if (hero == null) {
|
||||||
resetMapInfo(user, false);
|
// continue;
|
||||||
} else {
|
// }
|
||||||
initTeamInfo(mapManager.getTeamId(), uid, user, mapManager, 2);
|
// Map<Integer, Long> heroAttributeMap = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, teamId);
|
||||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
|
// remainHp.add(heroAttributeMap.get(HeroAttributeEnum.CurHP.getPropertyId()));
|
||||||
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
// }
|
||||||
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
// }
|
||||||
if (hero == null) {
|
// }
|
||||||
continue;
|
// CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||||
}
|
// FightInfoProto.FastFightResponse build = FightInfoProto.FastFightResponse
|
||||||
Map<Integer, Long> heroAttributeMap = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, teamId);
|
// .newBuilder()
|
||||||
remainHp.add(heroAttributeMap.get(HeroAttributeEnum.CurHP.getPropertyId()));
|
// .setResult(resultCode)
|
||||||
}
|
// .setEnventDrop(dropBuilder)
|
||||||
}
|
//// .addAllRemainHpList(remainHp)
|
||||||
}
|
// .setEssenceValue(mapManager.getTrialInfo().getEnergy())
|
||||||
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
// .setLastXY(mapManager.getLastXY())
|
||||||
FightInfoProto.FastFightResponse build = FightInfoProto.FastFightResponse
|
// .build();
|
||||||
.newBuilder()
|
// mapManager.setCurXY(mapManager.getLastXY());
|
||||||
.setResult(resultCode)
|
// MessageUtil.sendMessage(session, 1, messageType.getNumber(), build, true);
|
||||||
.setEnventDrop(dropBuilder)
|
// return;
|
||||||
// .addAllRemainHpList(remainHp)
|
//
|
||||||
.setEssenceValue(mapManager.getTrialInfo().getEnergy())
|
// }
|
||||||
.setLastXY(mapManager.getLastXY())
|
// List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||||
.build();
|
// if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==GlobalsDef.ENDLESS_TEAM){
|
||||||
mapManager.setCurXY(mapManager.getLastXY());
|
// for (int i = 0 ; i <team.size();i++) {
|
||||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), build, true);
|
// Hero hero = user.getHeroManager().getHero(team.get(i).getHeroId());
|
||||||
return;
|
// 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){
|
||||||
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
// per = 1;
|
||||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==GlobalsDef.ENDLESS_TEAM){
|
// }
|
||||||
for (int i = 0 ; i <team.size();i++) {
|
// mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),per);
|
||||||
Hero hero = user.getHeroManager().getHero(team.get(i).getHeroId());
|
// mapManager.updateHeroOneAttribute(team.get(i).getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), (int) checkResult[i+2]);
|
||||||
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){
|
// }else{
|
||||||
per = 1;
|
// for (TeamPosHeroInfo teamPosHeroInfo : team) {
|
||||||
}
|
// mapManager.updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), (int) checkResult[teamPosHeroInfo.getPosition()+1]);
|
||||||
mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),per);
|
// }
|
||||||
mapManager.updateHeroOneAttribute(team.get(i).getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), (int) checkResult[i+2]);
|
// }
|
||||||
}
|
//
|
||||||
|
// int destoryXY = mapManager.getTriggerXY();
|
||||||
}else{
|
//// if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4) {
|
||||||
for (TeamPosHeroInfo teamPosHeroInfo : team) {
|
//// endlessRefreshMonster(session,destoryXY);
|
||||||
mapManager.updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), (int) checkResult[teamPosHeroInfo.getPosition()+1]);
|
//// }
|
||||||
}
|
// //删点之前进行查找
|
||||||
}
|
// if (sChallengeConfig.getType() == 2) {
|
||||||
|
// STrialConfig sTrialConfig = STrialConfig.sTrialConfigMap.get(mapManager.getTrialInfo().getFloor());
|
||||||
int destoryXY = mapManager.getTriggerXY();
|
// if(cell.getCellId()!=mapManager.getBossXY()){
|
||||||
// if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4) {
|
// if(mapManager.getTrialInfo().getEnergy()!=-1){
|
||||||
// endlessRefreshMonster(session,destoryXY);
|
// 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 (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);
|
FightEvent fightEvent = new FightEvent(uid, -1, sChallengeConfig.getMostTime(),frames,GameFightType.EndSuddlenlyFight);
|
||||||
FightResult fightResult = FightDispatcher.dispatcher(fightEvent);
|
FightResult fightResult = FightDispatcher.dispatcher(fightEvent);
|
||||||
//校验结果码 1:胜利
|
//校验结果码 1:胜利
|
||||||
long[] checkResult = fightResult.getCheckResult();
|
if (fightResult.getResult() == -1) {
|
||||||
//校验结果码 1:胜利
|
|
||||||
int resultCode = (int) checkResult[0];
|
|
||||||
if (resultCode == -1) {
|
|
||||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||||
}
|
}
|
||||||
FightInfoProto.FightEndResponse.Builder builderResponse = FightInfoProto.FightEndResponse
|
FightInfoProto.FightEndResponse.Builder builderResponse = FightInfoProto.FightEndResponse
|
||||||
.newBuilder()
|
.newBuilder()
|
||||||
.setResult(resultCode);
|
.setResult(fightResult.getResult());
|
||||||
if (resultCode == 1) {
|
if (fightResult.getResult() == 1) {
|
||||||
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(mapManager.getSuddenlyBoss());
|
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(mapManager.getSuddenlyBoss());
|
||||||
CommonProto.Drop.Builder dropBuilder = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1.0f, 0, BIReason.SUDDENLY_REWARD);
|
CommonProto.Drop.Builder dropBuilder = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1.0f, 0, BIReason.SUDDENLY_REWARD);
|
||||||
builderResponse.setEnventDrop(dropBuilder);
|
builderResponse.setEnventDrop(dropBuilder);
|
||||||
|
|
@ -2147,10 +2137,9 @@ public class MapLogic {
|
||||||
FightEvent fightEvent = new FightEvent(uid, -1, sMainLevelConfig.getRankTime(),frames, GameFightType.StoryFight);
|
FightEvent fightEvent = new FightEvent(uid, -1, sMainLevelConfig.getRankTime(),frames, GameFightType.StoryFight);
|
||||||
FightResult fightResult = FightDispatcher.dispatcher(fightEvent);
|
FightResult fightResult = FightDispatcher.dispatcher(fightEvent);
|
||||||
//校验结果码 1:胜利
|
//校验结果码 1:胜利
|
||||||
int resultCode = (int) fightResult.getCheckResult()[0];
|
if (fightResult.getResult() == -1) {
|
||||||
if (resultCode == -1) {
|
|
||||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||||
} else if (resultCode == 0) {
|
} else if (fightResult.getResult() == 0) {
|
||||||
user.getPlayerInfoManager().getNewRechargeInfo().addMainLineLost();
|
user.getPlayerInfoManager().getNewRechargeInfo().addMainLineLost();
|
||||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null, true);
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null, true);
|
||||||
return;
|
return;
|
||||||
|
|
@ -2159,7 +2148,7 @@ public class MapLogic {
|
||||||
openNextMainLevel(session,user, fightId);
|
openNextMainLevel(session,user, fightId);
|
||||||
FightInfoProto.FightEndResponse.Builder fightEndResponse = FightInfoProto.FightEndResponse.newBuilder();
|
FightInfoProto.FightEndResponse.Builder fightEndResponse = FightInfoProto.FightEndResponse.newBuilder();
|
||||||
fightEndResponse.setEnventDrop(drop);
|
fightEndResponse.setEnventDrop(drop);
|
||||||
fightEndResponse.setResult(resultCode);
|
fightEndResponse.setResult(fightResult.getResult());
|
||||||
fightEndResponse.build();
|
fightEndResponse.build();
|
||||||
MainLevelManager mainLevelManager = user.getMainLevelManager();
|
MainLevelManager mainLevelManager = user.getMainLevelManager();
|
||||||
FightInfoProto.MainLevelFightUpdateIndication build = FightInfoProto.MainLevelFightUpdateIndication.newBuilder().setState(mainLevelManager.getState()).setFightId(mainLevelManager.getFightId()).build();
|
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);
|
FightEvent fightEvent = new FightEvent(uid, -1, sFloodConfig.getBattleTime(),frames, GameFightType.EndMonsterAttackFight);
|
||||||
FightResult fightResult = FightDispatcher.dispatcher(fightEvent);
|
FightResult fightResult = FightDispatcher.dispatcher(fightEvent);
|
||||||
//校验结果码 1:胜利
|
//校验结果码 1:胜利
|
||||||
long[] checkResult = fightResult.getCheckResult();
|
int resultCode = fightResult.getResult();
|
||||||
//校验结果码 1:胜利
|
|
||||||
int resultCode = (int) checkResult[0];
|
|
||||||
if (resultCode == -1) {
|
if (resultCode == -1) {
|
||||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||||
} else if (resultCode == 0) {
|
} else if (resultCode == 0) {
|
||||||
|
|
@ -3119,13 +3106,12 @@ public class MapLogic {
|
||||||
.setFightType(GameFightType.DailyChallenge.getFightType().getType())
|
.setFightType(GameFightType.DailyChallenge.getFightType().getType())
|
||||||
.setFightId(FightUtil.getFightId(user.getId(),GameFightType.DailyChallenge))
|
.setFightId(FightUtil.getFightId(user.getId(),GameFightType.DailyChallenge))
|
||||||
.build();
|
.build();
|
||||||
long[] checkResult = fightResult.getCheckResult();
|
|
||||||
builder.setFightData(fightData);
|
builder.setFightData(fightData);
|
||||||
|
|
||||||
// 记录战报
|
// 记录战报
|
||||||
FightRecordLogic.getInstance().addRecordMap(user,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);
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sDailyChallengeConfig.getReward(), 1, 0, 1);
|
||||||
builder.setDrop(drop);
|
builder.setDrop(drop);
|
||||||
playerInfoManager.addDailyPass(id);
|
playerInfoManager.addDailyPass(id);
|
||||||
|
|
|
||||||
|
|
@ -303,12 +303,12 @@ public abstract class AbstractMap implements IMap {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void refreshHp(User user,int teamId,int[] checkResult){
|
// public void refreshHp(User user,int teamId,int[] checkResult){
|
||||||
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
// List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||||
for (TeamPosHeroInfo teamPosHeroInfo : team) {
|
// for (TeamPosHeroInfo teamPosHeroInfo : team) {
|
||||||
user.getMapManager().updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[teamPosHeroInfo.getPosition()+1]);
|
// user.getMapManager().updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[teamPosHeroInfo.getPosition()+1]);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
public int monsterGroupChange(int groupId,int level,int mapId){
|
public int monsterGroupChange(int groupId,int level,int mapId){
|
||||||
return groupId;
|
return groupId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -198,18 +198,18 @@ public class EndlessMap extends AbstractMap{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public void refreshHp(User user, int teamId, int[] checkResult) {
|
// public void refreshHp(User user, int teamId, int[] checkResult) {
|
||||||
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
// List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||||
MapManager mapManager = user.getMapManager();
|
// MapManager mapManager = user.getMapManager();
|
||||||
for (int i = 0 ; i <team.size();i++) {
|
// for (int i = 0 ; i <team.size();i++) {
|
||||||
Hero hero = user.getHeroManager().getHero(team.get(i).getHeroId());
|
// Hero hero = user.getHeroManager().getHero(team.get(i).getHeroId());
|
||||||
Map<Integer, Long> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false,teamId);
|
// Map<Integer, Long> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false,teamId);
|
||||||
int per = (int)(checkResult[i+2] / (double) heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId())*10000);
|
// int per = (int)(checkResult[i+2] / (double) heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId())*10000);
|
||||||
mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),per);
|
// mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),per);
|
||||||
mapManager.updateHeroOneAttribute(team.get(i).getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[i+2]);
|
// mapManager.updateHeroOneAttribute(team.get(i).getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[i+2]);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fastFight(int uid, FightInfoProto.FastFightResponse.Builder fastFightResponseBuilder) throws Exception {
|
public void fastFight(int uid, FightInfoProto.FastFightResponse.Builder fastFightResponseBuilder) throws Exception {
|
||||||
|
|
@ -257,13 +257,10 @@ public class EndlessMap extends AbstractMap{
|
||||||
pveFightEvent.setAttackBloodMap(bloodMap);
|
pveFightEvent.setAttackBloodMap(bloodMap);
|
||||||
//怪物剩余血量
|
//怪物剩余血量
|
||||||
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||||
long[] checkResult = fightResult.getCheckResult();
|
LOGGER.info("战斗返回数据{}", Arrays.toString(fightResult.getCheckResult()));
|
||||||
for(int i = 0 ; i <checkResult.length;i++){
|
|
||||||
LOGGER.info("战斗返回数据{}",checkResult[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//校验结果码 1:胜利
|
//校验结果码 1:胜利
|
||||||
int resultCode = (int) checkResult[0];
|
int resultCode = fightResult.getResult();
|
||||||
|
|
||||||
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.ENDLESS_TEAM);
|
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.ENDLESS_TEAM);
|
||||||
if (resultCode == -1) {
|
if (resultCode == -1) {
|
||||||
|
|
@ -273,19 +270,15 @@ public class EndlessMap extends AbstractMap{
|
||||||
for (int i = 0 ; i <team.size();i++) {
|
for (int i = 0 ; i <team.size();i++) {
|
||||||
mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),0);
|
mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),0);
|
||||||
}
|
}
|
||||||
List<Long> monsterHp = new ArrayList<>();
|
List<Long> monsterHp = fightResult.getRemainHp();
|
||||||
for(int i = 2;i<checkResult.length;i++){
|
|
||||||
monsterHp.add(checkResult[i]);
|
|
||||||
}
|
|
||||||
mapManager.updataEndlessMonsterHp(mapManager.getTriggerXY(),monsterHp);
|
mapManager.updataEndlessMonsterHp(mapManager.getTriggerXY(),monsterHp);
|
||||||
}else{
|
}else{
|
||||||
for (TeamPosHeroInfo info:team) {
|
for (int i = 0; i < team.size(); i++) {
|
||||||
int position = info.getPosition();
|
TeamPosHeroInfo info = team.get(0);
|
||||||
Hero hero = user.getHeroManager().getEndlessHeroInfo().get(info.getHeroId());
|
Hero hero = user.getHeroManager().getEndlessHeroInfo().get(info.getHeroId());
|
||||||
Map<Integer, Long> heroAttributeMap = SEndlessHeroProp.propsMap.get(hero.getTemplateId());
|
Map<Integer, Long> heroAttributeMap = SEndlessHeroProp.propsMap.get(hero.getTemplateId());
|
||||||
|
int per = (int)(fightResult.getRemainHp().get(i) * 10000d / heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId()));
|
||||||
int per = (int)(checkResult[position+1] *10000d / heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId()));
|
if(fightResult.getRemainHp().get(i)>0&&per<=0){
|
||||||
if(checkResult[position+1]>0&&per<=0){
|
|
||||||
per = 1;
|
per = 1;
|
||||||
}
|
}
|
||||||
LOGGER.info("生命剩余百分比,{}",per);
|
LOGGER.info("生命剩余百分比,{}",per);
|
||||||
|
|
@ -557,19 +550,20 @@ public class EndlessMap extends AbstractMap{
|
||||||
* @param responseBuilder
|
* @param responseBuilder
|
||||||
* @throws Exception
|
* @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);
|
User user = UserManager.getUser(uid);
|
||||||
MapManager mapManager = user.getMapManager();
|
MapManager mapManager = user.getMapManager();
|
||||||
if (mapManager.getMapInfo() == null) {
|
if (mapManager.getMapInfo() == null) {
|
||||||
LOGGER.info("mapManager.getMapInfo() == null");
|
LOGGER.info("mapManager.getMapInfo() == null");
|
||||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
}
|
||||||
if (mapManager.getCanMoveTime() > 0) {
|
// if (mapManager.getCanMoveTime() > 0) {
|
||||||
long leftTime = mapManager.getCanMoveTime() - TimeUtils.now();
|
// long leftTime = mapManager.getCanMoveTime() - TimeUtils.now();
|
||||||
if (leftTime > 0) {
|
// if (leftTime > 0) {
|
||||||
// throw new ErrorCodeException(ErrorCode.HERO_LIVE_AGAIN,Collections.singletonList((leftTime / 1000)+""));
|
//// throw new ErrorCodeException(ErrorCode.HERO_LIVE_AGAIN,Collections.singletonList((leftTime / 1000)+""));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
Cell cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
|
Cell cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
|
||||||
if (cell == null) {
|
if (cell == null) {
|
||||||
cell = mapManager.getMapInfo().get(mapManager.getCurXY());
|
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 optionId = Integer.parseInt((String) valueMap.get(RedisKey.NEED_VICTORY_AFTER));
|
||||||
int nextEventId = 0;
|
int nextEventId = 0;
|
||||||
SOptionConfig sOptionConfig = SOptionConfig.sOptionConfigMap.get(optionId);
|
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);
|
List<Long> remainHp = new ArrayList<>(6);
|
||||||
int seed = Integer.parseInt((String) valueMap.get(RedisKey.FIGHT_SEED));
|
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();
|
CommonProto.FightTeamInfo.Builder fightTeamBuilder = CommonProto.FightTeamInfo.newBuilder();
|
||||||
JsonFormat.merge((String) valueMap.get(RedisKey.FIGHT_HEROES), fightTeamBuilder);
|
JsonFormat.merge((String) valueMap.get(RedisKey.FIGHT_HEROES), fightTeamBuilder);
|
||||||
CommonProto.FightTeamInfo fightTeamInfo = fightTeamBuilder.build();
|
CommonProto.FightTeamInfo fightTeamInfo = fightTeamBuilder.build();
|
||||||
|
|
@ -657,8 +646,10 @@ public class EndlessMap extends AbstractMap{
|
||||||
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterTeamList);
|
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterTeamList);
|
||||||
LuaValue getOptionData = FightDataUtil.getOptionData(frames);
|
LuaValue getOptionData = FightDataUtil.getOptionData(frames);
|
||||||
int mostTime = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getMostTime();
|
int mostTime = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getMostTime();
|
||||||
checkResult = CheckFight.getInstance().checkFight(seed, mostTime, getFightData, getOptionData, FightType.MapExploreFight);
|
long[] checkResult = CheckFight.getInstance().checkFight(seed, mostTime, getFightData, getOptionData, FightType.MapExploreFight);
|
||||||
resultCode = (int) checkResult[0];
|
FightResult fight = FightResult.newBuilder().setCheckResult(checkResult).build();
|
||||||
|
int resultCode = fight.getResult();
|
||||||
|
//校验结果码 1:胜利
|
||||||
if (resultCode == -1) {
|
if (resultCode == -1) {
|
||||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||||
}
|
}
|
||||||
|
|
@ -697,10 +688,7 @@ public class EndlessMap extends AbstractMap{
|
||||||
mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),0);
|
mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<Long> monsterHp = new ArrayList<>();
|
List<Long> monsterHp = fight.getRemainHp();
|
||||||
for(int i = 2;i<checkResult.length;i++){
|
|
||||||
monsterHp.add(checkResult[i]);
|
|
||||||
}
|
|
||||||
mapManager.updataEndlessMonsterHp(mapManager.getTriggerXY(),monsterHp);
|
mapManager.updataEndlessMonsterHp(mapManager.getTriggerXY(),monsterHp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -708,26 +696,17 @@ public class EndlessMap extends AbstractMap{
|
||||||
//无尽本更新血量
|
//无尽本更新血量
|
||||||
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.ENDLESS_TEAM);
|
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.ENDLESS_TEAM);
|
||||||
for (int i = 0 ; i <team.size();i++) {
|
for (int i = 0 ; i <team.size();i++) {
|
||||||
int position = team.get(i).getPosition();
|
|
||||||
Hero hero = user.getHeroManager().getEndlessHeroInfo().get(team.get(i).getHeroId());
|
Hero hero = user.getHeroManager().getEndlessHeroInfo().get(team.get(i).getHeroId());
|
||||||
|
|
||||||
Map<Integer, Long> heroAttributeMap = SEndlessHeroProp.propsMap.get(hero.getTemplateId());
|
Map<Integer, Long> heroAttributeMap = SEndlessHeroProp.propsMap.get(hero.getTemplateId());
|
||||||
|
|
||||||
int per = (int)(checkResult[position+1] / (double) heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId())*10000);
|
int per = (int)(fight.getRemainHp().get(i) / (double) heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId())*10000);
|
||||||
if(checkResult[i+1]>0&&per<=0){
|
if(fight.getRemainHp().get(i)>0&&per<=0){
|
||||||
per = 1;
|
per = 1;
|
||||||
}
|
}
|
||||||
mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),per);
|
mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),per);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remainHp = fight.getRemainHp();
|
||||||
for (int i = 2; i < checkResult.length; i++) {
|
|
||||||
if (checkResult[i] <= 0) {
|
|
||||||
remainHp.add((long) 0);
|
|
||||||
} else {
|
|
||||||
remainHp.add(checkResult[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mapManager.removeEndlessOneMonsterHp(mapManager.getCurXY());
|
mapManager.removeEndlessOneMonsterHp(mapManager.getCurXY());
|
||||||
//血量更新
|
//血量更新
|
||||||
// refreshHp(user, mapManager.getTeamId(),checkResult);
|
// refreshHp(user, mapManager.getTeamId(),checkResult);
|
||||||
|
|
@ -767,7 +746,7 @@ public class EndlessMap extends AbstractMap{
|
||||||
|
|
||||||
}
|
}
|
||||||
builder.setEventId(nextEventId);
|
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()) {
|
if (monsterGroupId == mapManager.getSuddenlyBoss()) {
|
||||||
mapManager.findSuddenlyBoss(0, 0);
|
mapManager.findSuddenlyBoss(0, 0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -195,6 +195,7 @@ public class TowerMap extends AbstractMap {
|
||||||
mapManager.setTrialEnergy(mapManager.getTrialInfo().getEnergy() + sTrialConfig.getNormalEnergy());
|
mapManager.setTrialEnergy(mapManager.getTrialInfo().getEnergy() + sTrialConfig.getNormalEnergy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void initMap(MapManager mapManager, User user) throws Exception {
|
public void initMap(MapManager mapManager, User user) throws Exception {
|
||||||
Map<Integer, Cell> trialMapInfo = mapManager.getTrialInfo().getMapInfo();
|
Map<Integer, Cell> trialMapInfo = mapManager.getTrialInfo().getMapInfo();
|
||||||
if(trialMapInfo !=null&&!trialMapInfo.isEmpty()){
|
if(trialMapInfo !=null&&!trialMapInfo.isEmpty()){
|
||||||
|
|
@ -425,19 +426,17 @@ public class TowerMap extends AbstractMap {
|
||||||
pveFightEvent.setMonsterRemainHp(monsterHp.get(cell.getCellId()));
|
pveFightEvent.setMonsterRemainHp(monsterHp.get(cell.getCellId()));
|
||||||
}
|
}
|
||||||
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||||
long[] checkResult = fightResult.getCheckResult();
|
|
||||||
|
|
||||||
|
|
||||||
//校验结果码 1:胜利
|
//校验结果码 1:胜利
|
||||||
int resultCode = (int) checkResult[0];
|
int resultCode = fightResult.getResult();
|
||||||
if (resultCode == -1) {
|
if (resultCode == -1) {
|
||||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||||
}
|
}
|
||||||
mapManager.setLastFightResult(resultCode);
|
mapManager.setLastFightResult(resultCode);
|
||||||
|
|
||||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.TRIAL_TEAM);
|
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.TRIAL_TEAM);
|
||||||
if(teamPosHeroInfos==null||teamPosHeroInfos.size()!=1){
|
if(teamPosHeroInfos==null||teamPosHeroInfos.size()<=0){
|
||||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
TrailHero trailHero = trialInfo.getHeroInfo().get(teamPosHeroInfos.get(0).getHeroId());
|
TrailHero trailHero = trialInfo.getHeroInfo().get(teamPosHeroInfos.get(0).getHeroId());
|
||||||
|
|
@ -448,10 +447,7 @@ public class TowerMap extends AbstractMap {
|
||||||
Cell createCell = null;
|
Cell createCell = null;
|
||||||
if (resultCode == 0) {
|
if (resultCode == 0) {
|
||||||
//记录怪剩余血量
|
//记录怪剩余血量
|
||||||
List<Long> hpList= new ArrayList<>();
|
List<Long> hpList = fightResult.getRemainHp();
|
||||||
for(int i = 2;i<checkResult.length;i++){
|
|
||||||
hpList.add(checkResult[i]);
|
|
||||||
}
|
|
||||||
if(monsterHp!=null){
|
if(monsterHp!=null){
|
||||||
monsterHp.put(cell.getCellId(),hpList);
|
monsterHp.put(cell.getCellId(),hpList);
|
||||||
}
|
}
|
||||||
|
|
@ -469,7 +465,7 @@ public class TowerMap extends AbstractMap {
|
||||||
//如果大于100则生成boss点
|
//如果大于100则生成boss点
|
||||||
createCell=callChief(user);
|
createCell=callChief(user);
|
||||||
}
|
}
|
||||||
remainHp = checkResult[3];
|
remainHp = fightResult.getRemainHp().get(1);
|
||||||
BehaviorUtil.destoryApointXY(user, destoryXY);
|
BehaviorUtil.destoryApointXY(user, destoryXY);
|
||||||
mapManager.updateTrialKillCount(trialInfo.getKillCount()+1);
|
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);
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 0, BIReason.MAP_FAST_FIGHT_REWARD);
|
||||||
fastFightResponseBuilder.setEnventDrop(drop.build());
|
fastFightResponseBuilder.setEnventDrop(drop.build());
|
||||||
}else{
|
}else{
|
||||||
List<Long> hpList= new ArrayList<>();
|
List<Long> hpList= fightResult.getRemainHp();
|
||||||
for(int i = 2;i<checkResult.length;i++){
|
|
||||||
if(i==3){
|
|
||||||
hpList.add(checkResult[i]);
|
|
||||||
}else{
|
|
||||||
hpList.add((long) 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(monsterHp!=null){
|
if(monsterHp!=null){
|
||||||
monsterHp.put(cell.getCellId(),hpList);
|
monsterHp.put(cell.getCellId(),hpList);
|
||||||
}
|
}
|
||||||
mapManager.updateMapMonsterHp(monsterHp);
|
mapManager.updateMapMonsterHp(monsterHp);
|
||||||
remainHp = checkResult[2];
|
remainHp = fightResult.getRemainHp().get(0);
|
||||||
resultCode = 0;
|
resultCode = 0;
|
||||||
}
|
}
|
||||||
//生成传送门,需要在删点之后
|
//生成传送门,需要在删点之后
|
||||||
|
|
@ -519,7 +508,7 @@ public class TowerMap extends AbstractMap {
|
||||||
// 记录战报
|
// 记录战报
|
||||||
FightRecordLogic.getInstance().addRecordMap(user,fightResult.getFightData());
|
FightRecordLogic.getInstance().addRecordMap(user,fightResult.getFightData());
|
||||||
// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
|
// 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?"胜利":"失败");
|
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());
|
// LOGGER.info("endFight() uid=>{} sMonsterGroup.getRewardgroup()=>{} misson=>{} eventDrop=>{}, missionDrop=>{}", uid, sMonsterGroup.getRewardgroup(), fastFightResponse.getMission(), fastFightResponse.getEnventDrop(), fastFightResponse.getMissionDrop());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,10 +73,9 @@ public class QuickStartMonsterFighter extends BaseHandler<FightInfoProto.QuickSt
|
||||||
int mostTime = sFloodConfig.getBattleTime();
|
int mostTime = sFloodConfig.getBattleTime();
|
||||||
PVEFightEvent pveFightEvent = new PVEFightEvent(uid,teamId, mostTime, "", GameFightType.MonterFight, groupId, 3);
|
PVEFightEvent pveFightEvent = new PVEFightEvent(uid,teamId, mostTime, "", GameFightType.MonterFight, groupId, 3);
|
||||||
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||||
long[] checkResult = fightResult.getCheckResult();
|
|
||||||
|
|
||||||
//校验结果码 1:胜利
|
//校验结果码 1:胜利
|
||||||
int resultCode = (int) checkResult[0];
|
int resultCode = fightResult.getResult();
|
||||||
if (resultCode == -1) {
|
if (resultCode == -1) {
|
||||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,9 +77,6 @@ public class Cmd_review_gm extends GmAbstract {
|
||||||
|
|
||||||
if (defMemberInfo.getType() == 0) {
|
if (defMemberInfo.getType() == 0) {
|
||||||
FamilyFightInfo fightInfo = defMemberInfo.getFightInfo();
|
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));
|
pvpFightEvent.setDefFightSnapData(new DefFightSnapData(fightInfo.getHeroAttribute(), fightInfo.getHeroSkills(), fightInfo.getPokenmonSkills(), fightInfo.getPassiveSkills(), defUid));
|
||||||
defForce = fightInfo.getForce();
|
defForce = fightInfo.getForce();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -90,9 +87,6 @@ public class Cmd_review_gm extends GmAbstract {
|
||||||
}
|
}
|
||||||
if (attackMemberInfo.getType() == 0) {
|
if (attackMemberInfo.getType() == 0) {
|
||||||
FamilyFightInfo fightInfo = attackMemberInfo.getFightInfo();
|
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));
|
pvpFightEvent.setAttackFightSnapData(new DefFightSnapData(fightInfo.getHeroAttribute(), fightInfo.getHeroSkills(), fightInfo.getPokenmonSkills(), fightInfo.getPassiveSkills(), attackId));
|
||||||
minForce = fightInfo.getForce();
|
minForce = fightInfo.getForce();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -112,7 +106,7 @@ public class Cmd_review_gm extends GmAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonProto.FightTeamInfo fightTeamInfo = null;
|
CommonProto.FightTeamInfo fightTeamInfo = null;
|
||||||
CommonProto.FightTeamInfo deffightTeamInfo = null;
|
CommonProto.FightTeamInfo deffightTeamInfo;
|
||||||
if(pvpFightEvent.getAttackFightSnapData()!=null){
|
if(pvpFightEvent.getAttackFightSnapData()!=null){
|
||||||
fightTeamInfo = FightUtil.makeFightWithSnapData(pvpFightEvent.getAttackFightSnapData());
|
fightTeamInfo = FightUtil.makeFightWithSnapData(pvpFightEvent.getAttackFightSnapData());
|
||||||
}
|
}
|
||||||
|
|
@ -124,16 +118,10 @@ public class Cmd_review_gm extends GmAbstract {
|
||||||
deffightTeamInfo = FightUtil.makePersonFightData(defInMem, pvpFightEvent.getDefTeamId(),null,null);
|
deffightTeamInfo = FightUtil.makePersonFightData(defInMem, pvpFightEvent.getDefTeamId(),null,null);
|
||||||
}else{
|
}else{
|
||||||
deffightTeamInfo = FightUtil. makeRobotFightData(pvpFightEvent.getDefUid());
|
deffightTeamInfo = FightUtil. makeRobotFightData(pvpFightEvent.getDefUid());
|
||||||
// deffightTeamInfo = FightUtil. makeRobotFightData(pvpFightEvent.getDefUid());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if(fightTeamInfo==null){
|
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( pvpFightEvent.getFightType()!=GameFightType.TOPArena2RobotFight){
|
||||||
if( SArenaRobotConfig.getsArenaRobotConfigById(pvpFightEvent.getAttackUid()) !=null){
|
if( SArenaRobotConfig.getsArenaRobotConfigById(pvpFightEvent.getAttackUid()) !=null){
|
||||||
fightTeamInfo =FightUtil. makeRobotFightData(pvpFightEvent.getAttackUid());
|
fightTeamInfo =FightUtil. makeRobotFightData(pvpFightEvent.getAttackUid());
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,6 @@ public class SituationLogic {
|
||||||
}
|
}
|
||||||
//组装战斗数据
|
//组装战斗数据
|
||||||
PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), formation, 20, "", GameFightType.DailyChallenge, sRaceTowerConfig.getMonsterId(), 3);
|
PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), formation, 20, "", GameFightType.DailyChallenge, sRaceTowerConfig.getMonsterId(), 3);
|
||||||
// FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
|
||||||
FightResult fightResult = getFightForSituation(pveFightEvent, buffMap);
|
FightResult fightResult = getFightForSituation(pveFightEvent, buffMap);
|
||||||
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
|
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
|
||||||
.setFightMaxTime(20)
|
.setFightMaxTime(20)
|
||||||
|
|
@ -258,14 +257,13 @@ public class SituationLogic {
|
||||||
.setFightType(GameFightType.DailyChallenge.getFightType().getType())
|
.setFightType(GameFightType.DailyChallenge.getFightType().getType())
|
||||||
.setFightId(FightUtil.getFightId(user.getId(),GameFightType.DailyChallenge))
|
.setFightId(FightUtil.getFightId(user.getId(),GameFightType.DailyChallenge))
|
||||||
.build();
|
.build();
|
||||||
long[] checkResult = fightResult.getCheckResult();
|
|
||||||
builder.setFightData(fightData);
|
builder.setFightData(fightData);
|
||||||
|
|
||||||
// 记录战报
|
// 记录战报
|
||||||
FightRecordLogic.getInstance().addRecordMap(user,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);
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sRaceTowerConfig.getFirstReward(), 1, 0, BIReason.SITUATION_CHALLENGE_REWARD);
|
||||||
builder.setDrop(drop);
|
builder.setDrop(drop);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,7 @@ public class ArenaLogic {
|
||||||
//数据互换
|
//数据互换
|
||||||
byte[] snapRecord = build.toByteArray();
|
byte[] snapRecord = build.toByteArray();
|
||||||
arenaRecord.setFightData(snapRecord);
|
arenaRecord.setFightData(snapRecord);
|
||||||
return (int) fightResult.getCheckResult()[0];
|
return fightResult.getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -291,7 +291,7 @@ public class ArenaLogic {
|
||||||
.setHeroFightInfos(fightTeamInfo)
|
.setHeroFightInfos(fightTeamInfo)
|
||||||
.addMonsterList(deffightTeamInfo)
|
.addMonsterList(deffightTeamInfo)
|
||||||
.build());
|
.build());
|
||||||
return (int) fightResult.getCheckResult()[0];
|
return fightResult.getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String checkChallenge(User user,int skipFight, ArenaEnemy enemyInfo) throws Exception {
|
public String checkChallenge(User user,int skipFight, ArenaEnemy enemyInfo) throws Exception {
|
||||||
|
|
|
||||||
|
|
@ -361,7 +361,7 @@ public class DeathPathLogic {
|
||||||
SGuildWarConfig config = STableManager.getConfig(SGuildWarConfig.class).get(pathId);
|
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);
|
PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), GlobalsDef.DEATH_PATH_TEAM, SGuildSetting.sGuildSetting.getWarTime(), "", GameFightType.DeathPathChallenge, config.getMonsterId(), 3);
|
||||||
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||||
long damage = fightResult.getCheckResult()[1];
|
long damage = fightResult.getDuration();
|
||||||
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
|
CommonProto.FightData fightData = CommonProto.FightData.newBuilder()
|
||||||
.setFightMaxTime(SGuildSetting.sGuildSetting.getWarTime())
|
.setFightMaxTime(SGuildSetting.sGuildSetting.getWarTime())
|
||||||
.setFightSeed(fightResult.getSeed())
|
.setFightSeed(fightResult.getSeed())
|
||||||
|
|
@ -508,8 +508,8 @@ public class DeathPathLogic {
|
||||||
for (ZSetOperations.TypedTuple<String> n : allGuild) {
|
for (ZSetOperations.TypedTuple<String> n : allGuild) {
|
||||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(Integer.parseInt(n.getValue()));
|
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(Integer.parseInt(n.getValue()));
|
||||||
if(guildInfo!=null){
|
if(guildInfo!=null){
|
||||||
GuildCache crossGuild = CrossServiceLogic.getCrossGuild(guildInfo.getId());
|
GuildCache crossGuild = CrossDeathPathLogic.getCrossGuild(guildInfo.getId());
|
||||||
String name = CrossServiceLogic.simplifyServerName(crossGuild.getServerId());
|
String name = CrossDeathPathLogic.getInstance().getServerNameByDeathPath(crossGuild.getServerId());
|
||||||
String serverName = getGroupId()>0?name:"";
|
String serverName = getGroupId()>0?name:"";
|
||||||
Family.DeathPathInfo info = Family.DeathPathInfo.newBuilder()
|
Family.DeathPathInfo info = Family.DeathPathInfo.newBuilder()
|
||||||
.setGuildName(guildInfo.getName()).setGid(currFirstGuildId)
|
.setGuildName(guildInfo.getName()).setGid(currFirstGuildId)
|
||||||
|
|
|
||||||
|
|
@ -196,19 +196,18 @@ public class GuildChallengeLogic {
|
||||||
List<Long> hp = new ArrayList<>();
|
List<Long> hp = new ArrayList<>();
|
||||||
for(int i = 0 ; i <6;i++){
|
for(int i = 0 ; i <6;i++){
|
||||||
if(i==1){
|
if(i==1){
|
||||||
hp.add((long) guildInfo.getBossHpRemain());
|
hp.add(guildInfo.getBossHpRemain());
|
||||||
}else{
|
}else{
|
||||||
hp.add((long) 0);
|
hp.add(0L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pveFightEvent.setMonsterRemainHp(hp);
|
pveFightEvent.setMonsterRemainHp(hp);
|
||||||
}
|
}
|
||||||
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||||
fightData = fightResult.getFightData();
|
fightData = fightResult.getFightData();
|
||||||
long[] checkResult = fightResult.getCheckResult();
|
int damageInt = fightResult.getDuration();
|
||||||
int damageInt = (int) checkResult[1];
|
|
||||||
|
|
||||||
if(checkResult[0]==1) {
|
if(fightResult.getResult()==1) {
|
||||||
if(guildInfo.getBossHpRemain()!=-1){
|
if(guildInfo.getBossHpRemain()!=-1){
|
||||||
kill = 1;
|
kill = 1;
|
||||||
//重置boss血量
|
//重置boss血量
|
||||||
|
|
@ -228,10 +227,10 @@ public class GuildChallengeLogic {
|
||||||
guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp());
|
guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if(checkResult[0]==0){
|
}else if(fightResult.getResult()==0){
|
||||||
//怪物保持在第四位
|
//怪物保持在第四位
|
||||||
if(guildInfo.getBossHpRemain()!=-1){
|
if(guildInfo.getBossHpRemain()!=-1){
|
||||||
guildInfo.setBossHpRemain(checkResult[3]);
|
guildInfo.setBossHpRemain(fightResult.getRemainHp().get(1));
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
error = "战斗异常!";
|
error = "战斗异常!";
|
||||||
|
|
|
||||||
|
|
@ -451,33 +451,25 @@ public class GuildFightLogic {
|
||||||
pvpFightEvent.setAttackBloodMap(attackBloodMap);
|
pvpFightEvent.setAttackBloodMap(attackBloodMap);
|
||||||
pvpFightEvent.setDefFightSnapData(new DefFightSnapData(defendInfo.getHeroAttribute(),defendInfo.getHeroSkills(),defendInfo.getPokenmonSkills(),defendInfo.getPassiveSkills()));
|
pvpFightEvent.setDefFightSnapData(new DefFightSnapData(defendInfo.getHeroAttribute(),defendInfo.getHeroSkills(),defendInfo.getPokenmonSkills(),defendInfo.getPassiveSkills()));
|
||||||
FightResult dispatcher = FightDispatcher.dispatcher(pvpFightEvent);
|
FightResult dispatcher = FightDispatcher.dispatcher(pvpFightEvent);
|
||||||
long[] fightResult = dispatcher.getCheckResult();
|
|
||||||
|
|
||||||
int aliveCount = 0;
|
int aliveCount = 0;
|
||||||
|
//战斗之后数据处理
|
||||||
// 战斗之后数据处理
|
if(dispatcher.getResult()==0) {
|
||||||
if(fightResult[0]==0) {
|
aliveCount = (int) dispatcher.getRemainHp().stream().filter(v->v>0).count();
|
||||||
for(int i = 2 ; i <fightResult.length;i++){
|
|
||||||
if(fightResult[i]>0){
|
|
||||||
aliveCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
aliveCount=0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
defendInfo.setHeroAttribute(BloodLogic.getInstance().afterBattleRecord(heroAttribute,fightResult));
|
defendInfo.setHeroAttribute(BloodLogic.getInstance().afterBattleRecord(heroAttribute,dispatcher.getCheckResult()));
|
||||||
//获得星数
|
//获得星数
|
||||||
int getStar;
|
int getStar;
|
||||||
List<TeamPosHeroInfo> teamAttack = userAttack.getTeamPosManager().getTeamPosForHero().get(502);
|
List<TeamPosHeroInfo> teamAttack = userAttack.getTeamPosManager().getTeamPosForHero().get(502);
|
||||||
if (fightResult[0] == 1) {
|
if (dispatcher.getResult() == 1) {
|
||||||
getStar = defendInfo.getStarCount();
|
getStar = defendInfo.getStarCount();
|
||||||
defendInfo.setStarCount(0);
|
defendInfo.setStarCount(0);
|
||||||
int indexAttack =2;
|
int indexAttack = 0;
|
||||||
for(TeamPosHeroInfo attack:teamAttack){
|
for(TeamPosHeroInfo attack:teamAttack){
|
||||||
Hero hero = userAttack.getHeroManager().getHeroMap().get(attack.getHeroId());
|
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);
|
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);
|
redisUtil.putMapEntry(RedisKey.FAMILY_ATTACK_BLOOD,String.valueOf(userAttack.getId()),attack.getHeroId(),bloodLess);
|
||||||
indexAttack++;
|
indexAttack++;
|
||||||
}
|
}
|
||||||
|
|
@ -526,7 +518,7 @@ public class GuildFightLogic {
|
||||||
// 记录战报
|
// 记录战报
|
||||||
FightRecordLogic.getInstance().addRecordMap(userAttack,fightData);
|
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);
|
userAttack.getUserMissionManager().onGameEvent(userAttack, GameEvent.FAMILY_FIGHT_ATTACK);
|
||||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), response, true);
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), response, true);
|
||||||
}
|
}
|
||||||
|
|
@ -1095,7 +1087,7 @@ public class GuildFightLogic {
|
||||||
FightResult fightResult = FightDispatcher.dispatcher(fightEvent);
|
FightResult fightResult = FightDispatcher.dispatcher(fightEvent);
|
||||||
PlayerLogic.getInstance().checkAndUpdate(user, VipPrivilegeType.GUILD_BOSS_CHALLENGE_TIMES, 1);
|
PlayerLogic.getInstance().checkAndUpdate(user, VipPrivilegeType.GUILD_BOSS_CHALLENGE_TIMES, 1);
|
||||||
//校验结果码 1:胜利
|
//校验结果码 1:胜利
|
||||||
int myHurt = (int) fightResult.getCheckResult()[1];
|
int myHurt = fightResult.getDuration();
|
||||||
if(myHurt>user.getGuildMyInfo().getMaxBossHurt()){
|
if(myHurt>user.getGuildMyInfo().getMaxBossHurt()){
|
||||||
user.getGuildMyInfo().setMaxBossHurt(myHurt);
|
user.getGuildMyInfo().setMaxBossHurt(myHurt);
|
||||||
}
|
}
|
||||||
|
|
@ -1233,7 +1225,7 @@ public class GuildFightLogic {
|
||||||
private static int carProgress=-2 ;
|
private static int carProgress=-2 ;
|
||||||
public static Family.CarDelayProgressIndication carDelayProgressIndication;
|
public static Family.CarDelayProgressIndication carDelayProgressIndication;
|
||||||
|
|
||||||
public static void minuteCheckForCarFight() throws Exception {
|
public static void minuteCheckForCarFight(){
|
||||||
LOGGER.info("minuteCheckForCarFight 车迟斗法progress={}",carProgress);
|
LOGGER.info("minuteCheckForCarFight 车迟斗法progress={}",carProgress);
|
||||||
int carProgressTmp =carProgress;
|
int carProgressTmp =carProgress;
|
||||||
int id =1;
|
int id =1;
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,12 @@ public class AreFightPro implements EndFightProcessor {
|
||||||
ArenaRecord arenaRecord;
|
ArenaRecord arenaRecord;
|
||||||
@Override
|
@Override
|
||||||
public void endfightProcess(FightResult fightResult) {
|
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){
|
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;
|
boolean jump=false;
|
||||||
Integer state = RedisUtil.getInstence().getMapValue(RedisKey.CHAMPION_ARENA_RECORD_THREE, "", key, Integer.class);
|
Integer state = RedisUtil.getInstence().getMapValue(RedisKey.CHAMPION_ARENA_RECORD_THREE, "", key, Integer.class);
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import com.ljsd.jieling.logic.activity.fourChallenge.FourChallengeLogic;
|
||||||
import com.ljsd.jieling.logic.dao.*;
|
import com.ljsd.jieling.logic.dao.*;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.fight.passiveSkillCal.PassiveskillCalEnum;
|
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.HelpHero;
|
||||||
import com.ljsd.jieling.logic.help.HelpHeroLogic;
|
import com.ljsd.jieling.logic.help.HelpHeroLogic;
|
||||||
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
||||||
|
|
@ -550,8 +551,9 @@ public class CombatLogic {
|
||||||
.build();
|
.build();
|
||||||
builder.setFightData(build);
|
builder.setFightData(build);
|
||||||
long[] checkResult = CheckFight.getInstance().checkFight(seed, sMainLevelConfig.getInvasionBossTime(), getFightData, getOptionData, FightType.InvasionBossFight);
|
long[] checkResult = CheckFight.getInstance().checkFight(seed, sMainLevelConfig.getInvasionBossTime(), getFightData, getOptionData, FightType.InvasionBossFight);
|
||||||
totalHurt+= updateBossAndGetHurtForFight(checkResult, adventureBoss);
|
FightResult fight = FightResult.newBuilder().setCheckResult(checkResult).build();
|
||||||
fightResult = (int) checkResult[0];
|
totalHurt += updateBossAndGetHurtForFight(fight, adventureBoss);
|
||||||
|
fightResult = fight.getResult();
|
||||||
//发送击杀boss奖励和发现者奖励
|
//发送击杀boss奖励和发现者奖励
|
||||||
if(fightResult == 1){
|
if(fightResult == 1){
|
||||||
i = i+1;
|
i = i+1;
|
||||||
|
|
@ -644,20 +646,19 @@ public class CombatLogic {
|
||||||
return killRewardMail;
|
return killRewardMail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int updateBossAndGetHurtForFight(long[] checkResult,AdventureBoss adventureBoss){
|
public int updateBossAndGetHurtForFight(FightResult fight,AdventureBoss adventureBoss){
|
||||||
int hurt = 0;
|
int hurt = 0;
|
||||||
List<Long> oldRemainHp = adventureBoss.getRemainHps();
|
List<Long> oldRemainHp = adventureBoss.getRemainHps();
|
||||||
int fightResult = (int) checkResult[0];
|
int fightResult = fight.getResult();
|
||||||
if(fightResult == 1){
|
if(fightResult == 1){
|
||||||
for(Long hp : oldRemainHp){
|
for(Long hp : oldRemainHp){
|
||||||
hurt+=hp;
|
hurt+=hp;
|
||||||
}
|
}
|
||||||
return hurt;
|
return hurt;
|
||||||
}
|
}
|
||||||
List<Long> result =new ArrayList<>(5);
|
List<Long> result = fight.getRemainHp();
|
||||||
for(int i=2;i<=oldRemainHp.size()+1;i++){
|
for (int i = 0; i < oldRemainHp.size(); i++) {
|
||||||
result.add(checkResult[i]);
|
hurt += (oldRemainHp.get(i) - result.get(i));
|
||||||
hurt+=(oldRemainHp.get(i-2)-checkResult[i]);
|
|
||||||
}
|
}
|
||||||
adventureBoss.setRemainHp(adventureBoss.getRemainHp() - hurt);
|
adventureBoss.setRemainHp(adventureBoss.getRemainHp() - hurt);
|
||||||
adventureBoss.setRemainHps(result);
|
adventureBoss.setRemainHps(result);
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,8 @@ public class FightDispatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
//gs-fight
|
//gs-fight
|
||||||
public static void dispatcherAsync(FightEvent fightEvent,long id) throws Exception {
|
public static void dispatcherAsync(FightEvent fightEvent,long id) {
|
||||||
ThreadManager.getScheduledExecutor().submit(new Runnable() {
|
ThreadManager.getScheduledExecutor().submit(() -> {
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
try {
|
||||||
GameFightType fightType = fightEvent.getFightType();
|
GameFightType fightType = fightEvent.getFightType();
|
||||||
FightResult fightResult = fightType.getFightEventProcesor().process(fightEvent);
|
FightResult fightResult = fightType.getFightEventProcesor().process(fightEvent);
|
||||||
|
|
@ -33,7 +31,6 @@ public class FightDispatcher {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -41,7 +38,7 @@ public class FightDispatcher {
|
||||||
|
|
||||||
|
|
||||||
//fight - gs
|
//fight - gs
|
||||||
public static void dispatcherAsyncToGs(FightResult fightResult) throws Exception {
|
public static void dispatcherAsyncToGs(FightResult fightResult) {
|
||||||
EndFightProcessor remove = map.remove(fightResult.getId());
|
EndFightProcessor remove = map.remove(fightResult.getId());
|
||||||
remove.endfightProcess(fightResult);
|
remove.endfightProcess(fightResult);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,6 @@ public class FightUtil {
|
||||||
public static FightResult getFightFromRedis(FightEvent fightEvent) throws Exception {
|
public static FightResult getFightFromRedis(FightEvent fightEvent) throws Exception {
|
||||||
GameFightType fightType = fightEvent.getFightType();
|
GameFightType fightType = fightEvent.getFightType();
|
||||||
int playerId = fightEvent.getAttackUid();
|
int playerId = fightEvent.getAttackUid();
|
||||||
String frames = fightEvent.getFrames();
|
|
||||||
int fightTime = fightEvent.getMostTime();
|
int fightTime = fightEvent.getMostTime();
|
||||||
|
|
||||||
String key = RedisKey.getKey(fightType.getFightTypeOfRedis(), Integer.toString(playerId), false);
|
String key = RedisKey.getKey(fightType.getFightTypeOfRedis(), Integer.toString(playerId), false);
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ public enum GameFightType {
|
||||||
TowerMap(FightType.TowerMap,new DefaultWithoutHandFightHandler(),null),
|
TowerMap(FightType.TowerMap,new DefaultWithoutHandFightHandler(),null),
|
||||||
|
|
||||||
FourChallenge(FightType.FourChallenge,new DefaultWithoutHandFightHandler(),null),
|
FourChallenge(FightType.FourChallenge,new DefaultWithoutHandFightHandler(),null),
|
||||||
SEVENWORLD(FightType.QIJIE_FIGHT,new DefaultWithoutHandFightHandler(),null),
|
SevenWorld(FightType.QIJIE_FIGHT,new DefaultWithoutHandFightHandler(),null),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,13 +92,13 @@ public class FightResult {
|
||||||
public long[] getCheckResult() {
|
public long[] getCheckResult() {
|
||||||
return checkResult;
|
return checkResult;
|
||||||
}
|
}
|
||||||
public List<Long> getRemainHp()throws Exception{
|
public List<Long> getRemainHp(){
|
||||||
//result check
|
//result check
|
||||||
List<Long> remainHp = new ArrayList<>(5);
|
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) {
|
if (checkResult[i] <= 0) {
|
||||||
remainHp.add((long) 0);
|
remainHp.add(0L);
|
||||||
} else {
|
} else {
|
||||||
remainHp.add(checkResult[i]);
|
remainHp.add(checkResult[i]);
|
||||||
}
|
}
|
||||||
|
|
@ -106,6 +106,18 @@ public class FightResult {
|
||||||
return remainHp;
|
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() {
|
public CommonProto.FightData getFightData() {
|
||||||
return fightData;
|
return fightData;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue