潜能战力调整
parent
dee7978c3a
commit
4b840e5750
|
|
@ -64,6 +64,7 @@ import java.text.MessageFormat;
|
|||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@SuppressWarnings({"DanglingJavadoc", "JavadocDeclaration", "CommentedOutCode", "unused"})
|
||||
|
|
@ -2970,7 +2971,7 @@ public class HeroLogic {
|
|||
}
|
||||
propertyValueByIdMap.put(prop[0], propertyValueByIdMap.getOrDefault(prop[0],0L)+value);
|
||||
}
|
||||
LOGGER.info("=================>装备战力,位置:{},参数:{}",sEquipConfig.getPosition(), propertyValueByIdMap);
|
||||
// LOGGER.info("=================>装备战力,位置:{},参数:{}",sEquipConfig.getPosition(), propertyValueByIdMap);
|
||||
combinedAttribute(propertyValueByIdMap, heroAllAttribute);
|
||||
// 添加到套装list
|
||||
suiteNumList.add(sEquipConfig);
|
||||
|
|
@ -3000,6 +3001,12 @@ public class HeroLogic {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 法宝和法相
|
||||
* @param heroAllAttribute 总数值
|
||||
* @param hero 英雄
|
||||
* @param user 主角
|
||||
*/
|
||||
private void applyEquipTalismanaAndFaxiangAttribute(Map<Integer, Long> heroAllAttribute, Hero hero, User user){
|
||||
// ... 法宝 ...
|
||||
int heroStar = hero.getStar();
|
||||
|
|
@ -3027,14 +3034,18 @@ public class HeroLogic {
|
|||
SFaxiangLevelConfig levelConfig = SFaxiangLevelConfig.poolMap.get(config.getLevelUpPool()).get(faxiang.getStrongLv());
|
||||
SFaxiangStarConfig starConfig = SFaxiangStarConfig.poolMap.get(config.getStar()).get(faxiang.getStar());
|
||||
int[][] levelPara = levelConfig.getLevelPara();
|
||||
int[][] property = new int[levelPara.length][2];
|
||||
for (int i = 0; i < levelPara.length; i++) {
|
||||
int[] alone = levelPara[i];
|
||||
property[i][0] = alone[0];
|
||||
int value = (int) Math.round(alone[1] * (1 + (starConfig.getStarPara()+potentialBuff)/10000d));
|
||||
property[i][1] = value;
|
||||
HashMap<Integer, Long> map = new HashMap<>(levelPara.length);
|
||||
for (int[] alone : levelPara) {
|
||||
int pId = alone[0];
|
||||
long value = Math.round(alone[1] * (1 + (starConfig.getStarPara()) / 10000d));
|
||||
SPropertyConfig propertyConfig = SPropertyConfig.getsPropertyConfigByPID(pId);
|
||||
if (propertyConfig != null && propertyConfig.getStyle() == 1){
|
||||
value = Math.round(value * (1 + (potentialBuff) / 10000d));
|
||||
}
|
||||
map.put(pId, map.getOrDefault(pId,0L) + value);
|
||||
}
|
||||
combinedAttribute(property, heroAllAttribute);
|
||||
// LOGGER.info("法相属性计算===================>id:{}, value:{}",id,map);
|
||||
combinedAttribute(map, heroAllAttribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3076,131 +3087,119 @@ public class HeroLogic {
|
|||
combinedAttribute(giftAttrMap, heroAllAttribute);
|
||||
}
|
||||
|
||||
private void applyJewelAttribute(Map<Integer, Long> heroAllAttribute, Hero hero, User user){
|
||||
// ... 魂灵宝属性 ...
|
||||
/**
|
||||
* 计算魂灵宝属性
|
||||
* @param heroAllAttribute 总属性
|
||||
* @param hero 英雄
|
||||
* @param user 用户
|
||||
*/
|
||||
private void applyJewelAttribute(Map<Integer, Long> heroAllAttribute, Hero hero, User user) {
|
||||
EquipManager equipManager = user.getEquipManager();
|
||||
Map<String, PropertyItem> equipMap = new HashMap<>();
|
||||
// 助战英雄
|
||||
Map<String, PropertyItem> equipMap;
|
||||
HelpHero helpHero = HelpHeroLogic.getHelpHeroByHeroId(user.getId(), hero.getId());
|
||||
if (helpHero != null) {
|
||||
for (Jewel jewel : helpHero.getJewels()) {
|
||||
equipMap.put(jewel.getId(), jewel);
|
||||
}
|
||||
equipMap = helpHero.getJewels().stream().collect(Collectors.toMap(Jewel::getId, Function.identity()));
|
||||
} else {
|
||||
equipMap = hero.getCreateType() == 1 ? user.getExpeditionManager().getEquipMap() : equipManager.getEquipMap();
|
||||
}
|
||||
|
||||
Set<String> jewelInfo = hero.getJewelInfo();
|
||||
boolean flashing = jewelInfo.size() == 2;
|
||||
int minLevel = -1;
|
||||
int minBuildLevel = -1;
|
||||
|
||||
for (String jewelId : jewelInfo) {
|
||||
PropertyItem propertyItem = equipMap.get(jewelId);
|
||||
if (propertyItem == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Jewel jewel;
|
||||
if (propertyItem instanceof Jewel){
|
||||
if (propertyItem instanceof Jewel) {
|
||||
jewel = (Jewel) propertyItem;
|
||||
}else {
|
||||
} else {
|
||||
Map<String, Jewel> jewelMap = equipManager.getJewelMap();
|
||||
jewel = jewelMap.get(jewelId);
|
||||
if (jewel == null){
|
||||
LOGGER.error("计算战力,英雄:{}-{},宝器:{},数据库内找不到",hero.getId(),hero.getTemplateId(),jewelId);
|
||||
if (jewel == null) {
|
||||
LOGGER.error("计算战力,英雄:{}-{},宝器:{},数据库内找不到", hero.getId(), hero.getTemplateId(), jewelId);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
SJewelConfig config = STableManager.getConfig(SJewelConfig.class).get(jewel.getEquipId());
|
||||
int[][] property;
|
||||
// 潜能
|
||||
// 潜能参数
|
||||
int potentialType = jewel.getJewelType() == 1 ? 5 : 6;
|
||||
int potentialBuff = getPotentialBuff(user, hero, potentialType);
|
||||
// 强化
|
||||
applyJewelLevelUpAttribute(config, jewel, potentialBuff, heroAllAttribute);
|
||||
// 精炼
|
||||
applyJewelRankUpAttribute(config, jewel, potentialBuff, heroAllAttribute);
|
||||
// 神应
|
||||
applyJewelGodTreeAttribute(user, helpHero, jewel, config, heroAllAttribute);
|
||||
}
|
||||
}
|
||||
|
||||
// 升级
|
||||
Map<Integer, Map<Integer, SJewelRankupConfig>> levelPoolMap = SJewelRankupConfig.rankupMap.get(config.getLevelupPool());
|
||||
if (levelPoolMap != null) {
|
||||
property = levelPoolMap.get(1).get(jewel.getLevel()).getProperty();
|
||||
for (int[] prop : property) {
|
||||
SPropertyConfig pro = SPropertyConfig.getsPropertyConfigByPID(prop[0]);
|
||||
// 潜能增加基础属性
|
||||
if (pro != null && pro.getStyle() == 1){
|
||||
prop[1] = (int) Math.round(prop[1] * (potentialBuff / 10000d));
|
||||
}
|
||||
}
|
||||
combinedAttribute(property, heroAllAttribute);
|
||||
}
|
||||
private void applyJewelGodTreeAttribute(User user, HelpHero helpHero, Jewel jewel, SJewelConfig config, Map<Integer, Long> heroAllAttribute) {
|
||||
if (!HeroLogic.ifOpenGodTree(user)) {
|
||||
return;
|
||||
}
|
||||
Map<Integer, Map<Integer, SJewelRankupConfig>> godTreePoolMap = SJewelRankupConfig.rankupMap.get(config.getGodHoodPool());
|
||||
if (godTreePoolMap == null) {
|
||||
return;
|
||||
}
|
||||
int[][] property;
|
||||
if (helpHero != null) {
|
||||
property = godTreeAddition(godTreePoolMap, jewel.getGodTreeLv(), helpHero.getFourTotalTier());
|
||||
} else {
|
||||
int level = Math.min(jewel.getGodTreeLv(), config.getGodHoodMaxlv());
|
||||
property = godTreeAddition(godTreePoolMap, level, user.getPlayerInfoManager().getFourChallengeTotal());
|
||||
}
|
||||
combinedAttribute(property, heroAllAttribute);
|
||||
}
|
||||
|
||||
// 进阶
|
||||
Map<Integer, Map<Integer, SJewelRankupConfig>> rankPoolMap = SJewelRankupConfig.rankupMap.get(config.getRankupPool());
|
||||
if (rankPoolMap != null) {
|
||||
property = rankPoolMap.get(2).get(jewel.getBuildLevel()).getProperty();
|
||||
for (int[] prop : property) {
|
||||
SPropertyConfig pro = SPropertyConfig.getsPropertyConfigByPID(prop[0]);
|
||||
// 潜能增加基础属性
|
||||
if (pro != null && pro.getStyle() == 1){
|
||||
prop[1] = (int) Math.round(prop[1] * (potentialBuff / 10000d));
|
||||
}
|
||||
}
|
||||
combinedAttribute(property, heroAllAttribute);
|
||||
}
|
||||
|
||||
// 神应/神树
|
||||
Map<Integer, Map<Integer, SJewelRankupConfig>> godTreePoolMap = SJewelRankupConfig.rankupMap.get(config.getGodHoodPool());
|
||||
if (godTreePoolMap != null) {
|
||||
if (helpHero != null) {
|
||||
// 助战
|
||||
property = godTreeAddition(godTreePoolMap, jewel.getGodTreeLv(), helpHero.getFourTotalTier());
|
||||
combinedAttribute(property, heroAllAttribute);
|
||||
} else {
|
||||
// 自己
|
||||
if (HeroLogic.ifOpenGodTree(user)) {
|
||||
// 获取神应等级
|
||||
int level = Math.min(jewel.getGodTreeLv(), config.getGodHoodMaxlv());
|
||||
// 获取加成属性
|
||||
property = godTreeAddition(godTreePoolMap, level, user.getPlayerInfoManager().getFourChallengeTotal());
|
||||
combinedAttribute(property, heroAllAttribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 共鸣参数
|
||||
if (flashing) {
|
||||
if (minLevel == -1) {
|
||||
minLevel = jewel.getLevelByHongMeng(user.getHeroManager(), hero.getId());
|
||||
} else {
|
||||
minLevel = Math.min(jewel.getLevelByHongMeng(user.getHeroManager(), hero.getId()), minLevel);
|
||||
}
|
||||
if (minBuildLevel == -1) {
|
||||
minBuildLevel = jewel.getBuildLevel();
|
||||
} else {
|
||||
minBuildLevel = Math.min(jewel.getBuildLevel(), minBuildLevel);
|
||||
private void applyJewelLevelUpAttribute(SJewelConfig config, Jewel jewel, int potentialBuff, Map<Integer, Long> heroAllAttribute) {
|
||||
Map<Integer, Map<Integer, SJewelRankupConfig>> levelPoolMap = SJewelRankupConfig.rankupMap.get(config.getLevelupPool());
|
||||
if (levelPoolMap != null) {
|
||||
Map<Integer, SJewelRankupConfig> levelMap = levelPoolMap.get(1);
|
||||
if (levelMap != null) {
|
||||
SJewelRankupConfig rankupConfig = levelMap.get(jewel.getLevel());
|
||||
if (rankupConfig != null) {
|
||||
int[][] property = rankupConfig.getProperty();
|
||||
applyJewelAttribute(property, potentialBuff, heroAllAttribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//宝器共鸣
|
||||
if (flashing) {
|
||||
Map<Integer, SJewelResonanceConfig> config = STableManager.getConfig(SJewelResonanceConfig.class);
|
||||
int levelProperty = 0;
|
||||
int buildLevelProperty = 0;
|
||||
for (SJewelResonanceConfig value : config.values()) {
|
||||
if (value.getType() == 1) {
|
||||
levelProperty = value.getLevel() > minLevel ? levelProperty : (Math.max(value.getId(), levelProperty));
|
||||
private void applyJewelRankUpAttribute(SJewelConfig config, Jewel jewel, int potentialBuff, Map<Integer, Long> heroAllAttribute) {
|
||||
Map<Integer, Map<Integer, SJewelRankupConfig>> rankPoolMap = SJewelRankupConfig.rankupMap.get(config.getRankupPool());
|
||||
if (rankPoolMap != null) {
|
||||
Map<Integer, SJewelRankupConfig> rankMap = rankPoolMap.get(2);
|
||||
if (rankMap != null) {
|
||||
SJewelRankupConfig rankupConfig = rankMap.get(jewel.getBuildLevel());
|
||||
if (rankupConfig != null) {
|
||||
int[][] property = rankupConfig.getProperty();
|
||||
applyJewelAttribute(property, potentialBuff, heroAllAttribute);
|
||||
}
|
||||
if (value.getType() == 2) {
|
||||
buildLevelProperty = value.getLevel() > minBuildLevel ? buildLevelProperty : (Math.max(value.getId(), buildLevelProperty));
|
||||
}
|
||||
}
|
||||
if (levelProperty != 0) {
|
||||
combinedAttribute(config.get(levelProperty).getProperty(), heroAllAttribute);
|
||||
}
|
||||
if (buildLevelProperty != 0) {
|
||||
combinedAttribute(config.get(buildLevelProperty).getProperty(), heroAllAttribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void applyJewelAttribute(int[][] property, int potentialBuff, Map<Integer, Long> heroAllAttribute) {
|
||||
HashMap<Integer, Long> propertyMap = new HashMap<>();
|
||||
for (int[] prop : property) {
|
||||
int id = prop[0];
|
||||
int value = prop[1];
|
||||
SPropertyConfig pro = SPropertyConfig.getsPropertyConfigByPID(id);
|
||||
// 潜能增加基础属性
|
||||
if (pro != null && pro.getStyle() == 1){
|
||||
int round = (int) Math.round(value * (1 + potentialBuff / 10000d));
|
||||
propertyMap.put(id,propertyMap.getOrDefault(id,0L)+round);
|
||||
}else {
|
||||
propertyMap.put(id,propertyMap.getOrDefault(id,0L)+value);
|
||||
}
|
||||
}
|
||||
combinedAttribute(propertyMap, heroAllAttribute);
|
||||
}
|
||||
|
||||
private void applySoulEquipAndGodSealAttribute(Map<Integer, Long> heroAllAttribute, Hero hero, User user){
|
||||
// ... 魂印和神印等属性加成 ...
|
||||
Map<Integer, SEquipConfig> equipConfigMap = STableManager.getConfig(SEquipConfig.class);
|
||||
|
|
|
|||
|
|
@ -35,11 +35,15 @@ public class SJewelRankupConfig implements BaseConfig {
|
|||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SJewelRankupConfig> configMap = STableManager.getConfig(SJewelRankupConfig.class);
|
||||
Map<Integer,Map<Integer,Map<Integer,SJewelRankupConfig>>> map1 = new HashMap<>();
|
||||
for(SJewelRankupConfig config:configMap.values()){
|
||||
rankupMap.computeIfAbsent(config.getPoolID(), k -> new HashMap<>());
|
||||
rankupMap.get(config.getPoolID()).computeIfAbsent(config.getType(),k->new HashMap<>());
|
||||
rankupMap.get(config.getPoolID()).get(config.getType()).put(config.getLevel(),config);
|
||||
Map<Integer, Map<Integer, SJewelRankupConfig>> poolMap = map1.getOrDefault(config.getPoolID(), new HashMap<>());
|
||||
Map<Integer, SJewelRankupConfig> typeMap = poolMap.getOrDefault(config.getType(), new HashMap<>());
|
||||
typeMap.put(config.getLevel(), config);
|
||||
poolMap.put(config.getType(), typeMap);
|
||||
map1.put(config.getPoolID(), poolMap);
|
||||
}
|
||||
rankupMap = map1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue