大闹天宫,用户等级修正和遇敌灵兽添加
parent
c99f1bea67
commit
55500f6aaa
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -39,6 +39,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.*;
|
||||
|
|
@ -338,8 +339,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){
|
||||
|
|
@ -352,6 +355,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
|
||||
|
|
@ -647,7 +694,7 @@ public class ExpeditionLogic {
|
|||
}
|
||||
|
||||
fightInfo.setForce(force);
|
||||
fightInfo.setPokenmonSkills("");
|
||||
fightInfo.setPokenmonSkills(StringUtil.parseArrayToString(property.getAnimal()));
|
||||
fightInfo.setPassiveSkills("");
|
||||
fightInfo.setUid(property.getId());
|
||||
fightInfo.setHeroAttribute(heroAllAttribute);
|
||||
|
|
|
|||
|
|
@ -193,4 +193,26 @@ public class MonsterUtil {
|
|||
}
|
||||
return pokemonInfo;
|
||||
}
|
||||
|
||||
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]));
|
||||
info.setStar(animal[i][1]);
|
||||
info.setPosition(i+1);
|
||||
SSpiritAnimalSkill sSpiritAnimalSkill = SSpiritAnimalSkill.skillByAnimalAndStar.get(animal[i][0]).get(animal[i][1]);
|
||||
info.setUnitSkillIds(String.valueOf(sSpiritAnimalSkill.getId()));
|
||||
|
||||
Map<Integer, Integer> map = HeroLogic.getInstance().calOnePokemonAttribute(animal[i][0], animal[i][1], animal[i][2]);
|
||||
|
||||
info.setProperty(HeroLogic.getInstance().getOnePokemonProperty(map,animal[i][2]).toString());
|
||||
|
||||
pokemonInfo.add(info.build());
|
||||
}
|
||||
return pokemonInfo;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue