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 844ab629e..accb44d8c 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 @@ -2394,10 +2394,59 @@ public class HeroLogic { return sb; } + + public CommonProto.FightTeamInfo combinationFightTeam(User user, int teamId, List heroFightInfos){ + return CommonProto.FightTeamInfo.newBuilder() + .addAllFightUnitList(heroFightInfos) + .addAllPokemonUnitList(HeroLogic.getInstance().getNotHeroFightUnitInfo(user)) + .addAllMagicSoldierList(HeroLogic.getInstance().getMagicSolderFightUnitInfo(user)) + .setTeamPassiveList("") + .setSpecialPassive(SpecialForTeamBuildEnum.toParm(teamId, user)) + .setForceScore(HeroLogic.getInstance().calTeamForce(user,teamId)) + .build(); + } + + /** + * 获取非英雄的战斗数据 + * @param user + * @return + */ + public List getNotHeroFightUnitInfo(User user) { + List pokemonInfos = new ArrayList<>(); + // 灵兽 + getPokemonFightUnitInfo(user, pokemonInfos); + // 主角技 + getPlayerFightUnitInfo(user, pokemonInfos); + return pokemonInfos; + } + + public void getPokemonFightUnitInfo(User user, List pokemonInfos) { + //灵兽 + Map pokemonTeamMap = user.getPokemonManager().getPokemonTeamMap(); + PokemonManager pokemonManager = user.getPokemonManager(); + for (Map.Entry entry : pokemonTeamMap.entrySet()) { + Pokemon pokemon = pokemonManager.getPokemonMap().get(entry.getValue()); + if (pokemon == null) { + continue; + } + SSpiritAnimalSkill sSpiritAnimalSkill = SSpiritAnimalSkill.skillByAnimalAndStar.get(pokemon.getTmpId()).get(pokemon.getStar()); + Map map = calOnePokemonAttribute(pokemon.getTmpId(),pokemon.getStar(),pokemon.getLevel()); + StringBuilder propertyBuilder = getOnePokemonProperty(map, pokemon.getLevel()); + CommonProto.FightUnitInfo info = CommonProto.FightUnitInfo.newBuilder() + .setPosition(entry.getKey()) + .setStar(pokemon.getStar()) + .setProperty(propertyBuilder.toString()) + .setUnitId(String.valueOf(pokemon.getTmpId())) + .setUnitSkillIds(String.valueOf(sSpiritAnimalSkill.getId())) + .build(); + pokemonInfos.add(info); + } + } + /** * 主角技能数据 */ - public void getPracticeSkill(User user, List pokemonList) { + public void getPlayerFightUnitInfo (User user, List pokemonList) { StringBuilder builder = new StringBuilder(); HashMap attrMap = new HashMap<>(); @@ -2410,8 +2459,7 @@ public class HeroLogic { // 获取属性 calPlayerAttribute(attrMap, info.getCardId(), info.getStar(), info.getLevel()); }catch (Exception e){ - LOGGER.error("获取主角技能报错:{}", e.getMessage()); - e.printStackTrace(); + LOGGER.error("获取主角技能报错:{}", e.getMessage(),e); } } @@ -2425,6 +2473,16 @@ public class HeroLogic { SPlayerLevelConfig playerLevelConfig = SPlayerLevelConfig.sPlayerLevelConfigMap.get(user.getPlayerInfoManager().getLevel()); combinedAttribute(playerLevelConfig.getPlayerPropList(), attrMap); + // 主角礼物属性 + Set giftEquipList = user.getPlayerInfoManager().getPlayerGiftEquipList(); + for (Integer id : giftEquipList) { + SEquipConfig config = SEquipConfig.equipConfigMap.get(id); + if (config == null){ + continue; + } + combinedAttribute(config.getPlayerProperty(), attrMap); + } + // 属性 String property = getPlayerProperty(attrMap); @@ -2462,57 +2520,12 @@ public class HeroLogic { // 去除最后一位得#号 } - - public CommonProto.FightTeamInfo combinationFightTeam(User user, int teamId, List heroFightInfos){ - return CommonProto.FightTeamInfo.newBuilder() - .addAllFightUnitList(heroFightInfos) - .addAllPokemonUnitList(HeroLogic.getInstance().getPokemonSkills(user)) - .addAllMagicSoldierList(HeroLogic.getInstance().getMagicSolderSkills(user)) - .setTeamPassiveList("") - .setSpecialPassive(SpecialForTeamBuildEnum.toParm(teamId, user)) - .setForceScore(HeroLogic.getInstance().calTeamForce(user,teamId)) - .build(); - } - - /** - * 这里放全部得主动技能 - * @param user - * @return - */ - public List getPokemonSkills(User user) { - //灵兽 - Map pokemonTeamMap = user.getPokemonManager().getPokemonTeamMap(); - PokemonManager pokemonManager = user.getPokemonManager(); - List pokemonInfos = new ArrayList<>(); - for (Map.Entry entry : pokemonTeamMap.entrySet()) { - Pokemon pokemon = pokemonManager.getPokemonMap().get(entry.getValue()); - if (pokemon == null) { - continue; - } - SSpiritAnimalSkill sSpiritAnimalSkill = SSpiritAnimalSkill.skillByAnimalAndStar.get(pokemon.getTmpId()).get(pokemon.getStar()); - Map map = calOnePokemonAttribute(pokemon.getTmpId(),pokemon.getStar(),pokemon.getLevel()); - StringBuilder propertyBuilder = getOnePokemonProperty(map, pokemon.getLevel()); - CommonProto.FightUnitInfo info = CommonProto.FightUnitInfo.newBuilder() - .setPosition(entry.getKey()) - .setStar(pokemon.getStar()) - .setProperty(propertyBuilder.toString()) - .setUnitId(String.valueOf(pokemon.getTmpId())) - .setUnitSkillIds(String.valueOf(sSpiritAnimalSkill.getId())) - .build(); - pokemonInfos.add(info); - } - - // 变身卡 - getPracticeSkill(user, pokemonInfos); - return pokemonInfos; - } - /** * 获取灵兽编队信息 * @param user * @return */ - public List getMagicSolderSkills(User user) { + public List getMagicSolderFightUnitInfo(User user) { List MagicSolderInfos = new ArrayList<>(); MagicSoldierManager soldierManager = user.getMagicSoldierManager(); for (String id : soldierManager.getMember()) { @@ -2674,6 +2687,8 @@ public class HeroLogic { Map heroAllAttribute = calHeroAllAttribute(user, hero, isForce); heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAllAttribute.get(GlobalsDef.HP_TYPE)); + // 主角属性加成 + applyPlayerAndSkill(heroAllAttribute, user); // 灵兽和神兵 applyPokemonAndMagicSoldierAttribute(heroAllAttribute, teamId, user); // 图鉴,皮肤,称号,坐骑等。。。 @@ -2684,8 +2699,6 @@ public class HeroLogic { applyHeroLikableAttribute(heroAllAttribute, hero.getTemplateId(), user); // 法宝聚灵和命格属性加成 applyTrumpAndGemAttribute(heroAllAttribute, user); - // 主角和主角技 - applyPlayerAndSkill(heroAllAttribute, user); // 工坊科技树加成(疑似废弃) applyWorkShopTechnologyAttribute(heroAllAttribute, hero.getTemplateId(), user); // 装备和套装属性 @@ -2901,11 +2914,16 @@ public class HeroLogic { calPlayerCardAttribute(heroAllAttribute, info.getCardId(), info.getStar(), info.getLevel()); } - //化身之力提供的属性 -// Map SChangingForce = STableManager.getConfig(SChangingForce.class); -// if(SChangingForce.get(user.getHeroManager().getTransformationForce()) != null){ -// combinedAttribute(SChangingForce.get(user.getHeroManager().getTransformationForce()).getPropList(), heroAllAttribute); -// } + // 礼物主角属性 + Set playerGiftEquipList = user.getPlayerInfoManager().getPlayerGiftEquipList(); + Map configMap = SEquipConfig.equipConfigMap; + for (Integer id : playerGiftEquipList) { + SEquipConfig config = configMap.get(id); + if (config == null){ + continue; + } + combinedAttribute(config.getPlayerProperty(), heroAllAttribute); + } } private void applyEquipSuiteAttribute(Map heroAllAttribute, Hero hero){ @@ -3344,7 +3362,7 @@ public class HeroLogic { if (style == GlobalsDef.ABSOLUTE_TYPE || targetPro.getStyle() == GlobalsDef.PERCENT_TYPE) { if (heroAllAttribute.containsKey(targetPropertyId)) { long targetValue = heroAllAttribute.getOrDefault(targetPropertyId, 0L); - effectValue += targetValue; + effectValue += (int) targetValue; heroAllAttribute.put(targetPropertyId, (long) effectValue); } else { newAddAttribute.merge(targetPropertyId, (long) effectValue, Long::sum); @@ -3941,7 +3959,7 @@ public class HeroLogic { SChangingCardStar cardStar = SChangingCardStar.getPoolMap().get(card.getStar()).get(star); combinedAttribute(cardStar.getPlayerPropList(), attrMap); }catch (Exception e){ - e.printStackTrace(); + LOGGER.error("计算主角属性报错,error:{}",e.getMessage(),e); } } @@ -3969,7 +3987,7 @@ public class HeroLogic { } } }catch (Exception e){ - e.printStackTrace(); + LOGGER.error("计算主角变身卡属性报错,error:{}",e.getMessage(),e); } } diff --git a/tablemanager/src/main/java/config/SEquipConfig.java b/tablemanager/src/main/java/config/SEquipConfig.java index 814d7ba96..e9af0ba6c 100644 --- a/tablemanager/src/main/java/config/SEquipConfig.java +++ b/tablemanager/src/main/java/config/SEquipConfig.java @@ -22,6 +22,8 @@ public class SEquipConfig implements BaseConfig,Comparable { private int[][] property; + private int[][] playerProperty; + private int[] propertyMax; private int[] pool; @@ -207,6 +209,10 @@ public class SEquipConfig implements BaseConfig,Comparable { return gift; } + public int[][] getPlayerProperty() { + return playerProperty; + } + @Override public int compareTo(SEquipConfig o) { return this.getStar() - o.getStar();