diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/TeamPosManager.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/TeamPosManager.java index c56173c00..67a5ac542 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/TeamPosManager.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/TeamPosManager.java @@ -16,7 +16,7 @@ public class TeamPosManager extends MongoBase { @Transient private int curTeamPosId; @Transient - private Map> cacheTeamPro = new HashMap<>(5); + private Map cacheTeamPro = new HashMap<>(5); @Transient private Map> cachePassskill = new HashMap<>(5); @@ -92,11 +92,11 @@ public class TeamPosManager extends MongoBase { cachePassskill.remove(curTeamPosId); } - public Map> getCacheTeamPro() { + public Map getCacheTeamPro() { return cacheTeamPro; } - public void updateTeamPos(int teamId,List result){ + public void updateTeamPos(int teamId,int[][] result){ cacheTeamPro.put(teamId,result); } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/CombatLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/CombatLogic.java index 948ebc5f0..4ae21460c 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/CombatLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/fight/CombatLogic.java @@ -779,8 +779,8 @@ public class CombatLogic { - public static List elementEffect(User user,int teamId){ - List teamParm = user.getTeamPosManager().getCacheTeamPro().get(teamId); + public int[][] elementEffect(User user,int teamId){ + int[][] teamParm = user.getTeamPosManager().getCacheTeamPro().get(teamId); if(teamParm!=null){ return teamParm; } @@ -814,67 +814,32 @@ public class CombatLogic { for(Map.Entry entry :propertiesMap.entrySet()){ LOGGER.info("{}系类型数量为{}",entry.getKey(),entry.getValue()); } - int[][] effect = new int[2][]; - int[] normalProperties = new int[3]; - int[] special = new int[2]; - - - //暗属性判断 - if(propertiesMap.containsKey(6)){ - special[0] = 2; - special[1] = propertiesMap.get(6); - } - propertiesMap.remove(6); - //光属性判断 - if(propertiesMap.size()>1){ - if(propertiesMap.containsKey(5)) { - int allRoundProperCount = propertiesMap.get(5); - propertiesMap.remove(5); - if(allRoundProperCount<5){ //光属性小于5 - for (Map.Entry entry:propertiesMap.entrySet()){ - if(entry.getKey()!=6&&entry.getKey()!=5){ - propertiesMap.put(entry.getKey(), entry.getValue()+allRoundProperCount); - break; - } - } - } - } - } + int[] normalProperties = new int[6]; //普通属性判断 - normalProperties[0] = 1; - int nomalIndex = 1; + int nomalIndex = 0; for(Map.Entry entry:propertiesMap.entrySet()){ - if(entry.getKey()!=6){ - if(entry.getValue()!=1){ - normalProperties[nomalIndex] = entry.getValue(); - nomalIndex++; + normalProperties[nomalIndex] = entry.getValue(); + nomalIndex++; + } + int elementId = 0; + outer:for(Map.Entry entry:configMap.entrySet()){ + if(entry.getValue().getType().length!=normalProperties.length){ + continue; + } + for(int i = 0 ; ientry.getKey()?elementId:entry.getKey(); } - effect[0] = normalProperties; - effect[1] = special; -/* for(int i = 0 ; i2){ -// LOGGER.info("生效的光环为{},{},{}",effect[i][0],effect[i][1],effect[i][2]); - }else{ -// LOGGER.info("生效的光环为{},{}",effect[i][0],effect[i][1]); - } - - }*/ - List resultEffect = new ArrayList<>(); - for(int i = 0; i entry:configMap.entrySet()){ - if(Arrays.equals(effect[i],entry.getValue().getType())){ - resultEffect.add(entry.getValue().getContent()); - } - } + if(elementId==0){ + return null; } - /* Iterator it = resultEffect.iterator(); - while (it.hasNext()){ - int[][] next = it.next(); - }*/ - user.getTeamPosManager().updateTeamPos(teamId,resultEffect); - return resultEffect; + LOGGER.info("触发光环的ID为{}",elementId); + int[][] resultElement = configMap.get(elementId).getContent(); + user.getTeamPosManager().updateTeamPos(teamId, resultElement); + return resultElement; } public static > Map sortByValueDescending(Map map) 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 02dd41285..51bb0e078 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 @@ -1348,11 +1348,10 @@ public class HeroLogic{ //阵营光环加成 if(!isForce){ if(teamId!=0){ - List elementEffect = CombatLogic.getInstance().elementEffect(user,teamId); - Iterator it = elementEffect.iterator(); - while (it.hasNext()){ - int[][] effect = (int[][])it.next(); - combinedAttribute(effect,heroAllAttribute); + int[][] elementEffect = CombatLogic.getInstance().elementEffect(user,teamId); + + if (elementEffect!=null&&elementEffect.length>0){ + combinedAttribute(elementEffect,heroAllAttribute); } } }