阵营光环修改

back_recharge
lvxinran 2020-04-16 19:59:12 +08:00
parent 12d354559e
commit 7ab0a3642a
3 changed files with 29 additions and 65 deletions

View File

@ -16,7 +16,7 @@ public class TeamPosManager extends MongoBase {
@Transient
private int curTeamPosId;
@Transient
private Map<Integer,List<int[][]>> cacheTeamPro = new HashMap<>(5);
private Map<Integer,int[][]> cacheTeamPro = new HashMap<>(5);
@Transient
private Map<Integer,List<Integer>> cachePassskill = new HashMap<>(5);
@ -92,11 +92,11 @@ public class TeamPosManager extends MongoBase {
cachePassskill.remove(curTeamPosId);
}
public Map<Integer, List<int[][]>> getCacheTeamPro() {
public Map<Integer, int[][]> getCacheTeamPro() {
return cacheTeamPro;
}
public void updateTeamPos(int teamId,List<int[][]> result){
public void updateTeamPos(int teamId,int[][] result){
cacheTeamPro.put(teamId,result);
}

View File

@ -779,8 +779,8 @@ public class CombatLogic {
public static List<int[][]> elementEffect(User user,int teamId){
List<int[][]> 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<Integer,Integer> 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<Integer,Integer> 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<Integer,Integer> 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<Integer,SElementalResonanceConfig> entry:configMap.entrySet()){
if(entry.getValue().getType().length!=normalProperties.length){
continue;
}
for(int i = 0 ; i<normalProperties.length;){
if(normalProperties[i]<entry.getValue().getType()[i]){
continue outer;
}
}
elementId = elementId>entry.getKey()?elementId:entry.getKey();
}
effect[0] = normalProperties;
effect[1] = special;
/* for(int i = 0 ; i<effect.length;i++){
if(effect[i].length>2){
// LOGGER.info("生效的光环为{}{}{}",effect[i][0],effect[i][1],effect[i][2]);
}else{
// LOGGER.info("生效的光环为{}{}",effect[i][0],effect[i][1]);
}
}*/
List<int[][]> resultEffect = new ArrayList<>();
for(int i = 0; i <effect.length;i++){
for(Map.Entry<Integer,SElementalResonanceConfig> entry:configMap.entrySet()){
if(Arrays.equals(effect[i],entry.getValue().getType())){
resultEffect.add(entry.getValue().getContent());
}
}
if(elementId==0){
return null;
}
/* Iterator<int[][]> 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 <K, V extends Comparable<? super V>> Map<K, V> sortByValueDescending(Map<K, V> map)

View File

@ -1348,11 +1348,10 @@ public class HeroLogic{
//阵营光环加成
if(!isForce){
if(teamId!=0){
List<int[][]> 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);
}
}
}