diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/eventhandler/SevenWorldFightHandler.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/eventhandler/SevenWorldFightHandler.java index cdaa3c9c0..c2bd9212a 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/eventhandler/SevenWorldFightHandler.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/eventhandler/SevenWorldFightHandler.java @@ -97,8 +97,9 @@ public class SevenWorldFightHandler implements IFightEventProcesor { if (hero == null) { continue; } + StringBuilder skillSb = new StringBuilder(); + String heroSkill = HeroLogic.getInstance().getHeroSkills(user,hero,skillSb).toString(); StringBuilder propertySb = new StringBuilder(); - String heroSkill = getHeroSkills(user,hero,teamPosHeroInfo.getPosition()).toString(); String property = HeroLogic.getInstance().getHeroProperty(user,hero,propertySb,true,teamId).toString(); CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo .newBuilder() @@ -122,31 +123,6 @@ public class SevenWorldFightHandler implements IFightEventProcesor { .build(); } - /** - * 英雄技能 - * @param user - * @param hero - * @param index - * @return - */ - private static StringBuilder getHeroSkills(User user,Hero hero,int index){ - StringBuilder sb = new StringBuilder(); - List heroSkillList = HeroLogic.getInstance().getHeroSkillList(user, hero); - heroSkillList.addAll(relicSkills(user,hero.getTemplateId(),index,1)); - HeroLogic.getInstance().coverSkill(heroSkillList); - for(int i=0;i getHeroSkillList(User user, Hero hero) { List skillList = new ArrayList<>(); SCHero tempHero = SCHero.getsCHero().get(hero.getTemplateId()); @@ -1928,14 +1934,59 @@ public class HeroLogic { } } }); - if (hero.getGodSoulLv()>0){ - skillList.addAll(GetGodSoulSkill(hero.getTemplateId(),hero.getGodSoulLv())); + + Iterator> iterator = hero.getEquipByHongmengPositionMap(user.getHeroManager()).entrySet().iterator(); + // 套装list初始化 + ArrayList suiteNumList = new ArrayList<>(); + while (iterator.hasNext()) { + Map.Entry next = iterator.next(); + SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(next.getValue()); + // 添加到套装list + suiteNumList.add(sEquipConfig); + } + Collections.sort(suiteNumList); + // 记录当前长度(位置) + int num = suiteNumList.size(); + if (!suiteNumList.isEmpty()) { + // 遍历套装list + for (SEquipConfig item : suiteNumList) { + //根据星级读取配置表,为空表示不是套装 + SEquipSuiteConfig sEquipSuiteConfig = SEquipSuiteConfig.config.get(item.getStar()); + if (null != sEquipSuiteConfig) { + // 根据套装数量读表,为空标是套装数量不足 + Integer integer = sEquipSuiteConfig.getSuiteSkills().get(num); + if (integer == null) { + num -= 1; + continue; + } + skillList.add(integer); + } + // 不管是否是套装,都要-1 + num -= 1; + } + } + // 坐骑技能 + for (Map.Entry entry : user.getPlayerInfoManager().getUserMountValidTime().entrySet()) { + if (!SPlayerHeadIcon.getHeadIconMap().containsKey(entry.getKey())) { + continue; + } + SPlayerHeadIcon sPlayerHeadIcon = SPlayerHeadIcon.getHeadIconMap().get(entry.getKey()); + if (sPlayerHeadIcon.getSkill() == null || sPlayerHeadIcon.getSkill().length <= 0) { + continue; + } + skillList.add(sPlayerHeadIcon.getSkill()[0][0]); } + //神魂技能 + if (hero.getGodSoulLv() > 0) { + List godSoulSkills = GetGodSoulSkill(hero.getTemplateId(), hero.getGodSoulLv()); + skillList.addAll(godSoulSkills); + } return skillList; } + public StringBuilder getCrossHeroSkillStr(ArenaOfUser user, ArenaOfHero hero) { List skillList = new ArrayList<>(); SCHero tempHero = SCHero.getsCHero().get(hero.getTemplateId()); @@ -1990,6 +2041,12 @@ public class HeroLogic { } }); + //神魂技能 + if (hero.getGodSoulLv() > 0) { + List godSoulSkills = GetGodSoulSkill(hero.getTemplateId(), hero.getGodSoulLv()); + skillList.addAll(godSoulSkills); + } + StringBuilder sb = new StringBuilder(); coverSkill(skillList); for (int i = 0; i < skillList.size(); i++) { @@ -2235,7 +2292,11 @@ public class HeroLogic { } } - public void coverSkill(List heroSkillList) { + /** + * 过滤掉不存在的技能 + * @param heroSkillList + */ + private void coverSkill(List heroSkillList) { Set coverSkillIds = new HashSet<>(); heroSkillList.forEach(skill -> { SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill); @@ -2246,6 +2307,13 @@ public class HeroLogic { heroSkillList.removeAll(coverSkillIds); } + /** + * 获取英雄战斗技能接口 + * @param user + * @param hero + * @param sb + * @return + */ public StringBuilder getHeroSkills(User user, Hero hero, StringBuilder sb) { List heroSkillList = getHeroSkillList(user, hero); coverSkill(heroSkillList); @@ -2260,55 +2328,6 @@ public class HeroLogic { sb.append(skill).append(DIVISION); } } - Iterator> iterator = hero.getEquipByHongmengPositionMap(user.getHeroManager()).entrySet().iterator(); - // 套装list初始化 - ArrayList suiteNumList = new ArrayList<>(); - while (iterator.hasNext()) { - Map.Entry next = iterator.next(); - SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(next.getValue()); - // 添加到套装list - suiteNumList.add(sEquipConfig); - } - Collections.sort(suiteNumList); - // 记录当前长度(位置) - int num = suiteNumList.size(); - if (!suiteNumList.isEmpty()) { - // 遍历套装list - for (SEquipConfig item : suiteNumList) { - //根据星级读取配置表,为空表示不是套装 - SEquipSuiteConfig sEquipSuiteConfig = SEquipSuiteConfig.config.get(item.getStar()); - if (null != sEquipSuiteConfig) { - // 根据套装数量读表,为空标是套装数量不足 - Integer integer = sEquipSuiteConfig.getSuiteSkills().get(num); - if (integer == null) { - num -= 1; - continue; - } - sb.append(integer).append(DIVISION); - } - // 不管是否是套装,都要-1 - num -= 1; - } - } - // 坐骑技能 - for (Map.Entry entry : user.getPlayerInfoManager().getUserMountValidTime().entrySet()) { - if (!SPlayerHeadIcon.getHeadIconMap().containsKey(entry.getKey())) { - continue; - } - SPlayerHeadIcon sPlayerHeadIcon = SPlayerHeadIcon.getHeadIconMap().get(entry.getKey()); - if (sPlayerHeadIcon.getSkill() == null || sPlayerHeadIcon.getSkill().length <= 0) { - continue; - } - sb.append(sPlayerHeadIcon.getSkill()[0][0]).append(DIVISION); - } - - //神魂技能 - if (hero.getGodSoulLv()>0) { - ListgodSoulSkills= HeroLogic.getInstance().GetGodSoulSkill(hero.getTemplateId(),hero.getGodSoulLv()); - for (Integer godSoulSkill : godSoulSkills) { - sb.append(godSoulSkill).append(DIVISION); - } - } return sb; }