英雄技能调用统一方法
parent
b3df483ef8
commit
6d004e2114
|
@ -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<Integer> heroSkillList = HeroLogic.getInstance().getHeroSkillList(user, hero);
|
||||
heroSkillList.addAll(relicSkills(user,hero.getTemplateId(),index,1));
|
||||
HeroLogic.getInstance().coverSkill(heroSkillList);
|
||||
for(int i=0;i<heroSkillList.size();i++){
|
||||
Integer skill = heroSkillList.get(i);
|
||||
if(i<2){
|
||||
sb.append(skill).append(HeroLogic.DIVISION);
|
||||
continue;
|
||||
}
|
||||
SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);
|
||||
if(config!=null &&config.getEffectiveRange()==1){
|
||||
sb.append(skill).append(HeroLogic.DIVISION);
|
||||
}
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
/**
|
||||
* 遗物技能
|
||||
|
|
|
@ -1875,6 +1875,12 @@ public class HeroLogic {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取英雄所有技能,新技能添加到此方法
|
||||
* @param user
|
||||
* @param hero
|
||||
* @return
|
||||
*/
|
||||
public List<Integer> getHeroSkillList(User user, Hero hero) {
|
||||
List<Integer> 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<Map.Entry<Integer, Integer>> iterator = hero.getEquipByHongmengPositionMap(user.getHeroManager()).entrySet().iterator();
|
||||
// 套装list初始化
|
||||
ArrayList<SEquipConfig> suiteNumList = new ArrayList<>();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<Integer, Integer> 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<Integer, Long> 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<Integer> godSoulSkills = GetGodSoulSkill(hero.getTemplateId(), hero.getGodSoulLv());
|
||||
skillList.addAll(godSoulSkills);
|
||||
}
|
||||
return skillList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public StringBuilder getCrossHeroSkillStr(ArenaOfUser user, ArenaOfHero hero) {
|
||||
List<Integer> skillList = new ArrayList<>();
|
||||
SCHero tempHero = SCHero.getsCHero().get(hero.getTemplateId());
|
||||
|
@ -1990,6 +2041,12 @@ public class HeroLogic {
|
|||
}
|
||||
});
|
||||
|
||||
//神魂技能
|
||||
if (hero.getGodSoulLv() > 0) {
|
||||
List<Integer> 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<Integer> heroSkillList) {
|
||||
/**
|
||||
* 过滤掉不存在的技能
|
||||
* @param heroSkillList
|
||||
*/
|
||||
private void coverSkill(List<Integer> heroSkillList) {
|
||||
Set<Integer> 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<Integer> heroSkillList = getHeroSkillList(user, hero);
|
||||
coverSkill(heroSkillList);
|
||||
|
@ -2260,55 +2328,6 @@ public class HeroLogic {
|
|||
sb.append(skill).append(DIVISION);
|
||||
}
|
||||
}
|
||||
Iterator<Map.Entry<Integer, Integer>> iterator = hero.getEquipByHongmengPositionMap(user.getHeroManager()).entrySet().iterator();
|
||||
// 套装list初始化
|
||||
ArrayList<SEquipConfig> suiteNumList = new ArrayList<>();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<Integer, Integer> 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<Integer, Long> 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) {
|
||||
List<Integer>godSoulSkills= HeroLogic.getInstance().GetGodSoulSkill(hero.getTemplateId(),hero.getGodSoulLv());
|
||||
for (Integer godSoulSkill : godSoulSkills) {
|
||||
sb.append(godSoulSkill).append(DIVISION);
|
||||
}
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue