From 92a1305eafbb3ca5bb6b85bb43e742249426f7b6 Mon Sep 17 00:00:00 2001 From: duhui Date: Mon, 6 Dec 2021 15:35:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E9=97=B9=E5=A4=A9=E5=AE=AB=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ljsd/jieling/logic/dao/Hero.java | 8 +++----- .../jieling/logic/expedition/BattleNode.java | 2 +- .../logic/expedition/ExpeditionLogic.java | 17 +++-------------- .../jieling/logic/expedition/SpecialNode.java | 2 +- .../com/ljsd/jieling/logic/fight/FightUtil.java | 1 + .../jieling/logic/fight/robot/RobotInfo.java | 9 +++++++++ .../com/ljsd/jieling/logic/hero/HeroLogic.java | 14 ++++++-------- .../src/main/java/config/SRobotProperty.java | 6 ++++++ 8 files changed, 30 insertions(+), 29 deletions(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/Hero.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/Hero.java index 75ce8bceb..a18014d2c 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/Hero.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/Hero.java @@ -9,10 +9,7 @@ import com.ljsd.jieling.logic.hero.HongMengAttributeEnum; import com.ljsd.jieling.logic.mission.GameEvent; import com.ljsd.jieling.util.KeyGenUtils; import com.ljsd.jieling.util.UUIDEnum; -import config.SCHero; -import config.SCHeroRankUpConfig; -import config.SEndlessHeroProp; -import config.SEquipConfig; +import config.*; import manager.STableManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -104,7 +101,7 @@ public class Hero extends MongoBase implements Comparable,Cloneable { } /** - * 初始化英雄 + * 初始化英雄,不入英雄背包 * @param uid * @param heroTid * @param level @@ -124,6 +121,7 @@ public class Hero extends MongoBase implements Comparable,Cloneable { this.speed = hero.speed; this.especialEquipLevel = hero.especialEquipLevel; this.createType = 1; + this.godSoulLv = Optional.ofNullable(STableManager.getConfig(SRobotProperty.class).get(level)).map(SRobotProperty::getSpirits).orElse(0); // 这个参数需要到外边处理 this.jewelInfo = new HashSet<>(hero.getJewelInfo()); } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/expedition/BattleNode.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/expedition/BattleNode.java index ae76aa003..ddc829bac 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/expedition/BattleNode.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/expedition/BattleNode.java @@ -200,7 +200,7 @@ public class BattleNode extends AbstractExpedition { Map longAttribute = new HashMap<>(); robotHeroAttribute.forEach((k,v)->longAttribute.put(k,(long)v)); force+=HeroLogic.getInstance().calForce(longAttribute); - heroAllAttribute.put(id.toString(), new FamilyHeroInfo(id, property.getId(), property.getStar(), longAttribute,innerPosition++,0)); + heroAllAttribute.put(id.toString(), new FamilyHeroInfo(id, property.getId(), property.getStar(), longAttribute,innerPosition++,property.getSpirits())); } fightInfo.setForce(force); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/expedition/ExpeditionLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/expedition/ExpeditionLogic.java index b1e5f30de..a71a7861b 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/expedition/ExpeditionLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/expedition/ExpeditionLogic.java @@ -186,22 +186,10 @@ public class ExpeditionLogic { if (newlay != nodeInfo1.getLay() && nodeInfo1.getLay() != oldlay) { return; } -// if(passNode!=nodeInfo1.getSortId()&& !nextNodeId.contains(nodeInfo1.getSortId())){ -// return; -// } int state = nodeInfo1.getLay() == oldlay ? (nodeInfo1.getSortId() == passNode ? ExpeditionLogic.NODESTATE_PASS : ExpeditionLogic.NODESTATE_OVER_PASS) : nextNodeId.contains(nodeInfo1.getSortId())?ExpeditionLogic.NODESTATE_NOT_PASS:ExpeditionLogic.NODESTATE_CLOSE; nodeInfo1.setState(state); -// if(nodeInfo1.getType()==ExpeditionLogic.NODETYPE_SHOP&&newlay==nodeInfo1.getLay()){ -// try { -// //更新商店 -// StoreLogic.initOneStore(user, 56); -// }catch (Exception e){ -// e.printStackTrace(); -// } -// } - //最后的奖励节点 前端显示跳转入口用 if( nodeInfo1.getLay() == oldlay&&nodeInfo1.getType()==ExpeditionLogic.NODETYPE_REWARD){ if(user.getExpeditionManager().getExpeditionLeve()<=2){ @@ -442,6 +430,7 @@ public class ExpeditionLogic { builder1.setStar(familyHeroInfo.getStar()); builder1.setRemainHp(heroHP.get(s)); builder1.setPosition(familyHeroInfo.getPosition()); + builder1.setGodSoulLev(familyHeroInfo.getGodSoulLv()); builders.add(builder1.build()); }); builder.addAllHero(builders); @@ -606,9 +595,9 @@ public class ExpeditionLogic { throw new ErrorCodeException(ErrorCode.CFG_NULL,"英雄表id不存在:"+heroTid); } // 最高等级 - level = level>scHero.getMaxLevel()?scHero.getMaxLevel():level; + level = Math.min(level, scHero.getMaxLevel()); // 最低20级 - level = level<20?20:level; + level = Math.max(level, 20); //创建新的英雄 Hero newHero = new Hero(hero,user.getId(),heroTid,level); // 魂宝灵宝,魂印需要走表 diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/expedition/SpecialNode.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/expedition/SpecialNode.java index 1e6cd753d..624b8a0ca 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/expedition/SpecialNode.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/expedition/SpecialNode.java @@ -70,7 +70,7 @@ public class SpecialNode extends AbstractExpedition { int force = HeroLogic.getInstance().calForce(longAttribute); fightInfo.setForce(force); //试炼节点 放到第二个位置上 - heroAllAttribute.put(Integer.toString(heroId), new FamilyHeroInfo(heroId,level,robot.getStar(),longAttribute,2,0)); + heroAllAttribute.put(Integer.toString(heroId), new FamilyHeroInfo(heroId,level,robot.getStar(),longAttribute,2,robot.getGodSoulLev())); fightInfo.updateHeroSkill(String.valueOf(heroId),skills.substring(0,skills.length()-1)); // 获取灵兽信息 SRobotProperty property = STableManager.getConfig(SRobotProperty.class).get(level); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/FightUtil.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/FightUtil.java index 2b927c717..873b842d2 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/FightUtil.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/FightUtil.java @@ -642,6 +642,7 @@ public class FightUtil { robotInfo.setRobotHeroAttribute(HeroLogic.getInstance().calRobotHeroAttribute(property)); robotInfo.setSkill(SRobotSkill.getSkill(heroTid)); robotInfo.setPassiveSkill(SRobotSkill.getPassiveSkill(heroTid, property.getSkillPool() - 1)); + robotInfo.setGodSoulLev(property.getSpirits()); return robotInfo; } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/robot/RobotInfo.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/robot/RobotInfo.java index 276c14394..e735c9ecb 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/robot/RobotInfo.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/robot/RobotInfo.java @@ -17,6 +17,15 @@ public class RobotInfo { private Map robotHeroAttribute; private String skill; private String passiveSkill; + private int godSoulLev; + + public int getGodSoulLev() { + return godSoulLev; + } + + public void setGodSoulLev(int godSoulLev) { + this.godSoulLev = godSoulLev; + } public int getHeroTid() { return heroTid; diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java index 48805f14e..542ca1f6b 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java @@ -5688,15 +5688,13 @@ public class HeroLogic { */ public int getAverageLevel(User user, int averageNum) throws ErrorCodeException { HeroManager heroManager = user.getHeroManager(); - - int num = heroManager.getHeroMap().size() > averageNum ? averageNum : heroManager.getHeroMap().size(); - + // 获取平均数量 + int num = Math.min(heroManager.getHeroMap().size(), averageNum); // 获取玩家全部英雄 - Collection values = heroManager.getHeroMap().values(); - List heroes = new ArrayList<>(values); - - // 玩家英雄背包按等级排 - Collections.sort(heroes); + List heroes = heroManager.getHeroMap().values().stream() + .sorted(Comparator.comparing(v -> v.getLevel(heroManager), Comparator.reverseOrder())) + .collect(Collectors.toList()) + .subList(0, num); // 等级相加 int count = 0; for (int i = 0; i < num; i++) { diff --git a/tablemanager/src/main/java/config/SRobotProperty.java b/tablemanager/src/main/java/config/SRobotProperty.java index dfd45a403..9f7eaa473 100644 --- a/tablemanager/src/main/java/config/SRobotProperty.java +++ b/tablemanager/src/main/java/config/SRobotProperty.java @@ -17,6 +17,8 @@ public class SRobotProperty implements BaseConfig { private int skillPool; private int[][] animal; + + private int spirits; @Override public void init() throws Exception { @@ -43,4 +45,8 @@ public class SRobotProperty implements BaseConfig { public int[][] getAnimal() { return animal; } + + public int getSpirits() { + return spirits; + } } \ No newline at end of file