Merge branch 'dh_dev_HavocInHeaven' of http://60.1.1.230/backend/jieling_server into dh_dev_HavocInHeaven
commit
ce12694f5a
|
|
@ -19,6 +19,7 @@ import com.ljsd.jieling.logic.mail.MailLogic;
|
|||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.MonsterUtil;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.RoomProto;
|
||||
|
|
@ -126,9 +127,11 @@ public class BloodLogic {
|
|||
List<CommonProto.FightUnitInfo> pokemonSkills = new ArrayList<>();
|
||||
User user = UserManager.getUser(uid, true);
|
||||
if(user!=null&&!user.getPokemonManager().getPokemonTeamMap().isEmpty()){
|
||||
// 真人
|
||||
pokemonSkills = HeroLogic.getInstance().getPokemonSkills(UserManager.getUser(uid));
|
||||
}else {
|
||||
|
||||
// 机器人
|
||||
pokemonSkills = MonsterUtil.getMonsterPokemon(StringUtil.parseFiledInt2(pokmanSkill));
|
||||
}
|
||||
return CommonProto.FightTeamInfo.
|
||||
newBuilder()
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.MathUtils;
|
||||
import util.StringUtil;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -340,8 +341,10 @@ public class ExpeditionLogic {
|
|||
}
|
||||
// 随机出来的队伍信息
|
||||
List<Integer> randomFaceRankTeam = getRandomFaceRankTeam(user);
|
||||
|
||||
int robotLevel2 = getRobotLevelByUser(user, robotLevel);
|
||||
// 节点英雄快照
|
||||
snapOneFightInfo(nodeInfo,randomFaceRankTeam,robotLevel);
|
||||
snapOneFightInfo(nodeInfo,randomFaceRankTeam,robotLevel2);
|
||||
}
|
||||
// boss节点
|
||||
if(nodeInfo.getType()==ExpeditionLogic.NODETYPE_GREED||nodeInfo.getType()==ExpeditionLogic.NODETYPE_TRY){
|
||||
|
|
@ -354,6 +357,50 @@ public class ExpeditionLogic {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户等级修正机器人等级
|
||||
* @param user
|
||||
* @param originalLevel
|
||||
* @return
|
||||
*/
|
||||
private int getRobotLevelByUser(User user,int originalLevel){
|
||||
SExpeditionSetting setting = STableManager.getConfig(SExpeditionSetting.class).get(1);
|
||||
// 表配置错误
|
||||
if (setting == null){
|
||||
return originalLevel;
|
||||
}
|
||||
// 用户等级
|
||||
int userLevel = user.getPlayerInfoManager().getLevel();
|
||||
// 等级限制
|
||||
int[] levelLimit = setting.getPlayerLevelfix()[0];
|
||||
// 对应条件
|
||||
int[] condition = setting.getPlayerLevelfix()[1];
|
||||
// 长度不等
|
||||
if (levelLimit.length != condition.length){
|
||||
return originalLevel;
|
||||
}
|
||||
// 修正的等级
|
||||
int offset = 0;
|
||||
// 计数器,防止表里的修正等级为0
|
||||
int count = 0;
|
||||
for (int i = 0; i < levelLimit.length; i++) {
|
||||
// 满足条件
|
||||
if (userLevel < levelLimit[i]){
|
||||
offset = condition[i];
|
||||
count++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 等级超过限制条件,取最大限制条件
|
||||
if (offset == 0 && count == 0){
|
||||
offset = condition[condition.length-1];
|
||||
}
|
||||
|
||||
int level = originalLevel+offset;
|
||||
|
||||
return level>1?level:1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取随机排名的队伍信息
|
||||
* @param user
|
||||
|
|
@ -649,7 +696,7 @@ public class ExpeditionLogic {
|
|||
}
|
||||
|
||||
fightInfo.setForce(force);
|
||||
fightInfo.setPokenmonSkills("");
|
||||
fightInfo.setPokenmonSkills(StringUtil.parseArrayToString(property.getAnimal()));
|
||||
fightInfo.setPassiveSkills("");
|
||||
fightInfo.setUid(property.getId());
|
||||
fightInfo.setHeroAttribute(heroAllAttribute);
|
||||
|
|
|
|||
|
|
@ -171,12 +171,26 @@ public class MonsterUtil {
|
|||
return (int)(maxForce*(0.8+groupIds.length*0.2));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据怪物组id获取对应的灵兽信息
|
||||
* @param groupId
|
||||
* @return
|
||||
*/
|
||||
public static List<CommonProto.FightUnitInfo> getMonsterPokemonByGroup(int groupId) {
|
||||
int[][] animal = SMonsterGroup.getsMonsterGroupMap().get(groupId).getAnimal();
|
||||
if (animal==null||animal.length<1||animal[0].length<1){
|
||||
return null;
|
||||
}
|
||||
return getMonsterPokemon(animal);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据灵兽的二维数组获取灵兽信息
|
||||
* @param animal
|
||||
* @return
|
||||
*/
|
||||
public static List<CommonProto.FightUnitInfo> getMonsterPokemon(int[][] animal) {
|
||||
List<CommonProto.FightUnitInfo> pokemonInfo = new ArrayList<>();
|
||||
if (animal==null||animal.length<1||animal[0].length<1){
|
||||
return pokemonInfo;
|
||||
}
|
||||
for(int i = 0 ; i <animal.length;i++){
|
||||
CommonProto.FightUnitInfo.Builder info = CommonProto.FightUnitInfo.newBuilder();
|
||||
info.setUnitId(String.valueOf(animal[i][0]));
|
||||
|
|
|
|||
Loading…
Reference in New Issue