master_ob2
PC-202302260912\Administrator 2023-08-04 11:33:08 +08:00
parent c07e035c17
commit 6eb47c0a72
9 changed files with 378 additions and 592 deletions

View File

@ -125,7 +125,7 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
CSPlayer defQuery = null;
//根据双方现有分数计算出 得分
int ackScores = myQuery.getCrossYuxulundaoNewScore();
int defScores = 0;
int defScores;
if (defUid >= 1000) {
defQuery = CrossServiceLogic.getPlayerByRedis(defUid);
@ -140,14 +140,14 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
}
defScores = sArenaRobotConfig.getMsScroe();
}
int scoresValAbs = Math.abs(ackScores - defScores);
// int scoresValAbs = Math.abs(ackScores - defScores);
//胜利者获取分数 正数
/*int winerGetScore = setting.getBattleWinReward()[0] + scoresValAbs >= setting.getScoreRange()[0] && setting.getBattleWinReward()[0] + scoresValAbs <= setting.getScoreRange()[1]
? setting.getBattleWinReward()[0] + scoresValAbs : setting.getScoreRange()[1];
//失败者获取分数 负数
int loserGetScore = -winerGetScore;*/
int winerGetScore= 0;
int loserGetScore = 0;
int winerGetScore;
int loserGetScore;
if(winCount >=2 ){
//我赢了
winerGetScore = setting.getBattleWinReward()[0]+(defScores-ackScores);
@ -208,7 +208,7 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
}else if(loserGetScore<-setting.getScoreRange()[1]){//-35
loserGetScore = -setting.getScoreRange()[1];
}
int defScore;//对手分数
// int defScore;//对手分数
AbstractRank rank = RankContext.getRankEnum(RankEnum.CROSS_YUXULUNDAO_RANK_PERSON.getType());
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
if (winCount >= 2) {
@ -250,68 +250,66 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
//战斗记录
if (defUid > 1000) {
if (arenaRecord != null) {
if (winCount >= 2) {
//攻击者赢了
arenaRecord.setYxldBattleType(1);
arenaRecord.setYxldScoreChange(winerGetScore);
arenaRecord.setYxldDefScoreChange(loserGetScore);
} else {
arenaRecord.setYxldBattleType(2);
arenaRecord.setYxldScoreChange(loserGetScore);
arenaRecord.setYxldDefScoreChange(winerGetScore);
}
arenaRecord.setYxldResult(result);
//挑战者记录
RedisUtil redisUtil = RedisUtil.getInstence();
String key2 = RedisKey.getKey(RedisKey.CROSS_YUXULUNDAO_RECORD, String.valueOf(user.getId()));
long defLenth = redisUtil.lGetListSize(key2);
if (defLenth > 20) {
redisUtil.lPop(key2);
}
arenaRecord.setCreateTime(TimeUtils.nowInt());
String defarenaRecordJson = new Gson().toJson(arenaRecord);
redisUtil.lSet(key2, defarenaRecordJson);
if (winCount >= 2) {
//防守方输了了
arenaRecord.setYxldBattleType(4);
arenaRecord.setYxldScoreChange(loserGetScore);
arenaRecord.setYxldDefScoreChange(winerGetScore);
} else {
//防守方赢了
arenaRecord.setYxldBattleType(3);
arenaRecord.setYxldScoreChange(winerGetScore);
arenaRecord.setYxldDefScoreChange(loserGetScore);
}
//被挑战者记录
arenaRecord.setCreateTime(TimeUtils.nowInt()); // 时间
arenaRecord.setAttackId(user.getId()); //id
arenaRecord.setLevel(user.getPlayerInfoManager().getLevel()); //等级
arenaRecord.setHead(user.getPlayerInfoManager().getHead()); //头像
arenaRecord.setUserName(user.getPlayerInfoManager().getNickName()); //名字
arenaRecord.setHeadFrame(user.getPlayerInfoManager().getHeadFrame());//头像框
arenaRecord.setPracticeLevel(user.getHeroManager().getPracticeLevel());//修行等级
String ackServerName = CrossServiceLogic.simplifyServerName(GameApplication.serverId);
arenaRecord.setServerName(ackServerName);
int[] newResult = new int[3];
for (int i = 0; i < result.length; i++) {
newResult[i] = result[i] ^ 1;
}
arenaRecord.setYxldResult(newResult);
int myforce = HeroLogic.getInstance().calTeamTotalForce(user, TeamEnum.CROSS_YU_XU_LUN_DAO_ONE.getTeamId(), false)
+ HeroLogic.getInstance().calTeamTotalForce(user, TeamEnum.CROSS_YU_XU_LUN_DAO_TWO.getTeamId(), false)
+ HeroLogic.getInstance().calTeamTotalForce(user, TeamEnum.CROSS_YU_XU_LUN_DAO_THREE.getTeamId(), false);
//总战斗力
arenaRecord.setAttackForce(myforce);
String key = RedisKey.getKey(RedisKey.CROSS_YUXULUNDAO_RECORD, String.valueOf(defUid));
long def = redisUtil.lGetListSize(key);
if (def > 20) {
redisUtil.lPop(key);
}
String arenaRecordJson = new Gson().toJson(arenaRecord);
redisUtil.lSet(key, arenaRecordJson);
if (winCount >= 2) {
//攻击者赢了
arenaRecord.setYxldBattleType(1);
arenaRecord.setYxldScoreChange(winerGetScore);
arenaRecord.setYxldDefScoreChange(loserGetScore);
} else {
arenaRecord.setYxldBattleType(2);
arenaRecord.setYxldScoreChange(loserGetScore);
arenaRecord.setYxldDefScoreChange(winerGetScore);
}
arenaRecord.setYxldResult(result);
//挑战者记录
RedisUtil redisUtil = RedisUtil.getInstence();
String key2 = RedisKey.getKey(RedisKey.CROSS_YUXULUNDAO_RECORD, String.valueOf(user.getId()));
long defLenth = redisUtil.lGetListSize(key2);
if (defLenth > 20) {
redisUtil.lPop(key2);
}
arenaRecord.setCreateTime(TimeUtils.nowInt());
String defarenaRecordJson = new Gson().toJson(arenaRecord);
redisUtil.lSet(key2, defarenaRecordJson);
if (winCount >= 2) {
//防守方输了了
arenaRecord.setYxldBattleType(4);
arenaRecord.setYxldScoreChange(loserGetScore);
arenaRecord.setYxldDefScoreChange(winerGetScore);
} else {
//防守方赢了
arenaRecord.setYxldBattleType(3);
arenaRecord.setYxldScoreChange(winerGetScore);
arenaRecord.setYxldDefScoreChange(loserGetScore);
}
//被挑战者记录
arenaRecord.setCreateTime(TimeUtils.nowInt()); // 时间
arenaRecord.setAttackId(user.getId()); //id
arenaRecord.setLevel(user.getPlayerInfoManager().getLevel()); //等级
arenaRecord.setHead(user.getPlayerInfoManager().getHead()); //头像
arenaRecord.setUserName(user.getPlayerInfoManager().getNickName()); //名字
arenaRecord.setHeadFrame(user.getPlayerInfoManager().getHeadFrame());//头像框
arenaRecord.setPracticeLevel(user.getHeroManager().getPracticeLevel());//修行等级
String ackServerName = CrossServiceLogic.simplifyServerName(GameApplication.serverId);
arenaRecord.setServerName(ackServerName);
int[] newResult = new int[3];
for (int i = 0; i < result.length; i++) {
newResult[i] = result[i] ^ 1;
}
arenaRecord.setYxldResult(newResult);
int myforce = HeroLogic.getInstance().calTeamTotalForce(user, TeamEnum.CROSS_YU_XU_LUN_DAO_ONE.getTeamId(), false)
+ HeroLogic.getInstance().calTeamTotalForce(user, TeamEnum.CROSS_YU_XU_LUN_DAO_TWO.getTeamId(), false)
+ HeroLogic.getInstance().calTeamTotalForce(user, TeamEnum.CROSS_YU_XU_LUN_DAO_THREE.getTeamId(), false);
//总战斗力
arenaRecord.setAttackForce(myforce);
String key = RedisKey.getKey(RedisKey.CROSS_YUXULUNDAO_RECORD, String.valueOf(defUid));
long def = redisUtil.lGetListSize(key);
if (def > 20) {
redisUtil.lPop(key);
}
String arenaRecordJson = new Gson().toJson(arenaRecord);
redisUtil.lSet(key, arenaRecordJson);
}
int id = SMServerRankConfig.getIdByScore(myQuery.getCrossYuxulundaoNewScore());
@ -419,7 +417,7 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
Map<Integer, List<TeamPosHeroInfo>> teamPosForHero = user.getTeamPosManager().getTeamPosForHero();
if(!teamPosForHero.containsKey(myteamId[i]) || teamPosForHero.get(myteamId[i]).size() == 0){
result[i] = 0;
CommonProto.FightTeamInfo defteamInfo = FightUtil.makeCrossPersonData(csPlayer, defTeamId[i], arenaRecord, crossArenaManager);
CommonProto.FightTeamInfo defteamInfo = FightUtil.makeCrossPersonData(csPlayer, defTeamId[i], arenaRecord);
CommonProto.FightData build = CommonProto.FightData.newBuilder().addMonsterList(defteamInfo).build();
//数据互换
byte[] snapRecord = build.toByteArray();
@ -444,7 +442,7 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
}
return true;
}
public static boolean updateResult(User user,int i, int[] myteamId, int[] defTeamId, int[] result){
public static boolean updateResult(User user, int i, int[] myteamId, int[] result){
//没有队伍时候 直接断定对方赢
Map<Integer, List<TeamPosHeroInfo>> teamPosForHero = user.getTeamPosManager().getTeamPosForHero();
if(!teamPosForHero.containsKey(myteamId[i]) || teamPosForHero.get(myteamId[i]).size() == 0){
@ -457,7 +455,7 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
int[] result = new int[3];//1赢 0输
for (int i = 0; i < 3; i++) {
//编队为空 判输赢
if (!updateResult(myUser,i, myteamId, defTeamId, result)) {
if (!updateResult(myUser,i, myteamId, result)) {
continue;
}
CommonProto.FightTeamInfo fightTeamInfo = FightUtil.makePersonFightData(myUser, myteamId[i], null, null);
@ -467,7 +465,8 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
}
CommonProto.FightTeamInfo defteamInfo = FightUtil.getYxldRobotFightTeamInfo(sArenaRobotConfig, i + 1);
//HeroLogic.getInstance().calTeamTotalForce(user, team, false)
int myforce = 0;int defforce =0;
int myforce;
int defforce =0;
myforce = HeroLogic.getInstance().calTeamTotalForce(myUser, myteamId[i], false);
if(defTeamId[i] == TeamEnum.CROSS_YU_XU_LUN_DAO_ONE.getTeamId()){
defforce =sArenaRobotConfig.getYxldTotalForce1();

View File

@ -19,6 +19,6 @@ public class GetAllPropertyInfoHandler extends BaseHandler {
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
HeroLogic.getInstance().allBookFetter(iSession,MessageTypeProto.MessageType.GET_ALL_PROPERTY_INFO_RESPONSE);
HeroLogic.getInstance().allBookFetter(iSession);
}
}

View File

@ -137,11 +137,11 @@ public class Cmd_role_gm extends GmRoleAbstract {
return true;
}
public static boolean isBattleNode(int type) {
public static boolean isNotBattleNode(int type) {
int NODETYPE_ADVANCE = 1;//精英节点
int NODETYPE_BOSS = 2;//首领节点
int NODETYPE_NORMAL = 5;//普通节点
return type == NODETYPE_ADVANCE || type == NODETYPE_BOSS || type == NODETYPE_NORMAL;
return type != NODETYPE_ADVANCE && type != NODETYPE_BOSS && type != NODETYPE_NORMAL;
}
@ -149,7 +149,7 @@ public class Cmd_role_gm extends GmRoleAbstract {
*
*/
private void snapOneFightInfo(ExpeditionNodeInfo nodeInfo, SArenaRobotConfig sArenaRobotConfig) {
if (!isBattleNode(nodeInfo.getType())) {
if (isNotBattleNode(nodeInfo.getType())) {
return;
}
SnapFightInfo fightInfo = new SnapFightInfo();
@ -192,7 +192,7 @@ public class Cmd_role_gm extends GmRoleAbstract {
private void snapOneFightInfo(User self, ExpeditionNodeInfo nodeInfo, int defid) throws Exception {
int snapTeamId = TeamEnum.TEAM_ARENA_DEFENSE.getTeamId();
if (!isBattleNode(nodeInfo.getType())) {
if (isNotBattleNode(nodeInfo.getType())) {
return;
}
User user = UserManager.getUser(defid);
@ -219,10 +219,10 @@ public class Cmd_role_gm extends GmRoleAbstract {
}
nodeInfo.setBossHP(bossHP);
if (self.getPokemonManager().getPokemonTeamMap().size()!=0) {
// if (self.getPokemonManager().getPokemonTeamMap().size()!=0) {
//玩家未激活异妖(神器)时,敌人阵容中不会出现异妖;激活异妖后,由敌人数据来源方决定战斗时是否有敌方异妖。
// String pokenmonSkills = HeroLogic.getInstance().getPokenmonSkills(user);
String pokenmonPassiveSkills = HeroLogic.getInstance().getPokenmonPassiveSkills(user, snapTeamId);
// String pokenmonPassiveSkills = HeroLogic.getInstance().getPokenmonPassiveSkills(user, snapTeamId);
// List<TeamPosForPokenInfo> teamPosForPokenInfos = user.getTeamPosManager().getTeamPosForPoken().get(snapTeamId);
// if (null!=teamPosForPokenInfos) {
// List<Integer> pokens = new ArrayList<>();
@ -232,8 +232,8 @@ public class Cmd_role_gm extends GmRoleAbstract {
// fightInfo.setPokenmonIds(pokens);
// }
// fightInfo.setPokenmonSkills(pokenmonSkills);
fightInfo.setPassiveSkills(pokenmonPassiveSkills);
}
// fightInfo.setPassiveSkills(pokenmonPassiveSkills);
// }
nodeInfo.setSnapFightInfo(fightInfo);
@ -253,17 +253,14 @@ public class Cmd_role_gm extends GmRoleAbstract {
throw new ErrorCodeException(ErrorCode.CFG_NULL);
}
//grop config
int i = sExpeditionRecruitConfig.getHeroId();
SnapFightInfo fightInfo = new SnapFightInfo();
nodeInfo.setSnapFightInfo(fightInfo);
}
/**
* type id state
*/
private Set<ExpeditionNodeInfo> createNodeSet(int leve) throws Exception {
private Set<ExpeditionNodeInfo> createNodeSet(int leve) {
int NODESTATE_CLOSE = 0;//0未开启
int NODESTATE_NOT_PASS = 1;//1未通过
int NODESTATE_NOT_GET = 2;//2未领取圣物
@ -303,7 +300,7 @@ public class Cmd_role_gm extends GmRoleAbstract {
//生成随机节点
if(map.containsKey(lay)){
for (Integer itemType:map.get(lay)) {
ExpeditionNodeInfo nodeInfo = getNode(sExpeditionFloorConfig, itemType);
ExpeditionNodeInfo nodeInfo = getNode(itemType);
nodeInfo.setLay(lay-orDefault);
@ -334,7 +331,7 @@ public class Cmd_role_gm extends GmRoleAbstract {
if (typeArr.length != 2) {
continue;
}
Set<ExpeditionNodeInfo> tempnode = getNode(sExpeditionFloorConfig, typeArr[0], typeArr[1]);
Set<ExpeditionNodeInfo> tempnode = getNode(typeArr[0], typeArr[1]);
tempnode.forEach(nodeInfo -> {
nodeInfo.setLay(lay-orDefault);
nodeInfo.setState(NODESTATE_OVER_PASS);
@ -364,7 +361,7 @@ public class Cmd_role_gm extends GmRoleAbstract {
if (Math.random() <= 0.3d) {
type = NODETYPE_ADVANCE;
}
ExpeditionNodeInfo nodeInfo = getNode(sExpeditionFloorConfig, type);
ExpeditionNodeInfo nodeInfo = getNode(type);
nodeInfo.setLay(lay-orDefault);
nodeInfo.setState(NODESTATE_OVER_PASS);
if(!isfirst){
@ -402,11 +399,11 @@ public class Cmd_role_gm extends GmRoleAbstract {
}
private ExpeditionNodeInfo getNode(SExpeditionFloorConfig cfg, int type) throws Exception {
return getNode(cfg, type, 1).iterator().next();
private ExpeditionNodeInfo getNode(int type) {
return getNode(type, 1).iterator().next();
}
private Set<ExpeditionNodeInfo> getNode(SExpeditionFloorConfig cfg, int type, int num) throws Exception {
private Set<ExpeditionNodeInfo> getNode(int type, int num) {
int NODESTATE_CLOSE = 0;//0未开启
Set<ExpeditionNodeInfo> nodeSets = new HashSet<>();

View File

@ -87,7 +87,7 @@ public class SituationLogic {
}
private void doCheck(){
long now = TimeUtils.now();
int hourOfDay = TimeUtils.getHourOfDay();
// int hourOfDay = TimeUtils.getHourOfDay();
int week = TimeUtils.getDayOfWeek();
boolean isIndication = false;
for(int[] config:openConfig){
@ -302,14 +302,14 @@ public class SituationLogic {
// user.getUserMissionManager().onGameEvent(user, GameEvent.DAILY_CHALLENGE,sDailyChallengeConfig.getType());
MessageUtil.sendMessage(session,1,messageType.getNumber(),builder.build());
}
public static FightResult getFightForSituation(FightEvent fightEvent,Map<Integer,List<Integer>> buffInfo){
public static FightResult getFightForSituation(FightEvent fightEvent,Map<Integer,List<Integer>> buffInfo) throws Exception {
PVEFightEvent pveFightEvent = (PVEFightEvent)fightEvent;
User userInMem = UserManager.getUserNotCache(pveFightEvent.getAttackUid());
CommonProto.FightTeamInfo fightTeamInfo = FightUtil.getFightTeamInfoWithSomeBuff(userInMem, pveFightEvent.getTeamId(),pveFightEvent.getAttackBloodMap(),buffInfo);
User userInMem = UserManager.getUser(pveFightEvent.getAttackUid());
CommonProto.FightTeamInfo fightTeamInfo = FightUtil.getFightTeamInfoWithSomeBuff(userInMem, pveFightEvent.getTeamId(), buffInfo);
int fightSeed = FightUtil.getFightSeed();
List<CommonProto.FightTeamInfo> monsterfightTeamInfos = FightUtil.makeMonsterFightData(pveFightEvent.getMonsterGroupId(), pveFightEvent.getNums(),null);
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo, monsterfightTeamInfos);
LuaValue getOptionData = FightDataUtil.getOptionData(pveFightEvent.getAttackUid()+"");
LuaValue getOptionData = FightDataUtil.getOptionData(String.valueOf(pveFightEvent.getAttackUid()));
long[] fightResult = CheckFight.getInstance().checkFight(fightSeed, fightEvent.getMostTime(), getFightData, getOptionData, fightEvent.getFightType().getFightType());
FightResult.Builder builder = FightResult.newBuilder();

View File

@ -49,12 +49,10 @@ import util.TimeUtils;
import java.lang.reflect.Type;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
;
@SuppressWarnings("rawtypes")
public class ChampionshipLogic {
private static final Logger LOGGER = LoggerFactory.getLogger(HeroLogic.class);
//启动服务器应该去redis获取
@ -63,7 +61,7 @@ public class ChampionshipLogic {
private static volatile int roundTimes; //比赛进行第几轮//时间轮
private static volatile int realTimes; //比赛进行第几轮 比赛轮
private static Map<Integer, Boolean> fightAll = new ConcurrentHashMap<>();
// private static Map<Integer, Boolean> fightAll = new ConcurrentHashMap<>();
private static volatile int fightTime = 1; //本轮比赛是否打完 1 第一场 2 第二场 3第三场 0结束
private static volatile int fightTime_temp = 1; //本轮比赛是否打完 1 第一场 2 第二场 3第三场 0结束
private static volatile int schedule = 1;//1 选拔赛
@ -90,7 +88,7 @@ public class ChampionshipLogic {
schedule = Integer.parseInt((String) result);
}
} catch (Exception e) {
LOGGER.info("Exception the init={}", e);
LOGGER.info("Exception the init={}", e.toString());
}
}
@ -234,7 +232,7 @@ public class ChampionshipLogic {
//胜利者积分排名
HashMap<Integer, ZSetOperations.TypedTuple<String>> integerIntegerHashMap = new HashMap<>();
List<String> finalArenaIds = new ArrayList<>();
// List<String> finalArenaIds = new ArrayList<>();
Map<String, Integer> states = RedisUtil.getInstence().getMapValues2(RedisKey.CHAMPION_ARENA_RECORD_THREE, "", String.class, Integer.class);
arenaRecords.forEach((v) -> {
@ -266,7 +264,7 @@ public class ChampionshipLogic {
updateJoinMemberInfo(joinMemberInfo);
updateJoinMemberInfo(failMemberInfo);
score = joinMemberInfo.getFinalScore();
finalArenaIds.add(v.getId());
// finalArenaIds.add(v.getId());
} else {
joinMemberInfo.setScore(joinMemberInfo.getScore() + 1);
score = joinMemberInfo.getScore();
@ -275,9 +273,9 @@ public class ChampionshipLogic {
integerIntegerHashMap.putIfAbsent(winnerUid, new DefaultTypedTuple(Integer.toString(winnerUid), (double) score));
});
RedisUtil.getInstence().updateZsetScores(RedisKey.CHAMPION_RANK, "", new HashSet<>(integerIntegerHashMap.values()));
if (schedule == 2) {
// RedisUtil.getInstence().lSet(RedisKey.CHAMPION_FINAL_RECODED_IDS, "", finalArenaIds);
}
// if (schedule == 2) {
// // RedisUtil.getInstence().lSet(RedisKey.CHAMPION_FINAL_RECODED_IDS, "", finalArenaIds);
// }
}
private static boolean battleIsFinish(List<ArenaRecord> arenaRecords) {
@ -297,7 +295,7 @@ public class ChampionshipLogic {
public static void start() {
LOGGER.info("the champion start...");
Set<ZSetOperations.TypedTuple<String>> arenaRankInfoInRedis = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.CHAMPION_RANK, "", 0, -1);
Map<Integer, SArenaRobotConfig> robotConfigMap = STableManager.getConfig(SArenaRobotConfig.class);
// Map<Integer, SArenaRobotConfig> robotConfigMap = STableManager.getConfig(SArenaRobotConfig.class);
Set<Integer> joinUids = new HashSet<>(128);
for (ZSetOperations.TypedTuple<String> item : arenaRankInfoInRedis) {
String uidStr = item.getValue();
@ -331,16 +329,13 @@ public class ChampionshipLogic {
if (arenaRankInfo.size() < championshipPlayer) {
//补发机器人
Map<Integer, SArenaRobotConfig> config = STableManager.getConfig(SArenaRobotConfig.class);
TreeMap<Integer, SArenaRobotConfig> sArenaRobotConfigMap = new TreeMap<Integer, SArenaRobotConfig>(new Comparator<Integer>() {
public int compare(Integer a, Integer b) {
int randomOne = MathUtils.randomInt();
int randomTwo = MathUtils.randomInt();
if (randomOne == randomTwo) {
randomOne += 1;
}
return randomOne - randomTwo;
TreeMap<Integer, SArenaRobotConfig> sArenaRobotConfigMap = new TreeMap<>((a, b) -> {
int randomOne = MathUtils.randomInt();
int randomTwo = MathUtils.randomInt();
if (randomOne == randomTwo) {
randomOne += 1;
}
return randomOne - randomTwo;
});
sArenaRobotConfigMap.putAll(config);
int end = championshipPlayer - arenaRankInfo.size();
@ -370,9 +365,7 @@ public class ChampionshipLogic {
//join
Map<String, MemberInfo> memberInfoMap = new HashMap<>();
memberInfos.forEach(memberInfo -> {
memberInfoMap.put(Integer.toString(memberInfo.getUid()), memberInfo);
});
memberInfos.forEach(memberInfo -> memberInfoMap.put(Integer.toString(memberInfo.getUid()), memberInfo));
RedisUtil.getInstence().putMapEntrys(RedisKey.CHAMPION_JOIN, "", memberInfoMap);
@ -424,7 +417,7 @@ public class ChampionshipLogic {
}
} catch (Exception e) {
LOGGER.info("Exception e = " + "size" + arenaRankInfo.size() + e.toString());
LOGGER.info("Exception e = " + "size" + arenaRankInfo.size() + e);
}
MongoUtil.getLjsdMongoTemplate().lastUpdate();
@ -492,7 +485,6 @@ public class ChampionshipLogic {
*
* @param memberInfoList
* @param groupNums
* @return
*/
private static List<List<Integer>> getMemberOfTeamOfGroup(List<MemberInfo> memberInfoList, int groupNums, boolean teamUpdate) {
@ -575,7 +567,7 @@ public class ChampionshipLogic {
});
//这里将map.entrySet()转换成list
List<Map.Entry<Integer, Integer>> list = new ArrayList<Map.Entry<Integer, Integer>>(uidRankMap.entrySet());
List<Map.Entry<Integer, Integer>> list = new ArrayList<>(uidRankMap.entrySet());
//然后通过比较器来实现排序
list.sort((o1, o2) -> {
if (Objects.equals(o2.getValue(), o1.getValue())) {
@ -613,8 +605,8 @@ public class ChampionshipLogic {
if (fight) {
long id = FightDispatcher.getFIghtId();
EndFightProcessor endFightProcessor = new AreFightPro();
((AreFightPro) endFightProcessor).setArenaRecord(arenaRecord);
AreFightPro endFightProcessor = new AreFightPro();
endFightProcessor.setArenaRecord(arenaRecord);
FightDispatcher.getMap().put(id, endFightProcessor);
PVPFightEvent pvpFightEvent = new PVPFightEvent(attackId, snapTeamId, warTime, "", gameFightTypeMap.get(arenaRecord.getType()), defUid, snapTeamId);
@ -691,8 +683,8 @@ public class ChampionshipLogic {
}
// String pokenmonSkills = HeroLogic.getInstance().getPokenmonSkills(user);
// fightInfo.setPokenmonSkills(pokenmonSkills);
String pokenmonPassiveSkills = HeroLogic.getInstance().getPokenmonPassiveSkills(user, snapTeamId);
fightInfo.setPassiveSkills(pokenmonPassiveSkills);
// String pokenmonPassiveSkills = HeroLogic.getInstance().getPokenmonPassiveSkills(user, snapTeamId);
fightInfo.setPassiveSkills("");
memberInfo.setFightInfo(fightInfo);
joinMembers.put(memberInfo.getUid(), memberInfo);
RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_JOIN, "", String.valueOf(uid), memberInfo);
@ -733,7 +725,7 @@ public class ChampionshipLogic {
}
public static int getForce(MemberInfo memberInfo, Map<Integer, SArenaRobotConfig> config) {
int force = 0;
int force;
SArenaRobotConfig sArenaRobotConfig = config.get(memberInfo.getUid());
if (sArenaRobotConfig != null) {
force = sArenaRobotConfig.getTotalForce();
@ -752,9 +744,7 @@ public class ChampionshipLogic {
Set<String> betDetails = RedisUtil.getInstence().getZset(betAllKey, 0, -1);
for (String betInfo : betDetails) {
Map<Integer, Integer> userDeatails = RedisUtil.getInstence().getMapValues2(RedisKey.CHAMPION_BET_DETAIL, betInfo, Integer.class, Integer.class);
userDeatails.keySet().forEach(uid -> {
delKeys.add(RedisUtil.getInstence().getKey(RedisKey.CHAMPION_BET_MINE, Integer.toString(uid)));
});
userDeatails.keySet().forEach(uid -> delKeys.add(RedisUtil.getInstence().getKey(RedisKey.CHAMPION_BET_MINE, Integer.toString(uid))));
delKeys.add(RedisUtil.getInstence().getKey(RedisKey.CHAMPION_BET_DETAIL, betInfo));
}
delKeys.add(betAllKey);
@ -774,13 +764,11 @@ public class ChampionshipLogic {
delKeys.add(RedisUtil.getInstence().getKey(RedisKey.CHAMPION_ARENA_RECORD_THREE, ""));
delKeys.add(RedisUtil.getInstence().getKey(RedisKey.CHAMPION_SCHEDULE, ""));
//我的历史结果
joinUids.forEach(uid -> {
delKeys.add(RedisUtil.getInstence().getKey(RedisKey.CHAMPION_MY_BATTLLE_IDS, Integer.toString(uid)));
});
joinUids.forEach(uid -> delKeys.add(RedisUtil.getInstence().getKey(RedisKey.CHAMPION_MY_BATTLLE_IDS, Integer.toString(uid))));
RedisUtil.getInstence().del(delKeys.toArray(new String[0]));
realTimes = 1;
fightTime = 1;
fightAll.clear();
// fightAll.clear();
}
/**
@ -876,7 +864,7 @@ public class ChampionshipLogic {
}
public static CommonProto.TeamOneInfo.Builder getUserTeam(int robotId) {
CommonProto.TeamOneInfo.Builder builder = CommonProto.TeamOneInfo.newBuilder();
CommonProto.TeamOneInfo.Builder builder;
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(robotId);
if (sArenaRobotConfig != null) {
builder = PlayerLogic.getInstance().getRobotTeamInfo(sArenaRobotConfig);
@ -1073,14 +1061,11 @@ public class ChampionshipLogic {
Set<ZSetOperations.TypedTuple<String>> arenaRankInfoForChampion = new HashSet<>();
Map<Integer, MemberInfo> joinMembers = RedisUtil.getInstence().getMapValues2(RedisKey.CHAMPION_JOIN, "", Integer.class, MemberInfo.class);
for (List<Integer> memberOfOneTeam : mermberTeam.values()) {
Collections.sort(memberOfOneTeam, new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
if (joinMembers.get(o2).getScore() == joinMembers.get(o1).getScore()) {
return getMaxForce(o2) - getMaxForce(o1);
}
return joinMembers.get(o2).getScore() - joinMembers.get(o1).getScore();
memberOfOneTeam.sort((o1, o2) -> {
if (joinMembers.get(o2).getScore() == joinMembers.get(o1).getScore()) {
return getMaxForce(o2) - getMaxForce(o1);
}
return joinMembers.get(o2).getScore() - joinMembers.get(o1).getScore();
});
for (int i = 0; i < trialsGroupWinner; i++) {
MemberInfo memberInfo = joinMembers.get(memberOfOneTeam.get(i));
@ -1095,9 +1080,7 @@ public class ChampionshipLogic {
RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_FINAL_TEAM_INFO, "", Integer.toString(i), finalmemberOfTeam.get(i));
}
Map<String, MemberInfo> finalMemberInfoMap = new HashMap<>();
canJoinFinal.forEach(memberInfo -> {
finalMemberInfoMap.put(Integer.toString(memberInfo.getUid()), memberInfo);
});
canJoinFinal.forEach(memberInfo -> finalMemberInfoMap.put(Integer.toString(memberInfo.getUid()), memberInfo));
RedisUtil.getInstence().putMapEntrys(RedisKey.CHAMPION_JOIN, "", finalMemberInfoMap);
}
@ -1109,7 +1092,6 @@ public class ChampionshipLogic {
* 3.
* 4广
*
* @throws Exception
*/
public static void switchBet(int functionId) throws Exception {
int[][] itemNum = STableManager.getFigureConfig(CommonStaticConfig.class).getsChampionshipSetting().getItemNum();
@ -1124,26 +1106,23 @@ public class ChampionshipLogic {
try {
sendIds.put(Integer.toString(session.getUid()), 1);
User user = UserManager.getUser(session.getUid());
AyyncWorker ayyncWorker = new AyyncWorker(user, true, new AyncWorkerRunnable() {
@Override
public void work(User user) throws Exception {
if (!GlobleSystemLogic.checkOpen(user, sGlobalSystemConfig)) {
return;
}
Item item = user.getItemManager().getItem(itemNum[0][0]);
if (item == null || item.getItemNum() < itemNum[0][1]) {
int[][] reward = new int[1][];
int[] temp2 = new int[2];
temp2[0] = itemNum[0][0];
temp2[1] = item == null ? itemNum[0][1] : itemNum[0][1] - (int) item.getItemNum();
reward[0] = temp2;
// fix 发放代币 只补充到阈值
ItemUtil.drop(user, reward, BIReason.CHAMPIION_BET_REWARD);
MongoUtil.getLjsdMongoTemplate().lastUpdate();
}
AyyncWorker ayyncWorker = new AyyncWorker(user, true, user1 -> {
if (!GlobleSystemLogic.checkOpen(user1, sGlobalSystemConfig)) {
return;
}
Item item = user1.getItemManager().getItem(itemNum[0][0]);
if (item == null || item.getItemNum() < itemNum[0][1]) {
int[][] reward = new int[1][];
int[] temp2 = new int[2];
temp2[0] = itemNum[0][0];
temp2[1] = item == null ? itemNum[0][1] : itemNum[0][1] - (int) item.getItemNum();
reward[0] = temp2;
// fix 发放代币 只补充到阈值
ItemUtil.drop(user1, reward, BIReason.CHAMPIION_BET_REWARD);
MongoUtil.getLjsdMongoTemplate().lastUpdate();
}
});
ProtocolsManager.getInstance().updateAyncWorker(ayyncWorker);
} catch (Exception e) {
@ -1354,9 +1333,8 @@ public class ChampionshipLogic {
ChampionshipLogic.fightTime_temp = 3;
}
}
if (schedule == 2 && (fightTime != 3 && fightTime_temp != 3)) {
} else {
boolean b = schedule == 2 && (fightTime != 3 && fightTime_temp != 3);
if (!b) {
sendBetReward();
}
sendAllProgressUpdate();

View File

@ -83,11 +83,8 @@ public class GuildFightLogic {
GuildFightLogic.status = status;
}
/**
*
*
*
* @param session
* @param messageType
* @throws Exception
*/
public static void viewDefendInfo(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
User user = UserManager.getUser(session.getUid());
@ -116,10 +113,6 @@ public class GuildFightLogic {
/**
*
*
* @param session
* @param uid
* @param messageType
* @throws Exception
*/
public static void viewDefendDetailInfo(ISession session, int uid,int gid ,MessageTypeProto.MessageType messageType) throws Exception {
@ -178,9 +171,6 @@ public class GuildFightLogic {
/**
*
*
* @param session
* @param messageType
*/
public static void quickSetDefend(ISession session, int buildId, int uid, MessageTypeProto.MessageType messageType) throws Exception {
User user = UserManager.getUser(uid);
@ -253,9 +243,6 @@ public class GuildFightLogic {
/**
*
*
* @param session
* @param messageType
* @throws Exception
*/
public static void viewFightInfo(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
User user = UserManager.getUser(session.getUid());
@ -271,7 +258,6 @@ public class GuildFightLogic {
/**
*
*
* @throws Exception
*/
public static void familyFightMatching() throws Exception {
RedisUtil redisUtil = RedisUtil.getInstence();
@ -364,8 +350,8 @@ public class GuildFightLogic {
}
// String pokenmonSkills = HeroLogic.getInstance().getPokenmonSkills(user);
// fightInfo.setPokenmonSkills(pokenmonSkills);
String pokenmonPassiveSkills = HeroLogic.getInstance().getPokenmonPassiveSkills(user, 501);
fightInfo.setPassiveSkills(pokenmonPassiveSkills);
// String pokenmonPassiveSkills = HeroLogic.getInstance().getPokenmonPassiveSkills(user, 501);
fightInfo.setPassiveSkills("");
redisUtil.putMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(guildInfo.getId()), String.valueOf(entry.getKey()), fightInfo);
familyTotalStar+=fightInfo.getStarCount();
}
@ -397,7 +383,7 @@ public class GuildFightLogic {
GuildInfo enemyInfo = CrossDeathPathLogic.getCrossGuild(enemyFamily);
Family.EnemyFamily familyInfo = Family.EnemyFamily.newBuilder().setId(enemyFamily)
.setLevel(enemyInfo.getLevel())
.setName(Optional.ofNullable(enemyInfo).map(GuildInfo::getName).orElse(""))
.setName(Optional.of(enemyInfo).map(GuildInfo::getName).orElse(""))
.setPictureId(enemyInfo.getIcon())
.setTotalStar(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"",String.valueOf(enemyFamily),Integer.class))
.setMyTotalStar(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"",String.valueOf(guildInfo.getId()),Integer.class))
@ -409,8 +395,6 @@ public class GuildFightLogic {
/**
*
*
* @param myFamilyId
* @return
*/
private static int getEnemyFamily(int myFamilyId) {
RedisUtil redisUtil = RedisUtil.getInstence();
@ -542,8 +526,6 @@ public class GuildFightLogic {
/**
*
*
* @param session
* @param messageType
*/
public static void getFamilyFightRoundInfo(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
RedisUtil redisUtil = RedisUtil.getInstence();
@ -562,7 +544,7 @@ public class GuildFightLogic {
.setAttackCount(attackCount);
// long joinTime = UserManager.getUser(session.getUid()).getGuildMyInfo().getJoinTime();
GuildInfo guildInfo = GuilidManager.getGuildInfo(guildId);
if (guildInfo != null && status != 0 && !guildInfo.getDefendInfo().keySet().contains(session.getUid())) {
if (guildInfo != null && status != 0 && !guildInfo.getDefendInfo().containsKey(session.getUid())) {
response.setJoinType(1);
}
if (enemyFamily != -1) {
@ -587,7 +569,7 @@ public class GuildFightLogic {
//todo 人数限制
if(guildId!=0){
Map<Integer, SGuildLevelConfig> configMap = STableManager.getConfig(SGuildLevelConfig.class);
if(guildInfo.getDefendInfo().size()<configMap.get(guildInfo.getLevel()).getDefendNum()){
if (guildInfo != null && guildInfo.getDefendInfo().size() < configMap.get(guildInfo.getLevel()).getDefendNum()) {
response.setType(-1);
response.setRoundEndTime((int) (TimeUtils.getAppointTime(sGuildSetting.getSettleTime()[1][0], sGuildSetting.getSettleTime()[1][1]) / 1000));
}
@ -609,7 +591,6 @@ public class GuildFightLogic {
/**
*
*
* @throws Exception
*/
public static void familyFightStatus() throws Exception {
int isOpen = SSpecialConfig.getIntegerValue(SSpecialConfig.GUILD_WAR_ISOPEN);
@ -676,7 +657,7 @@ public class GuildFightLogic {
//所有星数信息
String totalStar = RedisKey.getKey(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"");
//所有血量信息
String attackBlood = RedisKey.getKey(RedisKey.FAMILY_ATTACK_BLOOD,"");
// String attackBlood = RedisKey.getKey(RedisKey.FAMILY_ATTACK_BLOOD,"");
Set<String> matchingRank = redisUtil.getZset(matchingKey, 0, redisUtil.getZsetSize(matchingKey));
for(String index:matchingRank){
Map<Integer, FamilyFightInfo> fightDefend = redisUtil.getMapValues2(RedisKey.FAMILY_FIGHT, index, Integer.class, FamilyFightInfo.class);
@ -753,11 +734,9 @@ public class GuildFightLogic {
if(buildStar[i]==0){
buildStar[i] = buildingStar[i];
LOGGER.info("结算额外星数{}",buildStar[i]);
continue;
}else{
buildStar[i] = 0;
LOGGER.info("结算额外星数{}",buildStar[i]);
continue;
}
}
redisUtil.putMapEntry(RedisKey.FAMILY_FIGHT_EXTRA_STAR,"",str,buildStar);
@ -977,8 +956,8 @@ public class GuildFightLogic {
totalStar+= entry.getValue();
}
int[] buildExtra = extraStar.get(gid);
for(int i = 0 ;i <buildExtra.length;i++){
totalStar+=buildExtra[i];
for (int j : buildExtra) {
totalStar += j;
}
return totalStar;
}
@ -990,10 +969,7 @@ public class GuildFightLogic {
if(hour==times[0][0]&&minute<times[0][1]){
return false;
}
if(hour==times[1][0]&&minute>=times[1][1]){
return false;
}
return true;
return hour != times[1][0] || minute < times[1][1];
}
@ -1005,7 +981,7 @@ public class GuildFightLogic {
if(status==0){
LOGGER.info("阶段变为布防");
Map<Integer, GuildInfo> guildInfoMap = GuilidManager.getAllGuildInfos();
if(guildInfoMap!=null&&guildInfoMap.size()>0){
if(guildInfoMap.size()>0){
for(Map.Entry<Integer, GuildInfo> entry:guildInfoMap.entrySet()){
int build = 0;
Map<Integer, Set<Integer>> members = entry.getValue().getMembers();
@ -1099,7 +1075,7 @@ public class GuildFightLogic {
String fightKey = RedisKey.getKey(RedisKey.GUILD_MONSTER_INFO, String.valueOf(uid));
String fightInfos = (String) RedisUtil.getInstence().get(fightKey);
if (StringUtil.isEmpty(fightInfos)) {
LOGGER.info("endFight() uid=>{} fightKey={},fightId={} fightInfos == null", uid, fightKey);
LOGGER.info("endFight() uid=>{} fightKey={} fightInfos == null", uid, fightKey);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
FightEvent fightEvent = new FightEvent(uid, -1, SGuildSetting.sGuildSetting.getBossTime(),frames, GameFightType.GuildBossFight);
@ -1207,22 +1183,20 @@ public class GuildFightLogic {
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("guildboss_daily_reward_txt",new String[]{UserManager.getUser(Integer.parseInt(next.getValue())).getPlayerInfoManager().getNickName(),Integer.toString(maxHurt)},new int[]{0,0},"#");
int[][] mineReward = new int[bossReward.length][];
int j=0;
for(int i=0;i<bossReward.length;i++){
int itemNum = (int) (bossReward[i][1] * maxHurt);
if(itemNum==0){
for (float[] floats : bossReward) {
int itemNum = (int) (floats[1] * maxHurt);
if (itemNum == 0) {
continue;
}
mineReward[j] = new int[2];
mineReward[j][0] =(int)bossReward[i][0];
mineReward[j++][1] =itemNum;
mineReward[j][0] = (int) floats[0];
mineReward[j++][1] = itemNum;
}
String rewardByRank = StringUtil.parseArrayToString(mineReward);
Map<Integer, Set<Integer>> members = guildInfo.getMembers();
Iterator<Set<Integer>> iterator = members.values().iterator();
while (iterator.hasNext()){
Set<Integer> uids = iterator.next();
for(Integer uid : uids){
MailLogic.getInstance().sendMail(uid,title,content,rewardByRank,now, Global.MAIL_EFFECTIVE_TIME);
for (Set<Integer> uids : members.values()) {
for (Integer uid : uids) {
MailLogic.getInstance().sendMail(uid, title, content, rewardByRank, now, Global.MAIL_EFFECTIVE_TIME);
}
}
delKeys.add( RankEnum.toRank(RankEnum.GUILD_BOSS_RANK.getType()).getRedisKey() + rkey);
@ -1304,8 +1278,7 @@ public class GuildFightLogic {
}
LOGGER.info("minuteCheckForCarFight 当前状态=>{}", carProgressTmp);
if(carProgressTmp!=carProgress){
int battleStartTime = 0;
int grapStartTime = 0;
int battleStartTime,grapStartTime;
if(sourceCompare>grapCompaeEnd){
calendar.setTimeInMillis(calendar.getTimeInMillis() + 24*3600*1000L);
}

View File

@ -52,7 +52,7 @@ public class FightUtil {
for (int i = 1; i <= 4; i++) {
map.put(i, buffIds);
}
return getFightTeamInfoWithSomeBuff(player, teamId, attackBloodMap, map);
return getFightTeamInfoWithSomeBuff(player, teamId, map);
}
if (attackBloodMap == null || attackBloodMap.isEmpty()) {
return BehaviorUtil.getFightTeamInfo(player, teamId, true);
@ -60,12 +60,12 @@ public class FightUtil {
return getFightTeamInfo(player, teamId, attackBloodMap);
}
public static CommonProto.FightTeamInfo makePersonFightDataWithDouble(User player, int teamId, Map<String, Double> attackBloodMap) {
if (attackBloodMap == null || attackBloodMap.isEmpty()) {
return BehaviorUtil.getFightTeamInfo(player, teamId, true);
}
return getFightTeamInfoWithDouble(player, teamId, attackBloodMap);
}
// public static CommonProto.FightTeamInfo makePersonFightDataWithDouble(User player, int teamId, Map<String, Double> attackBloodMap) {
// if (attackBloodMap == null || attackBloodMap.isEmpty()) {
// return BehaviorUtil.getFightTeamInfo(player, teamId, true);
// }
// return getFightTeamInfoWithDouble(player, teamId, attackBloodMap);
// }
public static CommonProto.FightTeamInfo makeFightWithSnapData(DefFightSnapData defFightSnapData) throws Exception {
@ -95,6 +95,10 @@ public class FightUtil {
//防守方是怪物
public static List<CommonProto.FightTeamInfo> makeMonsterFightData(int bossGroupId, int nums, Map<Integer, List<Long>> monsterHp) {
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = makeMonsterGroup(bossGroupId, monsterHp);
return getFightTeamInfos(bossGroupId, nums, monsterByGroup);
}
public static List<CommonProto.FightTeamInfo> getFightTeamInfos(int bossGroupId, int nums, Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup) {
List<CommonProto.FightUnitInfo> monsterPokemonByGroup = MonsterUtil.getMonsterPokemonByGroup(bossGroupId);
List<CommonProto.FightTeamInfo> monsterTeamList = new ArrayList<>(nums);
for (int i = 0; i < nums; i++) {
@ -145,7 +149,7 @@ public class FightUtil {
public static FightResult getFightForPVP(FightEvent fightEvent, int seed) throws Exception {
PVPFightEvent pvpFightEvent = (PVPFightEvent) fightEvent;
CommonProto.FightTeamInfo fightTeamInfo = null;
CommonProto.FightTeamInfo deffightTeamInfo = null;
CommonProto.FightTeamInfo deffightTeamInfo;
if (pvpFightEvent.getAttackFightSnapData() != null) {
fightTeamInfo = makeFightWithSnapData(pvpFightEvent.getAttackFightSnapData());
}
@ -180,7 +184,7 @@ public class FightUtil {
} else {
getFightData = FightDataUtil.getFinalPlayerFightData(fightTeamInfo, deffightTeamInfo);
}
LuaValue getOptionData = FightDataUtil.getOptionData(pvpFightEvent.getAttackUid() + "");
LuaValue getOptionData = FightDataUtil.getOptionData(String.valueOf(pvpFightEvent.getAttackUid()));
long[] fightResult = CheckFight.getInstance().checkFight(seed, fightEvent.getMostTime(), getFightData, getOptionData, fightEvent.getFightType().getFightType());
FightResult.Builder builder = FightResult.newBuilder();
@ -203,14 +207,6 @@ public class FightUtil {
/**
* pvp
* @param attackId
* @param defendId
* @param attackTeam
* @param defendTeam
* @param fightType
* @param mostTime
* @return
* @throws Exception
*/
public static FightResult getCrossFightForPVP(int attackId, int defendId, int attackTeam, int defendTeam, FightType fightType, int mostTime) throws Exception {
CSPlayer mePlayer = CrossServiceLogic.getPlayerByRedis(attackId);
@ -356,23 +352,31 @@ public class FightUtil {
StringBuilder skillSb = new StringBuilder();
StringBuilder propertySb = new StringBuilder();
String heroSkill = HeroLogic.getInstance().getHeroSkills(user, hero, skillSb).toString();
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero.getPropertyId(), hero.getLevel(user.getHeroManager()), heroAttributeMap).toString();
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
.newBuilder()
.setUnitId(Integer.toString(hero.getTemplateId()))
.setUnitSkillIds(heroSkill.substring(0, heroSkill.length() - 1))
.setProperty(property.substring(0, property.length() - 1))
.setStar(hero.getStar())
.setPosition(teamPosHeroInfo.getPosition())
.setSkinId(hero.getSkin())
.setGodSoulLv(hero.getGodSoulLv())
.setPropertyId(hero.getPropertyId())
.build();
heroFightInfos.add(heroFightInfo);
getHeroPropertyBuid(user, heroFightInfos, teamPosHeroInfo, hero, heroAttributeMap, propertySb, heroSkill);
}
return HeroLogic.getInstance().combinationFightTeam(user,teamId,heroFightInfos);
}
private static void getHeroPropertyBuid(User user, List<CommonProto.FightUnitInfo> heroFightInfos, TeamPosHeroInfo teamPosHeroInfo, Hero hero, Map<Integer, Long> heroAttributeMap, StringBuilder propertySb, String heroSkill) {
getHeroPropertyBuid2(heroFightInfos, teamPosHeroInfo, hero, heroAttributeMap, propertySb, heroSkill, hero.getLevel(user.getHeroManager()), hero.getStar(), hero.getGodSoulLv());
}
private static void getHeroPropertyBuid2(List<CommonProto.FightUnitInfo> heroFightInfos, TeamPosHeroInfo teamPosHeroInfo, Hero hero, Map<Integer, Long> heroAttributeMap, StringBuilder propertySb, String heroSkill, int level, int star, int godSoulLv) {
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero.getPropertyId(), level, heroAttributeMap).toString();
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
.newBuilder()
.setUnitId(Integer.toString(hero.getTemplateId()))
.setUnitSkillIds(heroSkill.substring(0, heroSkill.length() - 1))
.setProperty(property.substring(0, property.length() - 1))
.setStar(star)
.setPosition(teamPosHeroInfo.getPosition())
.setSkinId(hero.getSkin())
.setGodSoulLv(godSoulLv)
.setPropertyId(hero.getPropertyId())
.build();
heroFightInfos.add(heroFightInfo);
}
private static CommonProto.FightTeamInfo getEndlessTeam(User user, int teamId, Map<String, Integer> attackBloodMap) {
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
@ -414,29 +418,17 @@ public class FightUtil {
if (attackBloodMap.containsKey(teamPosHeroInfo.getHeroId())) {
heroAttributeMap.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId()) - attackBloodMap.get(teamPosHeroInfo.getHeroId()) * heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId()) / 100);
}
StringBuilder skillSb = new StringBuilder();
StringBuilder stringBuilder = new StringBuilder();
StringBuilder propertySb = new StringBuilder();
String heroSkill = HeroLogic.getInstance().getHeroSkills(user, hero, skillSb).toString();
String heroSkill = HeroLogic.getInstance().getHeroSkills(user, hero, stringBuilder).toString();
heroSkill = heroSkill + moraleSkillBuilder;
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero.getPropertyId(), hero.getLevel(user.getHeroManager()), heroAttributeMap).toString();
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
.newBuilder()
.setUnitId(Integer.toString(hero.getTemplateId()))
.setUnitSkillIds(heroSkill.substring(0, heroSkill.length() - 1))
.setProperty(property.substring(0, property.length() - 1))
.setStar(hero.getStar())
.setPosition(teamPosHeroInfo.getPosition())
.setSkinId(hero.getSkin())
.setGodSoulLv(hero.getGodSoulLv())
.setPropertyId(hero.getPropertyId())
.build();
heroFightInfos.add(heroFightInfo);
getHeroPropertyBuid(user, heroFightInfos, teamPosHeroInfo, hero, heroAttributeMap, propertySb, heroSkill);
}
return HeroLogic.getInstance().combinationFightTeam(user,teamId,heroFightInfos);
}
//
public static CommonProto.FightTeamInfo getFightTeamInfoWithSomeBuff(User user, int teamId, Map<String, Integer> attackBloodMap, Map<Integer, List<Integer>> buffInfo) {
public static CommonProto.FightTeamInfo getFightTeamInfoWithSomeBuff(User user, int teamId, Map<Integer, List<Integer>> buffInfo) {
user.getTeamPosManager().setCurTeamPosId(teamId);
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
@ -472,53 +464,51 @@ public class FightUtil {
/**
* FightUnitInfo
*
* @param attackBloodMap double
* attackBloodMap double
*/
private static CommonProto.FightTeamInfo getFightTeamInfoWithDouble(User user, int teamId, Map<String, Double> attackBloodMap) {
user.getTeamPosManager().setCurTeamPosId(teamId);
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
Hero hero = user.getHeroManager().getHero(teamPosHeroInfo.getHeroId());
if (hero == null) {
continue;
}
Map<Integer, Long> heroAttributeMap = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, teamId);
if (attackBloodMap.containsKey(teamPosHeroInfo.getHeroId())) {
heroAttributeMap.put(HeroAttributeEnum.CurHP.getPropertyId(), (long) (attackBloodMap.getOrDefault(teamPosHeroInfo.getHeroId(), 1d) * heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId())));
}
StringBuilder skillSb = new StringBuilder();
StringBuilder propertySb = new StringBuilder();
String heroSkill = HeroLogic.getInstance().getHeroSkills(user, hero, skillSb).toString();
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero.getPropertyId(), hero.getLevel(user.getHeroManager()), heroAttributeMap).toString();
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
.newBuilder()
.setUnitId(Integer.toString(hero.getTemplateId()))
.setUnitSkillIds(heroSkill.substring(0, heroSkill.length() - 1))
.setProperty(property.substring(0, property.length() - 1))
.setPosition(teamPosHeroInfo.getPosition())
.setStar(hero.getStar())
.build();
heroFightInfos.add(heroFightInfo);
}
return HeroLogic.getInstance().combinationFightTeam(user,teamId,heroFightInfos);
}
// private static CommonProto.FightTeamInfo getFightTeamInfoWithDouble(User user, int teamId, Map<String, Double> attackBloodMap) {
// user.getTeamPosManager().setCurTeamPosId(teamId);
// List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
// List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
// for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
// Hero hero = user.getHeroManager().getHero(teamPosHeroInfo.getHeroId());
// if (hero == null) {
// continue;
// }
// Map<Integer, Long> heroAttributeMap = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, teamId);
// if (attackBloodMap.containsKey(teamPosHeroInfo.getHeroId())) {
// heroAttributeMap.put(HeroAttributeEnum.CurHP.getPropertyId(), (long) (attackBloodMap.getOrDefault(teamPosHeroInfo.getHeroId(), 1d) * heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId())));
// }
// StringBuilder skillSb = new StringBuilder();
// StringBuilder propertySb = new StringBuilder();
// String heroSkill = HeroLogic.getInstance().getHeroSkills(user, hero, skillSb).toString();
// String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero.getPropertyId(), hero.getLevel(user.getHeroManager()), heroAttributeMap).toString();
// CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
// .newBuilder()
// .setUnitId(Integer.toString(hero.getTemplateId()))
// .setUnitSkillIds(heroSkill.substring(0, heroSkill.length() - 1))
// .setProperty(property.substring(0, property.length() - 1))
// .setPosition(teamPosHeroInfo.getPosition())
// .setStar(hero.getStar())
// .build();
// heroFightInfos.add(heroFightInfo);
// }
// return HeroLogic.getInstance().combinationFightTeam(user,teamId,heroFightInfos);
// }
private static CommonProto.FightTeamInfo getRobotFightTeamInfo(SArenaRobotConfig sArenaRobotConfig) {
return getRobotFightTeamInfo(sArenaRobotConfig, null);
}
private static CommonProto.FightTeamInfo getRobotFightTeamInfo(SArenaRobotConfig sArenaRobotConfig, Map<String, Double> remainHp) {
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
Map<Integer, CommonProto.Hero> heroMapList = sArenaRobotConfig.getHeroMapList();
return getFightTeamInfo(sArenaRobotConfig, heroFightInfos, heroMapList);
}
private static CommonProto.FightTeamInfo getFightTeamInfo(SArenaRobotConfig sArenaRobotConfig, List<CommonProto.FightUnitInfo> heroFightInfos, Map<Integer, CommonProto.Hero> heroMapList) {
int i = 0;
for (Map.Entry<Integer, CommonProto.Hero> item : heroMapList.entrySet()) {
StringBuilder skillSb = new StringBuilder();
StringBuilder propertySb = new StringBuilder();
Integer heroTid = item.getKey();
Integer heroStar = item.getValue().getStar();
int heroStar = item.getValue().getStar();
SCHero scHero = SCHero.getsCHero().get(heroTid);
List<Integer> skillIds = scHero.getSkillListByStar(heroStar);
String heroSkill = HeroLogic.getInstance().getRobotHeroSkills(skillIds, skillSb).toString();
@ -528,9 +518,9 @@ public class FightUtil {
int robotLevel = sArenaRobotConfig.getRoleLv();
Map<Integer, Long> robotHeroAttribute = HeroLogic.getInstance().calRobotHeroAttribute(scHero, robotLevel, 0, differDemonsId, differDemonsLv, false);
if (remainHp != null && remainHp.containsKey(heroTid.toString())) {
robotHeroAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(), (long) (remainHp.getOrDefault(heroTid.toString(), 1d) * robotHeroAttribute.get(HeroAttributeEnum.Hp.getPropertyId())));
}
// if (remainHp != null && remainHp.containsKey(heroTid.toString())) {
// robotHeroAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(), (long) (remainHp.getOrDefault(heroTid.toString(), 1d) * robotHeroAttribute.get(HeroAttributeEnum.Hp.getPropertyId())));
// }
String property = HeroLogic.getInstance().getRobotHeroProperty(sArenaRobotConfig, scHero, propertySb, robotHeroAttribute).toString();
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
@ -548,18 +538,11 @@ public class FightUtil {
return CommonProto.FightTeamInfo.
newBuilder()
.addAllFightUnitList(heroFightInfos)
// .addAllPokemonUnitList(HeroLogic.getInstance().getPokemonSkills(user))
.setTeamPassiveList(HeroLogic.getInstance().getRobotPokenmonPassiveSkills(sArenaRobotConfig))
.setForceScore(sArenaRobotConfig.getTotalForce())
.build();
}
/**
* @param sArenaRobotConfig
* @param
* @return
*/
public static CommonProto.FightTeamInfo getYxldRobotFightTeamInfo(SArenaRobotConfig sArenaRobotConfig, int type) {
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
Map<Integer, CommonProto.Hero> heroMapList;
@ -570,54 +553,12 @@ public class FightUtil {
} else {
heroMapList = sArenaRobotConfig.getHeroMapList();
}
int i = 0;
for (Map.Entry<Integer, CommonProto.Hero> item : heroMapList.entrySet()) {
StringBuilder skillSb = new StringBuilder();
StringBuilder propertySb = new StringBuilder();
Integer heroTid = item.getKey();
Integer heroStar = item.getValue().getStar();
SCHero scHero = SCHero.getsCHero().get(heroTid);
List<Integer> skillIds = scHero.getSkillListByStar(heroStar);
String heroSkill = HeroLogic.getInstance().getRobotHeroSkills(skillIds, skillSb).toString();
int[] differDemonsId = sArenaRobotConfig.getDifferDemonsId();
int differDemonsLv = sArenaRobotConfig.getDifferDemonsLv();
int robotLevel = sArenaRobotConfig.getRoleLv();
Map<Integer, Long> robotHeroAttribute = HeroLogic.getInstance().calRobotHeroAttribute(scHero, robotLevel, 0, differDemonsId, differDemonsLv, false);
/*if(remainHp!=null&&remainHp.containsKey(heroTid.toString())){
robotHeroAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(),(long)(remainHp.getOrDefault(heroTid.toString(),1d)*robotHeroAttribute.get(HeroAttributeEnum.Hp.getPropertyId())));
}
*/
String property = HeroLogic.getInstance().getRobotHeroProperty(sArenaRobotConfig, scHero, propertySb, robotHeroAttribute).toString();
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
.newBuilder()
.setUnitId(Integer.toString(heroTid))
.setUnitSkillIds(heroSkill.substring(0, heroSkill.length() - 1))
.setProperty(property.substring(0, property.length() - 1))
.setPosition(++i)
.setStar(heroStar)
.setPropertyId(item.getValue().getPropertyId())
.build();
heroFightInfos.add(heroFightInfo);
}
return CommonProto.FightTeamInfo.
newBuilder()
.addAllFightUnitList(heroFightInfos)
// .addAllPokemonUnitList(HeroLogic.getInstance().getPokemonSkills(user))
.setTeamPassiveList(HeroLogic.getInstance().getRobotPokenmonPassiveSkills(sArenaRobotConfig))
.setForceScore(sArenaRobotConfig.getTotalForce())
.build();
return getFightTeamInfo(sArenaRobotConfig, heroFightInfos, heroMapList);
}
/**
* id
*
* @param uid
* @param fightType
* @return
*/
public static String getFightId(int uid, GameFightType fightType) {
return uid + "_"
@ -634,11 +575,7 @@ public class FightUtil {
}
/**
*
*
* @param heroTid
* @param level
* @return
*
*/
public static RobotInfo createRobot(int heroTid, int level) {
RobotInfo robotInfo = new RobotInfo();
@ -656,7 +593,7 @@ public class FightUtil {
//TODO 规范这个参数
public static CommonProto.FightTeamInfo makeCrossPersonData(CSPlayer csPlayer, int teamId, ArenaRecord arenaRecord, CrossArenaManager crossArenaManager) throws Exception {
public static CommonProto.FightTeamInfo makeCrossPersonData(CSPlayer csPlayer, int teamId, ArenaRecord arenaRecord) {
if (csPlayer == null) {
return null;//throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
@ -696,10 +633,6 @@ public class FightUtil {
/**
*
* @param user
* @param teamId
* @param attackBloodMap
* @return
*/
public static CommonProto.FightTeamInfo getYuxuTeam(User user, int teamId, Map<String, Integer> attackBloodMap,ArenaRecord arenaRecord) {
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
@ -729,22 +662,10 @@ public class FightUtil {
heroAttributeMap.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId()) - attackBloodMap.get(teamPosHeroInfo.getHeroId()) * heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId()) / 100);
}
heroAttributeMap.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAttributeMap.get(GlobalsDef.HP_TYPE));
StringBuilder skillSb = new StringBuilder();
StringBuilder stringBuilder = new StringBuilder();
StringBuilder propertySb = new StringBuilder();
String heroSkill = HeroLogic.getInstance().getYuxuHeroSkills(user, hero, yuxuHero,skillSb).toString();
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero.getPropertyId(), yuxuHero.getLevel(user.getHeroManager()), heroAttributeMap).toString();
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
.newBuilder()
.setUnitId(Integer.toString(hero.getTemplateId()))
.setUnitSkillIds(heroSkill.substring(0, heroSkill.length() - 1))
.setProperty(property.substring(0, property.length() - 1))
.setStar(yuxuHero.getStar())
.setPosition(teamPosHeroInfo.getPosition())
.setSkinId(hero.getSkin())
.setGodSoulLv(yuxuHero.getGodSoulLv())
.setPropertyId(hero.getPropertyId())
.build();
heroFightInfos.add(heroFightInfo);
String heroSkill = HeroLogic.getInstance().getYuxuHeroSkills(user, hero, yuxuHero,stringBuilder).toString();
getHeroPropertyBuid2(heroFightInfos, teamPosHeroInfo, hero, heroAttributeMap, propertySb, heroSkill, yuxuHero.getLevel(user.getHeroManager()), yuxuHero.getStar(), yuxuHero.getGodSoulLv());
}
//玉虚不继承任何英雄外的技能
return CommonProto.FightTeamInfo.
@ -758,15 +679,10 @@ public class FightUtil {
}
/**
*
* @param csPlayer
* @param crossArenaManager
* @param teamId
* @param attackBloodMap
* @return
*
*/
public static CommonProto.FightTeamInfo getCrossYuxuTeam(CSPlayer csPlayer,CrossArenaManager crossArenaManager,
int teamId,Map<String, Integer> attackBloodMap,ArenaRecord arenaRecord) {
public static CommonProto.FightTeamInfo getCrossYuxuTeam(CrossArenaManager crossArenaManager,
int teamId, Map<String, Integer> attackBloodMap, ArenaRecord arenaRecord) {
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
if(arenaRecord != null){
int addforcerpc = crossArenaManager.getTotalForceByTeam().getOrDefault(teamId,0);
@ -776,7 +692,7 @@ public class FightUtil {
List<com.ljsd.jieling.thrift.idl.TeamPosHeroInfo> teamPosHeroInfos = crossArenaManager.getTeams().getOrDefault(teamId, new ArrayList<>());
for (com.ljsd.jieling.thrift.idl.TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
com.ljsd.jieling.thrift.idl.ArenaOfHero hero = crossArenaManager.getHeros().get(teamPosHeroInfo.getHeroId());
if (hero == null) {
if (hero == null){
continue;
}
//玉虚英雄取通用属性
@ -794,9 +710,9 @@ public class FightUtil {
heroAttributeMap.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId()) - attackBloodMap.get(teamPosHeroInfo.getHeroId()) * heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId()) / 100);
}
heroAttributeMap.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAttributeMap.get(GlobalsDef.HP_TYPE));
StringBuilder propertySb = new StringBuilder();
String heroSkill = HeroLogic.getInstance().getCrossYuxuHeroSkills(crossArenaManager,hero,yuxuHero).toString();
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero.getPropertyId(), yuxuHero.getYuXuLevel(), heroAttributeMap).toString();
StringBuilder stringBuilder = new StringBuilder();
String heroSkill = HeroLogic.getInstance().getCrossYuxuHeroSkills(hero,yuxuHero).toString();
String property = HeroLogic.getInstance().getHeroPropertyBuilder(stringBuilder, hero.getPropertyId(), yuxuHero.getYuXuLevel(), heroAttributeMap).toString();
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
.newBuilder()
.setUnitId(Integer.toString(hero.getTemplateId()))
@ -822,12 +738,6 @@ public class FightUtil {
/**
*
* @param csPlayer
* @param teamId
* @param arenaRecord
* @param crossArenaManager
* @return
* @throws Exception
*/
public static CommonProto.FightTeamInfo makeYuxuCrossPersonData(CSPlayer csPlayer, int teamId, ArenaRecord arenaRecord, CrossArenaManager crossArenaManager) throws Exception {
if (csPlayer == null) {
@ -843,6 +753,6 @@ public class FightUtil {
LOGGER.error("Exception::=>{}", "rpc data is empty");
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
return getCrossYuxuTeam(csPlayer,crossArenaManager,teamId,null,arenaRecord);
return getCrossYuxuTeam(crossArenaManager,teamId,null,arenaRecord);
}
}

View File

@ -1,7 +1,6 @@
package com.ljsd.jieling.logic.fight.eventhandler;
import com.ljsd.fight.CheckFight;
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
import com.ljsd.jieling.logic.activity.fourChallenge.FourChallengeLogic;
import com.ljsd.jieling.logic.dao.Hero;
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
@ -15,8 +14,10 @@ import com.ljsd.jieling.logic.help.HelpHero;
import com.ljsd.jieling.logic.help.HelpHeroLogic;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.util.FightDataUtil;
import com.ljsd.jieling.util.MonsterUtil;
import config.*;
import config.SCHero;
import config.SQijieHolyConfig;
import config.SQijieStage;
import config.SQijieStageBuff;
import manager.STableManager;
import org.luaj.vm2.LuaValue;
import org.slf4j.Logger;
@ -179,13 +180,7 @@ public class SevenWorldFightHandler implements IFightEventProcesor {
monsterByGroup.clear();
monsterByGroup = null;
// 灵兽
List<CommonProto.FightUnitInfo> monsterPokemonByGroup = MonsterUtil.getMonsterPokemonByGroup(monsterGroup);
List<CommonProto.FightTeamInfo> monsterTeamList = new ArrayList<>(nums);
for(int i=0;i<nums;i++){
List<CommonProto.FightTeamInfo> monsterGroupList = BehaviorUtil.getFightTeamInfos(map,monsterPokemonByGroup,i);
monsterTeamList.addAll(monsterGroupList);
}
return monsterTeamList;
return FightUtil.getFightTeamInfos(monsterGroup, nums, map);
}
/**

View File

@ -45,7 +45,6 @@ import com.ljsd.jieling.logic.redpacket.WelfareRedPacketType;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.logic.store.newRechargeInfo.PushRechargeType;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.thrift.idl.CrossArenaManager;
import com.ljsd.jieling.util.CBean2Proto;
import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.MessageUtil;
@ -65,6 +64,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
@SuppressWarnings({"DanglingJavadoc", "JavadocDeclaration", "CommentedOutCode", "unused"})
public class HeroLogic {
private static final Logger LOGGER = LoggerFactory.getLogger(HeroLogic.class);
@ -157,10 +157,6 @@ public class HeroLogic {
/**
*
*
* @param iSession
* @param index
* @param type
* @throws Exception
*/
public void getAllEquipInfo(ISession iSession, int index, int type) throws Exception {
int uid = iSession.getUid();
@ -394,10 +390,6 @@ public class HeroLogic {
/**
*
*
* @param user
* @param sLotteryRewardConfig
* @param sLotterySetting
* @return
*/
private int[] drawCard(User user, SLotteryRewardConfig sLotteryRewardConfig, SLotterySetting sLotterySetting) throws Exception {
HeroManager heroManager = user.getHeroManager();
@ -408,7 +400,7 @@ public class HeroLogic {
int value = SSpecialConfig.getIntegerValue(SSpecialConfig.UNLOCKCARDWISH);
// 对应卡池抽奖次数
Integer num = heroManager.getRandomCountByType().getOrDefault(type, 0);
int[] result = null;
int[] result;
// 抽卡逻辑
if (isActivityByIdAndType(sLotterySetting.getActivityId(), ActivityType.BEAUTY_BAG)) {
// 乾坤宝盒-许愿魂印
@ -475,7 +467,7 @@ public class HeroLogic {
}
///天地洪炉抽奖处理
private int[] TrumpGachaDrawCard(User user, SLotteryRewardConfig sLotteryRewardConfig) throws Exception {
private int[] TrumpGachaDrawCard(User user, SLotteryRewardConfig sLotteryRewardConfig) {
int count = 4;
List<SLotteryRewardConfig> list = SLotteryRewardConfig.getSLotteryRewardConfigListByPoolId(sLotteryRewardConfig.getPool());
if (list == null) {
@ -521,10 +513,6 @@ public class HeroLogic {
/**
*
*
* @param user
* @param item
* @return
*/
private int[] wishDrawCardCheck(User user, int[] item, int type) {
// 查找物品
@ -700,21 +688,20 @@ public class HeroLogic {
/**
*
*
* @return
*/
public int getServerOpenTimeByWishCard() {
// 开服时间
long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
// 根据格式获取时间戳 例子 20210720
int value = SSpecialConfig.getIntegerValue(SSpecialConfig.Data_Of_Unlock_All_Wish_Hero);
long time = TimeUtils.stringToTimeLong3(String.valueOf(value), TimeUtils.ymdFormat);
// 规定时间之前开服的返回0
if (openTime <= time) {
return 0;
} else {
return (int) (openTime / 1000);
}
}
// public int getServerOpenTimeByWishCard() {
// // 开服时间
// long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
// // 根据格式获取时间戳 例子 20210720
// int value = SSpecialConfig.getIntegerValue(SSpecialConfig.Data_Of_Unlock_All_Wish_Hero);
// long time = TimeUtils.stringToTimeLong3(String.valueOf(value), TimeUtils.ymdFormat);
// // 规定时间之前开服的返回0
// if (openTime <= time) {
// return 0;
// } else {
// return (int) (openTime / 1000);
// }
// }
///灵兽抽奖替换高级奖励
private void changeRandomItem(User user, int activityId, int[][] random) {
@ -830,9 +817,6 @@ public class HeroLogic {
/**
*
*
* @param user
* @param list
* @throws ErrorCodeException
*/
public void updateBeautyBagCardInfo(User user, List<CommonProto.beautyBagCardInfo> list) throws ErrorCodeException {
HashMap<Integer, Integer> map = new HashMap<>();
@ -865,10 +849,6 @@ public class HeroLogic {
/**
*
*
* @param user
* @param type
* @return
* @throws Exception
*/
public static int randomOne(User user, int type) throws Exception {
SLotterySetting sLotterySetting = STableManager.getConfig(SLotterySetting.class).get(type);
@ -951,8 +931,10 @@ public class HeroLogic {
sLotteryRewardConfig = randomHeroByPoolId(onConfig.getpool_id(), user);
currStarId = maxId;
}
if (sLotteryRewardConfig == null){
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE);
}
if (randomPoolByType.get(mergePool) != null) {
for (int key : randomPoolByType.get(mergePool).keySet()) {
//如果生效次数是0可重置
List<SLotterySpecialConfig> lotteryListByDifferentType = SLotterySpecialConfig.getLotteryListByDifferentType(key);
@ -972,52 +954,50 @@ public class HeroLogic {
return result;
}
private int getSpecialPoolByRandcount(SLotterySetting sLotterySetting, int randCount, int poolCount) {
int id = sLotterySetting.getId();
List<SLotterySpecialConfig> list = SLotterySpecialConfig.getLotterySpecialConfigListByType(id);
// private int getSpecialPoolByRandcount(SLotterySetting sLotterySetting, int randCount, int poolCount) {
// int id = sLotterySetting.getId();
// List<SLotterySpecialConfig> list = SLotterySpecialConfig.getLotterySpecialConfigListByType(id);
//
// if (list == null) {
// list = SLotterySpecialConfig.getLotterySpecialConfigListByType(sLotterySetting.getMergePool());
// if (list == null) {
// return 0;
// }
// }
// int poolId = 0;
// for (SLotterySpecialConfig data : list) {
// int n;
// if (data.getDifferentType() == 2) {
// if (poolCount % data.getCount() != 0) {
// continue;
// }
// n = poolCount / data.getCount();
// } else {
// if (randCount % data.getCount() != 0) {
// continue;
// }
// n = randCount / data.getCount();
// }
// if (n < data.getMin_num()) {
// continue;
// }
// if (data.getMax_num() == 0 || n <= data.getMax_num()) {
// poolId = data.getpool_id();
// break;
// }
// }
// return poolId;
// }
if (list == null) {
list = SLotterySpecialConfig.getLotterySpecialConfigListByType(sLotterySetting.getMergePool());
if (list == null) {
return 0;
}
}
int poolId = 0;
for (SLotterySpecialConfig data : list) {
int n;
if (data.getDifferentType() == 2) {
if (poolCount % data.getCount() != 0) {
continue;
}
n = poolCount / data.getCount();
} else {
if (randCount % data.getCount() != 0) {
continue;
}
n = randCount / data.getCount();
}
if (n < data.getMin_num()) {
continue;
}
if (data.getMax_num() == 0 || n <= data.getMax_num()) {
poolId = data.getpool_id();
break;
}
}
return poolId;
}
private static int getPooId(SLotterySetting sLotterySetting) throws Exception {
private static int getPooId(SLotterySetting sLotterySetting) {
int[][] diamondBoxContain = sLotterySetting.getDiamondBoxContain();
int totalWeight = 0;
for (int i = 0; i < diamondBoxContain.length; i++) {
int[] poolWeightInfo = diamondBoxContain[i];
for (int[] poolWeightInfo : diamondBoxContain) {
totalWeight += poolWeightInfo[1];
}
int randWeight = MathUtils.randomInt(totalWeight) + 1;
int weight = 0;
for (int i = 0; i < diamondBoxContain.length; i++) {
int[] poolWeightInfo = diamondBoxContain[i];
for (int[] poolWeightInfo : diamondBoxContain) {
weight += poolWeightInfo[1];
if (randWeight <= weight) {
return poolWeightInfo[0];
@ -1426,10 +1406,6 @@ public class HeroLogic {
/**
* ======
*
* @param session
* @param heroId
* @param consumeMaterialsList
* @throws Exception
*/
public void upHeroStar(ISession session, String heroId, List<HeroInfoProto.ConsumeMaterial> consumeMaterialsList) throws Exception {
int uid = session.getUid();
@ -1652,9 +1628,6 @@ public class HeroLogic {
/**
* 鸿
* @param user
* @param hero
* @return
*/
private boolean upStarVerifyHomgmeng(User user, Hero hero){
// 英雄配置表信息
@ -1668,7 +1641,7 @@ public class HeroLogic {
return true;
}
HeroManager heroManager = user.getHeroManager();
int hongmengLevel = 0;
int hongmengLevel;
// 鸿蒙碑开启,读取鸿蒙碑等级
if (heroManager.getHongmengTablet() > 0){
hongmengLevel = heroManager.getHongmengTablet();
@ -1684,10 +1657,6 @@ public class HeroLogic {
/**
*
*
* @param type
* @param itemCamp
* @param itemId
* @return
*/
private boolean upStartItemCamp(int type, int[][] itemCamp, int itemId) {
for (int[] ints : itemCamp) {
@ -1699,7 +1668,7 @@ public class HeroLogic {
}
private void rankUpHeroExecute(User user,Hero hero) throws Exception {
private void rankUpHeroExecute(User user,Hero hero) {
//是否解锁法宝
SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
int[][] equipTalismanaUnlock = gameSetting.getEquipTalismanaUnlock();
@ -1720,6 +1689,7 @@ public class HeroLogic {
//初始属性*1+化境增长)*等级系数 + 初始属性*突破系数
@SuppressWarnings("OptionalGetWithoutIsPresent")
private Map<Integer, Long> calHeroAllAttribute(User user, Hero hero, boolean isForce) {
Map<Integer, Long> result = new HashMap<>();
int templateId = hero.getTemplateId();
@ -1759,7 +1729,8 @@ public class HeroLogic {
return result;
}
private Map<Integer, Long> calRobotHeroAllAttribute(int templateId, int heroLevl, int heroBreakId, boolean isForce) {
@SuppressWarnings("OptionalGetWithoutIsPresent")
private Map<Integer, Long> calRobotHeroAllAttribute(int templateId, int heroLevl, boolean isForce) {
Map<Integer, Long> result = new HashMap<>();
SCHero scHero = SCHero.getsCHero().get(templateId);
SHeroLevlConfig sHeroLevlConfig = SHeroLevlConfig.getsCHero().get(heroLevl);
@ -1799,9 +1770,6 @@ public class HeroLogic {
/**
* starBreaklId
* @param heroTid
* @param heroLevel
* @return
*/
public int calRobotStarBreakByLevel(int heroTid, int heroLevel) {
// 获取原始星级
@ -1827,9 +1795,6 @@ public class HeroLogic {
/**
* BreaklId
* @param heroTid
* @param heroLevel
* @return
*/
public int calRobotBreakByLevel(int heroTid, int heroLevel) {
// 初始等级
@ -1853,9 +1818,6 @@ public class HeroLogic {
/**
*
*
* @param heroTid
* @param heroLevel
* @return
*/
public int calRobotStarByLevel(int heroTid, int heroLevel) {
SCHero scHero = SCHero.getsCHero().get(heroTid);
@ -1892,10 +1854,6 @@ public class HeroLogic {
/**
*
* @param heroLevel
* @param type
* @param star
* @return
*/
private int calRobotIdByLevel(int heroLevel, int type, int star){
// 突破,根据初始星级获取不同分区
@ -2029,15 +1987,11 @@ public class HeroLogic {
//魂印
Map<Integer, Integer> soulEquipByPositionMap = heroVo.getSoulEquipByPositionMap();
soulEquipByPositionMap.values().forEach(e -> {
Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add);
});
soulEquipByPositionMap.values().forEach(e -> Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add));
//神印
Map<Integer, Integer> godSealByPositionMap = heroVo.getGodSealByPositionMap();
godSealByPositionMap.values().forEach(e -> {
Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add);
});
godSealByPositionMap.values().forEach(e -> Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add));
//法相
Map<String, Faxiang> faxiangMap = heroVo.getFaxiangMap();
@ -2514,7 +2468,7 @@ public class HeroLogic {
.addAllFightUnitList(heroFightInfos)
.addAllPokemonUnitList(HeroLogic.getInstance().getPokemonSkills(user))
.addAllMagicSoldierList(HeroLogic.getInstance().getMagicSolderSkills(user))
.setTeamPassiveList(HeroLogic.getInstance().getPokenmonPassiveSkills(user, teamId))
.setTeamPassiveList("")
.setSpecialPassive(SpecialForTeamBuildEnum.toParm(teamId, user))
.setForceScore(HeroLogic.getInstance().calTeamForce(user,teamId))
.build();
@ -2965,7 +2919,7 @@ public class HeroLogic {
if (propertyItem == null) {
continue;
}
Jewel jewel = null;
Jewel jewel;
if (propertyItem instanceof Jewel){
jewel = (Jewel) propertyItem;
}else {
@ -3308,7 +3262,7 @@ public class HeroLogic {
* @param heroBrekId calRobotHeroAllAttribute使0
*/
public Map<Integer, Long> calRobotHeroAttribute(SCHero scHero, int heroLevel, int heroBrekId, int[] pokemonIds, int pokemonLevel, boolean isForce) {
Map<Integer, Long> heroAllAttribute = calRobotHeroAllAttribute(scHero.getId(), heroLevel, heroBrekId, isForce);
Map<Integer, Long> heroAllAttribute = calRobotHeroAllAttribute(scHero.getId(), heroLevel, isForce);
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAllAttribute.get(GlobalsDef.HP_TYPE));
if (pokemonIds != null) {
int profession = scHero.getProfession();
@ -3397,7 +3351,6 @@ public class HeroLogic {
heroAllAttribute.put(propertyId, (BigDecimal.valueOf(propertyValue).multiply(BigDecimal.valueOf(item.getValue()).divide(BigDecimal.valueOf(10000f))).intValue() + propertyValue));
}
Long maxHp = heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId());
Long curHp = heroAllAttribute.get(HeroAttributeEnum.CurHP.getPropertyId());
if (maxHp != null && curHp != null && curHp > maxHp) {
@ -3463,7 +3416,7 @@ public class HeroLogic {
public int calForce(Map<Integer, Long> heroAllAttribute) {
double result = 0;
double result;
float forceNum=0;//基础值
float forceAdd=0;//加成值
//战力计算
@ -3746,7 +3699,7 @@ public class HeroLogic {
int itemId = item.getItemId();
int itemNum = (int) item.getItemNum();
SItem sItem = SItem.getsItemMap().get(itemId);
if (sItem == null || itemNum <= 0 || itemNum >= Integer.MAX_VALUE) {
if (sItem == null || itemNum <= 0 || itemNum == Integer.MAX_VALUE) {
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
int composeNum = itemNum / sItem.getUsePerCount();
@ -3778,7 +3731,7 @@ public class HeroLogic {
}
public String getQuality(int natural) {
String quality = "N";
String quality;
switch (natural) {
case 2:
quality = "SR";
@ -3815,7 +3768,7 @@ public class HeroLogic {
int totalForce = 0;
targetUser.getTeamPosManager().setCurTeamPosId(teamId);
Map<Integer, List<TeamPosHeroInfo>> teamPosForHero = targetUser.getTeamPosManager().getTeamPosForHero();
if (teamPosForHero == null || teamPosForHero.size() <= 0) {
if (teamPosForHero == null || teamPosForHero.size() == 0) {
return totalForce;
}
List<TeamPosHeroInfo> teamPosHeroInfoList = teamPosForHero.get(teamId);
@ -3829,10 +3782,11 @@ public class HeroLogic {
Hero hero = targetUser.getHeroManager().getHero(teamPosHeroInfo.getHeroId());
if (hero == null) {
// 助战获取,随后最好加上编队验证
hero = HelpHeroLogic.getHelpHeroByHeroId(targetUser.getId(), teamPosHeroInfo.getHeroId()).getHero();
if (hero == null) {
HelpHero helpHero = HelpHeroLogic.getHelpHeroByHeroId(targetUser.getId(), teamPosHeroInfo.getHeroId());
if (helpHero == null || helpHero.getHero() == null){
continue;
}
hero = helpHero.getHero();
}
long force = calHeoForce(targetUser, hero, teamId);
if (maxForceHero < force) {
@ -4013,8 +3967,11 @@ public class HeroLogic {
// 基础属性
combinedAttribute(card.getPlayerPropList(), attrMap);
//等级
SChangingCardLevel cardLevel = SChangingCardLevel.getConfigByPoolId(card.getLevelUpPool()).get(level);
combinedAttribute(cardLevel.getPlayerPropList(), attrMap);
Map<Integer, SChangingCardLevel> cardLevelMap = SChangingCardLevel.getConfigByPoolId(card.getLevelUpPool());
if (cardLevelMap != null){
SChangingCardLevel cardLevel = cardLevelMap.get(level);
combinedAttribute(cardLevel.getPlayerPropList(), attrMap);
}
//星级
SChangingCardStar cardStar = SChangingCardStar.getPoolMap().get(card.getStar()).get(star);
combinedAttribute(cardStar.getPlayerPropList(), attrMap);
@ -4157,7 +4114,7 @@ public class HeroLogic {
}
//获取天赋异妖信息
public void getAllRingFire(ISession session) throws Exception {
public void getAllRingFire(ISession session) {
//todo 灵兽
// int uid = session.getUid();
// User user = UserManager.getUser(uid);
@ -4298,10 +4255,9 @@ public class HeroLogic {
throw new ErrorCodeException(ErrorCode.HERO_RETURN_CAN_NOT);
}
List<int[]> returnPercent = new ArrayList<>(5);
for (int i = 0; i < returnBook.length; i++) {
if (returnBook[i][0] == hero.getStar()) {
returnPercent.add(returnBook[i]);
continue;
for (int[] value : returnBook) {
if (value[0] == hero.getStar()) {
returnPercent.add(value);
}
}
if (returnPercent.isEmpty()) {
@ -4560,7 +4516,7 @@ public class HeroLogic {
int equipId = item.getEquipId();
int[] sign_locations = SSpecialConfig.getOnceArrayValue(SSpecialConfig.Sign_Location);
int position = item.getPosition() - 1;
if (position < 0 || position > sign_locations.length || position > sign_locations.length - 1 || userLevel < sign_locations[position]) {
if (position < 0 || position > sign_locations.length - 1 || userLevel < sign_locations[position]) {
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
}
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(equipId);
@ -4569,10 +4525,8 @@ public class HeroLogic {
}
if (sEquipConfig.getLimit() == 1) {
if (cacheIds.isEmpty()) {
heroMap.values().forEach(hero -> {
cacheIds.addAll(hero.getSoulEquipByPositionMap().values());
});
cacheIds.removeAll(unloadSoulIds);
heroMap.values().forEach(hero -> cacheIds.addAll(hero.getSoulEquipByPositionMap().values()));
unloadSoulIds.forEach(cacheIds::remove);
}
if (cacheIds.contains(equipId)) {
cacheIds.add(equipId);
@ -4584,9 +4538,7 @@ public class HeroLogic {
if (!equids.isEmpty()) {
Map<Integer, Integer> itemCost = new HashMap<>();
equids.forEach(e -> {
itemCost.put(e, 1);
});
equids.forEach(e -> itemCost.put(e, 1));
boolean b = ItemUtil.itemCost(user, itemCost, BIReason.SOUL_EQUIP_WEAR_CONSUME, targetHeroTid);
if (!b) {
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
@ -4595,9 +4547,7 @@ public class HeroLogic {
if (unload != null && !StringUtil.isEmpty(unload.getHeroId())) {
Hero hero = user.getHeroManager().getHero(unload.getHeroId());
List<HeroInfoProto.SoulEquipPos> soulEquipIdsListUnload = unload.getSoulEquipIdsList();
soulEquipIdsListUnload.forEach(e -> {
hero.removeSoulEquip(e.getPosition());
});
soulEquipIdsListUnload.forEach(e -> hero.removeSoulEquip(e.getPosition()));
}
}
@ -4611,7 +4561,6 @@ public class HeroLogic {
*/
public void margeSeal(ISession session, int targetId, List<Integer> soulIdList) throws Exception {
User user = UserManager.getUser(session.getUid());
Map<Integer, SEquipConfig> config = STableManager.getConfig(SEquipConfig.class);
CommonProto.Drop.Builder dropBuilder;
dropBuilder = mergeSoul(user, targetId, soulIdList);
HeroInfoProto.MergeSoulResponse build = HeroInfoProto.MergeSoulResponse.newBuilder().setDrop(dropBuilder).build();
@ -4637,9 +4586,7 @@ public class HeroLogic {
itemTemplateCost.put(config.get(e).getQuality(), itemTemplateCost.getOrDefault(config.get(e).getQuality(), 0) + 1);
itemReallyCost.put(e, itemReallyCost.getOrDefault(e, 0) + 1);
});
Arrays.stream(resource).forEach(item -> {
itemReallyCost.put(item[0], itemReallyCost.getOrDefault(item[0], 0) + item[1]);
});
Arrays.stream(resource).forEach(item -> itemReallyCost.put(item[0], itemReallyCost.getOrDefault(item[0], 0) + item[1]));
int[][] formula = sEquipConfig.getFormula();
for (int[] item : formula) {
@ -4684,7 +4631,7 @@ public class HeroLogic {
public static void checkAllowedOpt(int type, User user, int heroStar) throws ErrorCodeException {
SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
int[][] checkParms = null;
int[][] checkParms;
if (type == 1) {
checkParms = gameSetting.getEquipTalismanaUnlock();
} else if (type == 2) {
@ -4704,7 +4651,7 @@ public class HeroLogic {
}
//============= 灵兽(异妖)系统 ========================
public void allBookFetter(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
public void allBookFetter(ISession session) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);
EquipManager equipManager = user.getEquipManager();
@ -5627,7 +5574,7 @@ public class HeroLogic {
SCHero hero1 = SCHero.getsCHero().get(hero.getTemplateId());
int[] equipTalismana = hero1.getEquipTalismana();
// 没有法宝
if (equipTalismana == null || equipTalismana.length <= 0) {
if (equipTalismana == null || equipTalismana.length == 0) {
especialEquipLevel.value = -1;
especialEquipLevel.heroTid = 0;
return;
@ -5682,9 +5629,9 @@ public class HeroLogic {
* @param jewels
*/
private void notJewelInit(HongMengAddAttribute... jewels) {
for (int i = 0; i < jewels.length; i++) {
jewels[i].value = -1;
jewels[i].heroTid = 0;
for (HongMengAddAttribute jewel : jewels) {
jewel.value = -1;
jewel.heroTid = 0;
}
}
@ -6073,38 +6020,37 @@ public class HeroLogic {
// 记录每个英雄
Map<String, Boolean> heroMap = new HashMap<>(heroId.length);
for (int i = 0; i < heroId.length; i++) {
for (String s : heroId) {
// 属性初始化
int[] value = null;
heroMap.put(heroId[i], false);
heroMap.put(s, false);
if ("".equals(heroId[i]) || heroId[i] == null) {
heroMap.put(heroId[i], true);
if ("".equals(s) || s == null) {
heroMap.put(s, true);
continue;
}
// 鸿蒙守卫
if (heroManager.getHongmengTablet() <= 0 && heroManager.getHongmengGuards().containsValue(heroId[i])) {
if (heroManager.getHongmengTablet() <= 0 && heroManager.getHongmengGuards().containsValue(s)) {
value = SSpecialConfig.getOnceArrayValue(SSpecialConfig.HONGMENG_GUARD_LIMIT);
}
// 鸿蒙使者
if (heroManager.getHongmengTablet() > 0 && heroManager.getHongmengGuards().containsValue(heroId[i])) {
if (heroManager.getHongmengTablet() > 0 && heroManager.getHongmengGuards().containsValue(s)) {
value = SSpecialConfig.getOnceArrayValue(SSpecialConfig.HONGMENG_MESSENGER_LIMIT);
}
// 共鸣神将
if (heroManager.getResonances().containsValue(heroId[i])) {
if (heroManager.getResonances().containsValue(s)) {
value = SSpecialConfig.getOnceArrayValue(SSpecialConfig.HONGMENG_TAKE_LIMIT);
}
if (value == null) {
heroMap.put(heroId[i], true);
heroMap.put(s, true);
continue;
}
// 包含类型返回false
for (int j = 0; j < value.length; j++) {
if (value[j] == functionId) {
heroMap.put(heroId[i], true);
for (int i : value)
if (i == functionId) {
heroMap.put(s, true);
break;
}
}
}
boolean contains = heroMap.containsValue(false);
return !contains;
@ -6173,7 +6119,7 @@ public class HeroLogic {
/**
*
*/
public static void fiveStarPokemonPushByRandom(User user, int[][] getHeros) throws Exception {
public static void fiveStarPokemonPushByRandom(User user, int[][] getHeros) {
int fiveStarNum = 0;
for (int[] i : getHeros) {
SSpiritAnimal ssa = SSpiritAnimal.mapConfig.get(i[0]);
@ -6190,7 +6136,7 @@ public class HeroLogic {
/**
*
*/
public static void fiveStarPokemonPushByCombine(User user, int itemId, int num) throws Exception {
public static void fiveStarPokemonPushByCombine(User user, int itemId, int num) {
SSpiritAnimal ssa = SSpiritAnimal.mapConfig.get(itemId);
if (ssa != null && ssa.getQuality() == 5) {
Poster.getPoster().dispatchEvent(new PokemonFiveStarGetEvent(user.getId(), 5, num));
@ -6450,7 +6396,7 @@ public class HeroLogic {
SCHero hero = SCHero.getsCHero().get(heroId);
if (equip == null || hero == null){
LOGGER.error("装备神印装备ID或者英雄ID错误表内容查询失败,equip:{},hero:{}",equipId,heroId);
return result;
return false;
}
// 判断条件查表去
switch (equip.getProfessionLimit()){
@ -6581,15 +6527,11 @@ public class HeroLogic {
//魂印取统一配置
Map<Integer, Integer> soulEquipByPositionMap = yuxuHero.getSoulEquipByPositionMap();
soulEquipByPositionMap.values().forEach(e -> {
Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add);
});
soulEquipByPositionMap.values().forEach(e -> Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add));
//神印取统一配置
Map<Integer, Integer> godSealByPositionMap = yuxuHero.getGodSealByPositionMap();
godSealByPositionMap.values().forEach(e -> {
Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add);
});
godSealByPositionMap.values().forEach(e -> Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add));
//法宝技能继承真实技能
int[] equipTalismana = tempHero.getEquipTalismana();
@ -6608,13 +6550,11 @@ public class HeroLogic {
/**
* , ,
* @param crossArenaManager
* @param hero
* @param yuxuHero
* @return
*/
public List<Integer> getCrossYuxuHeroSkillList(CrossArenaManager crossArenaManager,
com.ljsd.jieling.thrift.idl.ArenaOfHero hero,Hero yuxuHero) {
public List<Integer> getCrossYuxuHeroSkillList(com.ljsd.jieling.thrift.idl.ArenaOfHero hero, Hero yuxuHero) {
List<Integer> skillList = new ArrayList<>();
SCHero tempHero = SCHero.getsCHero().get(hero.getTemplateId());
//英雄技能取统一的玉虚配置英雄
@ -6643,15 +6583,11 @@ public class HeroLogic {
//魂印取统一配置
Map<Integer, Integer> soulEquipByPositionMap = yuxuHero.getSoulEquipByPositionMap();
soulEquipByPositionMap.values().forEach(e -> {
Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add);
});
soulEquipByPositionMap.values().forEach(e -> Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add));
//神印取统一配置
Map<Integer, Integer> godSealByPositionMap = yuxuHero.getGodSealByPositionMap();
godSealByPositionMap.values().forEach(e -> {
Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add);
});
godSealByPositionMap.values().forEach(e -> Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add));
//法宝技能继承真实技能
int[] equipTalismana = tempHero.getEquipTalismana();
@ -6670,14 +6606,12 @@ public class HeroLogic {
/**
* , ,
* @param crossArenaManager
* @param hero
* @param yuxuHero
* @return
*/
public StringBuilder getCrossYuxuHeroSkills(CrossArenaManager crossArenaManager,
com.ljsd.jieling.thrift.idl.ArenaOfHero hero,Hero yuxuHero) {
List<Integer> heroSkillList = this.getCrossYuxuHeroSkillList(crossArenaManager,hero,yuxuHero);
public StringBuilder getCrossYuxuHeroSkills(com.ljsd.jieling.thrift.idl.ArenaOfHero hero, Hero yuxuHero) {
List<Integer> heroSkillList = this.getCrossYuxuHeroSkillList(hero,yuxuHero);
coverSkill(heroSkillList);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < heroSkillList.size(); i++) {
@ -6726,7 +6660,7 @@ public class HeroLogic {
}
// 强化等级验证
for (Map.Entry<Integer, HeroEquipStrong> entry : heroStrongMap.entrySet()) {
Integer level = entry.getValue().getStrongLv();
int level = entry.getValue().getStrongLv();
if (level < rankUp.getLimit()){
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"突破等级不足:"+entry.getValue().toString());
}
@ -6747,7 +6681,7 @@ public class HeroLogic {
// 校验配置表
SEquipStrengthen strongThen = strongMap.get(heroEquipStrong.getStrongLv());
if (strongThen == null || strongThen.getCost() == null){
throw new ErrorCodeException(ErrorCode.LEVE_MAX,"强化等级不存在:"+strongThen.toString());
throw new ErrorCodeException(ErrorCode.LEVE_MAX,"强化等级不存在:"+heroEquipStrong.getStrongLv());
}
// 校验建筑等级
ArchitectureInfo info = user.getPlayerInfoManager().getArchitectureInfoMap().get(strongThen.getLimit()[0]);
@ -6756,7 +6690,7 @@ public class HeroLogic {
}
SHomeLandLevel landLevel = levelMap.get(info.getId());
if (landLevel == null || landLevel.getlevel() < strongThen.getLimit()[1]){
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"建筑等级不足,位置:"+type+",等级:"+landLevel.getlevel());
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"建筑等级不足,位置:"+type+",等级:"+info.getId());
}
// 校验突破等级
int equipAdvanceLv = hero.getEquipAdvanceLv();
@ -6864,10 +6798,10 @@ public class HeroLogic {
SGodHoodTreeSetting sGodHoodTreeSetting = STableManager.getConfig(SGodHoodTreeSetting.class).get(0);
int[][] unlcokLevels = sGodHoodTreeSetting.getPropertyUnlcokLevels();
// 循环属性,总层数大于等于则赋值,小于直接返回
for (int i = 0; i < unlcokLevels.length; i++) {
if (count >= unlcokLevels[i][1]){
tier = unlcokLevels[i][0];
}else {
for (int[] unlcokLevel : unlcokLevels) {
if (count >= unlcokLevel[1]) {
tier = unlcokLevel[0];
} else {
break;
}
}