套装优化
parent
543cca1864
commit
813ff75cfb
|
@ -1550,7 +1550,9 @@ public class HeroLogic{
|
|||
int equipForce=0;
|
||||
boolean needRemove = false;
|
||||
Iterator<Map.Entry<Integer, Integer>> iterator = hero.getEquipByPositionMap().entrySet().iterator();
|
||||
Map<Integer,Integer> suiteNumByIdMap = new HashMap<>();
|
||||
// Map<Integer,Integer> suiteNumByIdMap = new HashMap<>();
|
||||
// 套装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());
|
||||
|
@ -1561,19 +1563,44 @@ public class HeroLogic{
|
|||
}
|
||||
combinedAttribute(propertyValueByIdMap,heroAllAttribute);
|
||||
equipForce+=sEquipConfig.getScore();
|
||||
suiteNumByIdMap.put(sEquipConfig.getSuiteID(),suiteNumByIdMap.getOrDefault(sEquipConfig.getSuiteID(),0)+1);
|
||||
// suiteNumByIdMap.put(sEquipConfig.getId(),suiteNumByIdMap.getOrDefault(sEquipConfig.getSuiteID(),0)+1);
|
||||
// 添加到套装list
|
||||
suiteNumList.add(sEquipConfig);
|
||||
}
|
||||
if(!suiteNumByIdMap.isEmpty()){
|
||||
suiteNumByIdMap.forEach((suiteId,suiteNums)->{
|
||||
SEquipSuiteConfig sEquipSuiteConfig =SEquipSuiteConfig.config.get(suiteId);
|
||||
if( null!=sEquipSuiteConfig){
|
||||
Map<Integer, Integer> suitePropertyMap = sEquipSuiteConfig.getSuiteMap().get(suiteNums);
|
||||
|
||||
/*========== 开始处理套装 ============*/
|
||||
// 根据升序顺序排列list
|
||||
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){
|
||||
// 根据套装数量读表,为空标是套装数量不足
|
||||
Map<Integer, Integer> suitePropertyMap = sEquipSuiteConfig.getSuiteMap().get(num);
|
||||
if(suitePropertyMap!=null){
|
||||
// 计算战力
|
||||
combinedAttribute(suitePropertyMap,heroAllAttribute);
|
||||
}
|
||||
}
|
||||
});
|
||||
// 不管是否是套装,都要-1
|
||||
num-=1;
|
||||
}
|
||||
}
|
||||
// if(!suiteNumByIdMap.isEmpty()){
|
||||
// suiteNumByIdMap.forEach((suiteId,suiteNums)->{
|
||||
// SEquipSuiteConfig sEquipSuiteConfig =SEquipSuiteConfig.config.get(suiteId);
|
||||
// if( null!=sEquipSuiteConfig){
|
||||
// Map<Integer, Integer> suitePropertyMap = sEquipSuiteConfig.getSuiteMap().get(suiteNums);
|
||||
// if(suitePropertyMap!=null){
|
||||
// combinedAttribute(suitePropertyMap,heroAllAttribute);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
if(needRemove){
|
||||
AyyncWorker ayyncWorker = new AyyncWorker(user,true,user1 -> {
|
||||
Map<String, Hero> heroMap = user1.getHeroManager().getHeroMap();
|
||||
|
|
|
@ -6,7 +6,7 @@ import manager.Table;
|
|||
import java.util.*;
|
||||
|
||||
@Table(name ="EquipConfig")
|
||||
public class SEquipConfig implements BaseConfig {
|
||||
public class SEquipConfig implements BaseConfig,Comparable<SEquipConfig> {
|
||||
|
||||
private int id;
|
||||
|
||||
|
@ -173,4 +173,9 @@ public class SEquipConfig implements BaseConfig {
|
|||
public int getSuiteID() {
|
||||
return suiteID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(SEquipConfig o) {
|
||||
return this.getStar() - o.getStar();
|
||||
}
|
||||
}
|
|
@ -24,8 +24,11 @@ public class SEquipSuiteConfig implements BaseConfig {
|
|||
Map<Integer,Map<Integer,Integer>> suiteMapTmp = new HashMap<>();
|
||||
int[][] suiteValue = item.getSuiteValue();
|
||||
for(int[] suiteItem :suiteValue){
|
||||
suiteMapTmp.putIfAbsent(suiteItem[0],suiteMapTmp.getOrDefault(suiteItem[0],new HashMap<>(suiteMapTmp.getOrDefault(suiteItem[0]-1,new HashMap<>()))));
|
||||
suiteMapTmp.get(suiteItem[0]).put(suiteItem[1], suiteMapTmp.get(suiteItem[0]).getOrDefault(suiteItem[1],0) + suiteItem[2]);
|
||||
HashMap<Integer, Integer> map = new HashMap<>();
|
||||
map.putIfAbsent(suiteItem[1],suiteItem[2]);
|
||||
suiteMapTmp.put(suiteItem[0],map);
|
||||
// suiteMapTmp.putIfAbsent(suiteItem[0],suiteMapTmp.getOrDefault(suiteItem[0],new HashMap<>(suiteMapTmp.getOrDefault(suiteItem[0]-1,new HashMap<>()))));
|
||||
// suiteMapTmp.get(suiteItem[0]).put(suiteItem[1], suiteMapTmp.get(suiteItem[0]).getOrDefault(suiteItem[1],0) + suiteItem[2]);
|
||||
}
|
||||
item.setSuiteMap(suiteMapTmp);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue